查看: 2117|回复: 5

[已经解决] 问个关于技能介绍脚本的问题。。。

[复制链接]
梦石
0
星屑
1328
在线时间
354 小时
注册时间
2009-9-14
回帖
211
发表于 2015-1-24 21:59:43 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
我修改了技能介绍的脚本,,
现在如果技能的介绍为空时,就会出现这个提示
QQ截图20150124215901.png

下面是脚本


[pre lang="ruby" line="1"]#==============================================================================
# ■ Window_Help
#------------------------------------------------------------------------------
#  特技及物品的说明、角色的状态显示的窗口。
#==============================================================================

class Window_SkillHelp < Window_Base
  #--------------------------------------------------------------------------
  # ● 初始化对像
  #--------------------------------------------------------------------------
  def initialize
    super(320-50, 0, 320+50,416)
    self.contents = Bitmap.new(width - 32, height - 32)
    if $game_temp.in_battle
      self.height = 256+64
      self.back_opacity = 160
    end
  end
  #--------------------------------------------------------------------------
  # ● 设置文本
  #     text  : 窗口显示的字符串
  #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  #--------------------------------------------------------------------------
  def set_text(skill)
    if skill !=nil
      fontsize=18        #定义文字大小
      infx=140           #定义说明文字左边内容的宽度
      y=20               #定义行距
      self.contents.clear
      self.contents.font.color = normal_color
      self.contents.font.size = fontsize
      xx=0;yy=0
      s=[];s=skill.description.scan(/./)
      space = self.contents.text_size(" ").width
      #一行显示21个字
      for i in s
        sss = self.contents.text_size(i)
        if (xx+sss.width)>(width - 32)#超过屏幕就换行
          yy+=y;xx=4
        end
        self.contents.draw_text(xx, yy, sss.width, sss.height, i)
        xx+=sss.width
      end
      self.contents.font.size = fontsize
      xx=0;yy+=y
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "效果范围")
      xx=infx
      self.contents.font.color=normal_color
      case skill.scope
      when 0;i="无"
      when 1;i="敌方单体";when 2;i="敌方全体"
      when 3;i="我方单体";when 4;i="我方全体"
      when 5;i="我方濒死单体";when 6;i="我方濒死全体"
      when 7;i="自身"
      end
      self.contents.draw_text(xx, yy, infx, sss.height, i)
      
      xx=0;yy+=y
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "总伤害")
      $skill_power=($actor.int * skill.int_f * (100 + skill.power) / 100 + $actor.str * skill.str_f + $actor.dex * skill.dex_f* (100 + skill.power) / 100 + $actor.atk * skill.atk_f) / 100
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, $skill_power.to_s)      

      xx=0;yy+=y
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "伤害波动")
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, ($skill_power*(100-skill.variance)*0.01).to_s+"~"+($skill_power*(100+skill.variance)*0.01).to_s)   
      
      xx=0;yy+=y
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "伤害组成")
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, skill.atk_f.to_s+"%  攻击力 ("+($actor.atk * skill.atk_f*0.01).to_s+")")      
      yy+=y
      self.contents.font.color=text_color(1)
      self.contents.draw_text(xx, yy, infx*2, sss.height, skill.str_f.to_s+"%  力量 ("+($actor.str * skill.str_f*0.01).to_s+")")
      yy+=y
      self.contents.font.color=text_color(2)
      self.contents.draw_text(xx, yy, infx*2, sss.height, (skill.int_f* (100 + skill.power) / 100).to_s+"%  魔力 ("+($actor.int * skill.int_f* (100 + skill.power)*0.0001).to_s+")")      
      yy+=y
      self.contents.font.color=text_color(6)
      self.contents.draw_text(xx, yy, infx*2, sss.height, (skill.dex_f* (100 + skill.power) / 100).to_s+"%  灵巧 ("+($actor.dex * skill.dex_f* (100 + skill.power)*0.0001).to_s+")")
      

      xx=0;yy+=y
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "伤害类型")
      xx=infx
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, "物理攻击"+(skill.pdef_f*101/(skill.pdef_f+skill.mdef_f+1)).to_s+"%")
      yy+=y
      self.contents.font.color=normal_color
      self.contents.draw_text(xx, yy, infx*2, sss.height, "魔法攻击"+(skill.mdef_f*101/(skill.pdef_f+skill.mdef_f+1)).to_s+"%")
      
      xx=0;yy+=y;element="";race=""
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "攻击属性")
      xx=infx-space;self.contents.font.color=normal_color
      s=[];s=element.scan(/./)
      #一行显示21个字
      for i in s
        sss = self.contents.text_size(i)
        if (xx+sss.width)>(width - 32)#超过屏幕就换行
          yy+=y;xx=infx
        end
        self.contents.draw_text(xx, yy, sss.width, sss.height, i)
        xx+=sss.width
      end
      xx=0;yy+=y;race=""
      for i in skill.plus_state_set
        race=race+"["+$data_states.name+"]"
      end
      self.contents.font.color=system_color
      self.contents.draw_text(xx, yy, infx, sss.height, "附加状态")
      xx=infx;self.contents.font.color=normal_color
      s=[];s=race.scan(/./)
      #一行显示21个字
      for i in s
        sss = self.contents.text_size(i)
        if (xx+sss.width)>(width - 32)#超过屏幕就换行
          yy+=y;xx=infx
        end
        self.contents.draw_text(xx, yy, sss.width, sss.height, i)
        xx+=sss.width
      end
      @actor = nil
    end
    self.visible = true
  end
  
