Project1

标题: 关于多重状态的问题。。。 [打印本页]

作者: CR~    时间: 2018-4-21 17:19
标题: 关于多重状态的问题。。。
我用状态的方法来制作技能冷却,,为了便于与空的状态分辨,我把技能冷却的状态都起名为“-”
然后,,,我用了这个多重状态的脚本,
如何能让状态名为“-”的状态不显示名字?

比如这个,如何能把状态栏里那个“-”的状态的名字给去掉,但是不影响实际的状态?
以下是我那个多重状态的脚本
RUBY 代码复制
  1. #==============================================================================
  2. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  3. #==============================================================================
  4. #==============================================================================
  5. # 多重状态     Ver. 1.1                 by Claimh
  6. #------------------------------------------------------------------------------
  7. # [url]http://www.k3.dion.ne.jp/~claimh/[/url]
  8. #==============================================================================
  9. class Window_Base < Window
  10.   #--------------------------------------------------------------------------
  11.   #  生成状态文字
  12.   #--------------------------------------------------------------------------
  13.   def make_battler_state_text_over3(battler, width, need_normal)
  14.     brackets_width = self.contents.text_size("[]").width
  15.     text = ""
  16.     text0 = ""
  17.     ret_text = ["",""]
  18.     for i in battler.states
  19.       if $data_states[i].rating >= 1
  20.         if text == ""
  21.           text = $data_states[i].name
  22.         else
  23.           new_text = text + " " + $data_states[i].name
  24.           text_width = self.contents.text_size(new_text).width
  25.           if text_width > width - brackets_width
  26.             text0 = new_text  
  27.             text = ""
  28.             new_text = ""
  29.             text_width = 0
  30.           else
  31.             text = new_text  
  32.           end
  33.         end
  34.       end
  35.     end
  36.     if text == "" and text0 == ""
  37.       ret_text = [" ", ""]
  38.     elsif text0 == ""
  39.       ret_text[0] = "[" + text + "]"
  40.       ret_text[1] = ""
  41.     else
  42.       ret_text[0] = "[" + text0 + "]"
  43.       if text != ""
  44.         ret_text[1] = "[" + text + "]"
  45.       else
  46.         ret_text[1] = ""
  47.       end
  48.     end
  49.     return ret_text
  50.   end
  51.   #--------------------------------------------------------------------------
  52.   # 描绘角色状态
  53.   #--------------------------------------------------------------------------
  54.   def draw_actor_state(actor, x, y, width = 120)
  55.     text = make_battler_state_text_over3(actor, width, true)
  56.     self.contents.font.color = actor.hp == 0 ? knockout_color : normal_color
  57.     if text[1] == ""
  58.       self.contents.draw_text(x-5, y, width+5, 32, text[0])
  59.     else
  60.       self.contents.font.size = 20
  61.       self.contents.draw_text(x-5, y - 15 , width+5, 32, text[0])
  62.       self.contents.draw_text(x-5, y + 8, width+5, 32, text[1])
  63.     end
  64.   end
  65. end
  66. #==============================================================================
  67. # 本脚本来自[url]www.66RPG.com[/url],使用和转载请保留此信息
  68. #==============================================================================

作者: 灯笼菜刀王    时间: 2018-4-21 17:19
本帖最后由 灯笼菜刀王 于 2018-4-21 18:35 编辑

悄悄的说,

其实你只要把状态的rating,也就是定量 设置为0 ,那它就不会显示了......

鼠标点定量的格子, 按F1有惊喜
作者: yang1zhi    时间: 2018-4-21 18:02
本帖最后由 yang1zhi 于 2018-4-21 18:09 编辑

text = $data_states.name
修改为
if  $data_states.name == "-"
text = ""
else
text = $data_states.name
end

修改为
if $data_states.name == "-"
new_text = text + " "
else
new_text = text + " " + $data_states.name
end
作者: 梦想家大魔王    时间: 2018-4-22 10:17
可以设置不显示状态图标呀,内置的功能。




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1