设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 1656|回复: 5
打印 上一主题 下一主题

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

[复制链接]

Lv3.寻梦者

梦石
0
星屑
1288
在线时间
354 小时
注册时间
2009-9-14
帖子
328
跳转到指定楼层
1
发表于 2015-1-24 21:59:43 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
我修改了技能介绍的脚本,,
现在如果技能的介绍为空时,就会出现这个提示


下面是脚本


RUBY 代码复制
  1. #==============================================================================
  2. # ■ Window_Help
  3. #------------------------------------------------------------------------------
  4. #  特技及物品的说明、角色的状态显示的窗口。
  5. #==============================================================================
  6.  
  7. class Window_SkillHelp < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(320-50, 0, 320+50,416)
  13.     self.contents = Bitmap.new(width - 32, height - 32)
  14.     if $game_temp.in_battle
  15.       self.height = 256+64
  16.       self.back_opacity = 160
  17.     end
  18.   end
  19.   #--------------------------------------------------------------------------
  20.   # ● 设置文本
  21.   #     text  : 窗口显示的字符串
  22.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  23.   #--------------------------------------------------------------------------
  24.   def set_text(skill)
  25.     if skill !=nil
  26.       fontsize=18        #定义文字大小
  27.       infx=140           #定义说明文字左边内容的宽度
  28.       y=20               #定义行距
  29.       self.contents.clear
  30.       self.contents.font.color = normal_color
  31.       self.contents.font.size = fontsize
  32.       xx=0;yy=0
  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.       self.contents.font.size = fontsize
  45.       xx=0;yy+=y
  46.       self.contents.font.color=system_color
  47.       self.contents.draw_text(xx, yy, infx, sss.height, "效果范围")
  48.       xx=infx
  49.       self.contents.font.color=normal_color
  50.       case skill.scope
  51.       when 0;i="无"
  52.       when 1;i="敌方单体";when 2;i="敌方全体"
  53.       when 3;i="我方单体";when 4;i="我方全体"
  54.       when 5;i="我方濒死单体";when 6;i="我方濒死全体"
  55.       when 7;i="自身"
  56.       end
  57.       self.contents.draw_text(xx, yy, infx, sss.height, i)
  58.  
  59.       xx=0;yy+=y
  60.       self.contents.font.color=system_color
  61.       self.contents.draw_text(xx, yy, infx, sss.height, "总伤害")
  62.       $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
  63.       xx=infx
  64.       self.contents.font.color=normal_color
  65.       self.contents.draw_text(xx, yy, infx*2, sss.height, $skill_power.to_s)      
  66.  
  67.       xx=0;yy+=y
  68.       self.contents.font.color=system_color
  69.       self.contents.draw_text(xx, yy, infx, sss.height, "伤害波动")
  70.       xx=infx
  71.       self.contents.font.color=normal_color
  72.       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)   
  73.  
  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.  
  90.  
  91.       xx=0;yy+=y
  92.       self.contents.font.color=system_color
  93.       self.contents.draw_text(xx, yy, infx, sss.height, "伤害类型")
  94.       xx=infx
  95.       self.contents.font.color=normal_color
  96.       self.contents.draw_text(xx, yy, infx*2, sss.height, "物理攻击"+(skill.pdef_f*101/(skill.pdef_f+skill.mdef_f+1)).to_s+"%")
  97.       yy+=y
  98.       self.contents.font.color=normal_color
  99.       self.contents.draw_text(xx, yy, infx*2, sss.height, "魔法攻击"+(skill.mdef_f*101/(skill.pdef_f+skill.mdef_f+1)).to_s+"%")
  100.  
  101.       xx=0;yy+=y;element="";race=""
  102.       self.contents.font.color=system_color
  103.       self.contents.draw_text(xx, yy, infx, sss.height, "攻击属性")
  104.       xx=infx-space;self.contents.font.color=normal_color
  105.       s=[];s=element.scan(/./)
  106.       #一行显示21个字
  107.       for i in s
  108.         sss = self.contents.text_size(i)
  109.         if (xx+sss.width)>(width - 32)#超过屏幕就换行
  110.           yy+=y;xx=infx
  111.         end
  112.         self.contents.draw_text(xx, yy, sss.width, sss.height, i)
  113.         xx+=sss.width
  114.       end
  115.       xx=0;yy+=y;race=""
  116.       for i in skill.plus_state_set
  117.         race=race+"["+$data_states[i].name+"]"
  118.       end
  119.       self.contents.font.color=system_color
  120.       self.contents.draw_text(xx, yy, infx, sss.height, "附加状态")
  121.       xx=infx;self.contents.font.color=normal_color
  122.       s=[];s=race.scan(/./)
  123.       #一行显示21个字
  124.       for i in s
  125.         sss = self.contents.text_size(i)
  126.         if (xx+sss.width)>(width - 32)#超过屏幕就换行
  127.           yy+=y;xx=infx
  128.         end
  129.         self.contents.draw_text(xx, yy, sss.width, sss.height, i)
  130.         xx+=sss.width
  131.       end
  132.       @actor = nil
  133.     end
  134.     self.visible = true
  135.   end
  136.  
  137. end

评分

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

查看全部评分

Lv5.捕梦者

梦石
0
星屑
33077
在线时间
5104 小时
注册时间
2012-11-19
帖子
4878

开拓者

2
发表于 2015-1-24 22:32:14 | 只看该作者
在 29 行后面加一句:return if skill.description == ""
xp vx va mv  va mz 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1288
在线时间
354 小时
注册时间
2009-9-14
帖子
328
3
 楼主| 发表于 2015-1-24 22:53:35 | 只看该作者
芯☆淡茹水 发表于 2015-1-24 22:32
在 29 行后面加一句:return if skill.description == ""

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

回复 支持 反对

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33077
在线时间
5104 小时
注册时间
2012-11-19
帖子
4878

开拓者

4
发表于 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 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
1288
在线时间
354 小时
注册时间
2009-9-14
帖子
328
5
 楼主| 发表于 2015-1-24 23:28:06 | 只看该作者
芯☆淡茹水 发表于 2015-1-24 23:04

额。。。。



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

点评

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

使用道具 举报

Lv5.捕梦者

梦石
0
星屑
33077
在线时间
5104 小时
注册时间
2012-11-19
帖子
4878

开拓者

6
发表于 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 各类型脚本/插件定制
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-9-22 15:37

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表