end
[/pre]

评分

参与人数 1星屑 +35 收起 理由
︶ㄣ牛排ぶ + 35 手动认可奖励

查看全部评分

梦石
0
星屑
34463
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2015-1-24 22:32:14 | 显示全部楼层
在 29 行后面加一句:return if skill.description == ""
xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

梦石
0
星屑
1328
在线时间
354 小时
注册时间
2009-9-14
回帖
211
 楼主| 发表于 2015-1-24 22:53:35 | 显示全部楼层
芯☆淡茹水 发表于 2015-1-24 22:32
在 29 行后面加一句:return if skill.description == ""

然后就什么都没有了,,,能让他只是技能介绍显示“无”么,下面的数据还在。
171.png
172.png
回复

使用道具 举报

梦石
0
星屑
34463
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2015-1-24 23:04:08 | 显示全部楼层
  1. #==============================================================================
  2. # ■ Window_Help
  3. #------------------------------------------------------------------------------
  4. #  特技及物品的说明、角色的状态显示的窗口。
  5. #==============================================================================

  6. class Window_SkillHelp < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(320-50, 0, 320+50,416)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     if $game_temp.in_battle
  14.       self.height = 256+64
  15.       self.back_opacity = 160
  16.     end
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 设置文本
  20.   #     text  : 窗口显示的字符串
  21.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  22.   #--------------------------------------------------------------------------
  23.   def set_text(skill)
  24.     if skill !=nil
  25.       fontsize=18        #定义文字大小
  26.       infx=140           #定义说明文字左边内容的宽度
  27.       y=20               #定义行距
  28.       self.contents.clear
  29.       self.contents.font.color = normal_color
  30.       self.contents.font.size = fontsize
  31.       xx=0;yy=0
  32.       if skill.description != ""
  33.         s=[];s=skill.description.scan(/./)
  34.         space = self.contents.text_size(" ").width
  35.         #一行显示21个字
  36.         for i in s
  37.           sss = self.contents.text_size(i)
  38.           if (xx+sss.width)>(width - 32)#超过屏幕就换行
  39.             yy+=y;xx=4
  40.           end
  41.           self.contents.draw_text(xx, yy, sss.width, sss.height, i)
  42.           xx+=sss.width
  43.         end
  44.         yy+=y
  45.       end
  46.       self.contents.font.size = fontsize
  47.       xx=0
  48.       self.contents.font.color=system_color
  49.       sss = self.contents.text_size("效果范围")
  50.       self.contents.draw_text(xx, yy, infx, sss.height, "效果范围")
  51.       xx=infx
  52.       self.contents.font.color=normal_color
  53.       case skill.scope
  54.       when 0;i="无"
  55.       when 1;i="敌方单体";when 2;i="敌方全体"
  56.       when 3;i="我方单体";when 4;i="我方全体"
  57.       when 5;i="我方濒死单体";when 6;i="我方濒死全体"
  58.       when 7;i="自身"
  59.       end
  60.       self.contents.draw_text(xx, yy, infx, sss.height, i)

  61.       xx=0;yy+=y
  62.       self.contents.font.color=system_color
  63.       self.contents.draw_text(xx, yy, infx, sss.height, "总伤害")
  64.       $skill_power=($actor.int * skill.int_f * (100 + skill.power) / 100 + $actor.str * skill.str_f + $actor.dex * skill.dex_f* (100 + skill.power) / 100 + $actor.atk * skill.atk_f) / 100
  65.       xx=infx
  66.       self.contents.font.color=normal_color
  67.       self.contents.draw_text(xx, yy, infx*2, sss.height, $skill_power.to_s)      

  68.       xx=0;yy+=y
  69.       self.contents.font.color=system_color
  70.       self.contents.draw_text(xx, yy, infx, sss.height, "伤害波动")
  71.       xx=infx
  72.       self.contents.font.color=normal_color
  73.       self.contents.draw_text(xx, yy, infx*2, sss.height, ($skill_power*(100-skill.variance)*0.01).to_s+"~"+($skill_power*(100+skill.variance)*0.01).to_s)   

  74.       xx=0;yy+=y
  75.       self.contents.font.color=system_color
  76.       self.contents.draw_text(xx, yy, infx, sss.height, "伤害组成")
  77.       xx=infx
  78.       self.contents.font.color=normal_color
  79.       self.contents.draw_text(xx, yy, infx*2, sss.height, skill.atk_f.to_s+"%  攻击力 ("+($actor.atk * skill.atk_f*0.01).to_s+")")      
  80.       yy+=y
  81.       self.contents.font.color=text_color(1)
  82.       self.contents.draw_text(xx, yy, infx*2, sss.height, skill.str_f.to_s+"%  力量 ("+($actor.str * skill.str_f*0.01).to_s+")")
  83.       yy+=y
  84.       self.contents.font.color=text_color(2)
  85.       self.contents.draw_text(xx, yy, infx*2, sss.height, (skill.int_f* (100 + skill.power) / 100).to_s+"%  魔力 ("+($actor.int * skill.int_f* (100 + skill.power)*0.0001).to_s+")")      
  86.       yy+=y
  87.       self.contents.font.color=text_color(6)
  88.       self.contents.draw_text(xx, yy, infx*2, sss.height, (skill.dex_f* (100 + skill.power) / 100).to_s+"%  灵巧 ("+($actor.dex * skill.dex_f* (100 + skill.power)*0.0001).to_s+")")


  89.       xx=0;yy+=y
  90.       self.contents.font.color=system_color
  91.       self.contents.draw_text(xx, yy, infx, sss.height, "伤害类型")
  92.       xx=infx
  93.       self.contents.font.color=normal_color
  94.       self.contents.draw_text(xx, yy, infx*2, sss.height, "物理攻击"+(skill.pdef_f*101/(skill.pdef_f+skill.mdef_f+1)).to_s+"%")
  95.       yy+=y
  96.       self.contents.font.color=normal_color
  97.       self.contents.draw_text(xx, yy, infx*2, sss.height, "魔法攻击"+(skill.mdef_f*101/(skill.pdef_f+skill.mdef_f+1)).to_s+"%")

  98.       xx=0;yy+=y;element="";race=""
  99.       self.contents.font.color=system_color
  100.       self.contents.draw_text(xx, yy, infx, sss.height, "攻击属性")
  101.       xx=infx-space;self.contents.font.color=normal_color
  102.       s=[];s=element.scan(/./)
  103.       #一行显示21个字
  104.       for i in s
  105.         sss = self.contents.text_size(i)
  106.         if (xx+sss.width)>(width - 32)#超过屏幕就换行
  107.           yy+=y;xx=infx
  108.         end
  109.         self.contents.draw_text(xx, yy, sss.width, sss.height, i)
  110.         xx+=sss.width
  111.       end
  112.       xx=0;yy+=y;race=""
  113.       for i in skill.plus_state_set
  114.         race=race+"["+$data_states[i].name+"]"
  115.       end
  116.       self.contents.font.color=system_color
  117.       self.contents.draw_text(xx, yy, infx, sss.height, "附加状态")
  118.       xx=infx;self.contents.font.color=normal_color
  119.       s=[];s=race.scan(/./)
  120.       #一行显示21个字
  121.       for i in s
  122.         sss = self.contents.text_size(i)
  123.         if (xx+sss.width)>(width - 32)#超过屏幕就换行
  124.           yy+=y;xx=infx
  125.         end
  126.         self.contents.draw_text(xx, yy, sss.width, sss.height, i)
  127.         xx+=sss.width
  128.       end
  129.       @actor = nil
  130.     end
  131.     self.visible = true
  132.   end

  133. end
复制代码
xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

梦石
0
星屑
1328
在线时间
354 小时
注册时间
2009-9-14
回帖
211
 楼主| 发表于 2015-1-24 23:28:06 | 显示全部楼层
芯☆淡茹水 发表于 2015-1-24 23:04

额。。。。
173.png


这是207行
      xx=infx-space;self.contents.font.color=normal_color

点评

1,别人的脚本看8懂,头大。 2, 207行?! 一共才140多行啊?! 是外太空吧!  发表于 2015-1-24 23:32
回复

使用道具 举报

梦石
0
星屑
34463
在线时间
5096 小时
注册时间
2012-11-19
回帖
4715

开拓者

发表于 2015-1-24 23:34:37 | 显示全部楼层
  1. #==============================================================================
  2. # ■ Window_Help
  3. #------------------------------------------------------------------------------
  4. #  特技及物品的说明、角色的状态显示的窗口。
  5. #==============================================================================

  6. class Window_SkillHelp < Window_Base
  7.   #--------------------------------------------------------------------------
  8.   # ● 初始化对像
  9.   #--------------------------------------------------------------------------
  10.   def initialize
  11.     super(320-50, 0, 320+50,416)
  12.     self.contents = Bitmap.new(width - 32, height - 32)
  13.     if $game_temp.in_battle
  14.       self.height = 256+64
  15.       self.back_opacity = 160
  16.     end
  17.   end
  18.   #--------------------------------------------------------------------------
  19.   # ● 设置文本
  20.   #     text  : 窗口显示的字符串
  21.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  22.   #--------------------------------------------------------------------------
  23.   def set_text(skill)
  24.     if skill !=nil
  25.       fontsize=18        #定义文字大小
  26.       infx=140           #定义说明文字左边内容的宽度
  27.       y=20               #定义行距
  28.       self.contents.clear
  29.       self.contents.font.color = normal_color
  30.       self.contents.font.size = fontsize
  31.       xx=0;yy=0
  32.       space = self.contents.text_size(" ").width
  33.       if skill.description != ""
  34.         s=[];s=skill.description.scan(/./)
  35.         #一行显示21个字
  36.         for i in s
  37.           sss = self.contents.text_size(i)
  38.           if (xx+sss.width)>(width - 32)#超过屏幕就换行
  39.             yy+=y;xx=4
  40.           end
  41.           self.contents.draw_text(xx, yy, sss.width, sss.height, i)
  42.           xx+=sss.width
  43.         end
  44.         yy+=y
  45.       end
  46.       self.contents.font.size = fontsize
  47.       xx=0
  48.       self.contents.font.color=system_color
  49.       sss = self.contents.text_size("效果范围")
  50.       self.contents.draw_text(xx, yy, infx, sss.height, "效果范围")
  51.       xx=infx
  52.       self.contents.font.color=normal_color
  53.       case skill.scope
  54.       when 0;i="无"
  55.       when 1;i="敌方单体";when 2;i="敌方全体"
  56.       when 3;i="我方单体";when 4;i="我方全体"
  57.       when 5;i="我方濒死单体";when 6;i="我方濒死全体"
  58.       when 7;i="自身"
  59.       end
  60.       self.contents.draw_text(xx, yy, infx, sss.height, i)

  61.       xx=0;yy+=y
  62.       self.contents.font.color=system_color
  63.       self.contents.draw_text(xx, yy, infx, sss.height, "总伤害")
  64.       $skill_power=($actor.int * skill.int_f * (100 + skill.power) / 100 + $actor.str * skill.str_f + $actor.dex * skill.dex_f* (100 + skill.power) / 100 + $actor.atk * skill.atk_f) / 100
  65.       xx=infx
  66.       self.contents.font.color=normal_color
  67.       self.contents.draw_text(xx, yy, infx*2, sss.height, $skill_power.to_s)      

  68.       xx=0;yy+=y
  69.       self.contents.font.color=system_color
  70.       self.contents.draw_text(xx, yy, infx, sss.height, "伤害波动")
  71.       xx=infx
  72.       self.contents.font.color=normal_color
  73.       self.contents.draw_text(xx, yy, infx*2, sss.height, ($skill_power*(100-skill.variance)*0.01).to_s+"~"+($skill_power*(100+skill.variance)*0.01).to_s)   

  74.       xx=0;yy+=y
  75.       self.contents.font.color=system_color
  76.       self.contents.draw_text(xx, yy, infx, sss.height, "伤害组成")
  77.       xx=infx
  78.       self.contents.font.color=normal_color
  79.       self.contents.draw_text(xx, yy, infx*2, sss.height, skill.atk_f.to_s+"%  攻击力 ("+($actor.atk * skill.atk_f*0.01).to_s+")")      
  80.       yy+=y
  81.       self.contents.font.color=text_color(1)
  82.       self.contents.draw_text(xx, yy, infx*2, sss.height, skill.str_f.to_s+"%  力量 ("+($actor.str * skill.str_f*0.01).to_s+")")
  83.       yy+=y
  84.       self.contents.font.color=text_color(2)
  85.       self.contents.draw_text(xx, yy, infx*2, sss.height, (skill.int_f* (100 + skill.power) / 100).to_s+"%  魔力 ("+($actor.int * skill.int_f* (100 + skill.power)*0.0001).to_s+")")      
  86.       yy+=y
  87.       self.contents.font.color=text_color(6)
  88.       self.contents.draw_text(xx, yy, infx*2, sss.height, (skill.dex_f* (100 + skill.power) / 100).to_s+"%  灵巧 ("+($actor.dex * skill.dex_f* (100 + skill.power)*0.0001).to_s+")")


  89.       xx=0;yy+=y
  90.       self.contents.font.color=system_color
  91.       self.contents.draw_text(xx, yy, infx, sss.height, "伤害类型")
  92.       xx=infx
  93.       self.contents.font.color=normal_color
  94.       self.contents.draw_text(xx, yy, infx*2, sss.height, "物理攻击"+(skill.pdef_f*101/(skill.pdef_f+skill.mdef_f+1)).to_s+"%")
  95.       yy+=y
  96.       self.contents.font.color=normal_color
  97.       self.contents.draw_text(xx, yy, infx*2, sss.height, "魔法攻击"+(skill.mdef_f*101/(skill.pdef_f+skill.mdef_f+1)).to_s+"%")

  98.       xx=0;yy+=y;element="";race=""
  99.       self.contents.font.color=system_color
  100.       self.contents.draw_text(xx, yy, infx, sss.height, "攻击属性")
  101.       xx=infx-space;self.contents.font.color=normal_color
  102.       s=[];s=element.scan(/./)
  103.       #一行显示21个字
  104.       for i in s
  105.         sss = self.contents.text_size(i)
  106.         if (xx+sss.width)>(width - 32)#超过屏幕就换行
  107.           yy+=y;xx=infx
  108.         end
  109.         self.contents.draw_text(xx, yy, sss.width, sss.height, i)
  110.         xx+=sss.width
  111.       end
  112.       xx=0;yy+=y;race=""
  113.       for i in skill.plus_state_set
  114.         race=race+"["+$data_states[i].name+"]"
  115.       end
  116.       self.contents.font.color=system_color
  117.       self.contents.draw_text(xx, yy, infx, sss.height, "附加状态")
  118.       xx=infx;self.contents.font.color=normal_color
  119.       s=[];s=race.scan(/./)
  120.       #一行显示21个字
  121.       for i in s
  122.         sss = self.contents.text_size(i)
  123.         if (xx+sss.width)>(width - 32)#超过屏幕就换行
  124.           yy+=y;xx=infx
  125.         end
  126.         self.contents.draw_text(xx, yy, sss.width, sss.height, i)
  127.         xx+=sss.width
  128.       end
  129.       @actor = nil
  130.     end
  131.     self.visible = true
  132.   end

  133. end
复制代码

点评

CR~
可以了,十分感谢啊!~  发表于 2015-1-24 23:42

评分

参与人数 1梦石 +1 收起 理由
︶ㄣ牛排ぶ + 1 认可答案

查看全部评分

xp vx va mv  va mz 各类型脚本/插件定制
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部