查看: 2761|回复: 3

[已经解决] 帮助窗口显示状态

[复制链接]
梦石
0
星屑
3850
在线时间
1899 小时
注册时间
2010-6-19
回帖
917
发表于 2022-8-11 15:13:12 | 显示全部楼层 |阅读模式

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

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

×
帮助窗口如何显示  自动状态

2.png



3.png

  1. #==============================================================================
  2. # ■ Shop_Help
  3. #------------------------------------------------------------------------------
  4. # 特技及物品的说明、角色的状态显示的窗口。
  5. # 若要更改属性,请搜索element_set={1=>"火",2=>"冰",3=>"光",4=>"暗",9=>"特殊物品",11=>"宠物书籍",12=>"金柳露"} 改成对应属性即可
  6. #==============================================================================

  7. class Shop_Help < Window_Base
  8.   #--------------------------------------------------------------------------
  9.   # ● 初始化对像
  10.   #--------------------------------------------------------------------------
  11.   def initialize
  12.     super(150,200, 342, 431)
  13.     self.opacity = 255
  14.     self.z = 999
  15.     # 隐藏帮助窗口
  16.     self.visible = false
  17.     # 更改窗口皮肤
  18.     self.windowskin = RPG::Cache.windowskin('物品皮肤/物品')
  19.   end
  20.   #--------------------------------------------------------------------------
  21.   # ● 设置文本
  22.   #     text  : 窗口显示的字符串
  23.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  24.   #--------------------------------------------------------------------------
  25.   def set_text(data)
  26.     @data=data
  27.     case @data
  28.     when RPG::Item           # 物品
  29.       set_item_text(@data)
  30.     when RPG::Weapon         # 武器
  31.       set_weapon_text(@data)
  32.     when RPG::Armor          # 防具
  33.       set_armor_text(@data)
  34.     end
  35.   end
  36.   #--------------------------------------------------------------------------
  37.   # ● 物品帮助窗口
  38.   #--------------------------------------------------------------------------
  39.   def set_item_text(item)
  40.     @item=item
  41.     description=@item.description
  42.     x=0
  43.     y=0
  44.     height=0.5+2.5     #依要显示的内容确定高
  45.     #由描叙确定高
  46.     height+=description.size/3/10
  47.     if description.size%10!=0
  48.       height+=1
  49.     end
  50.     height+=3  #空行,效果范围,价格
  51.     if @item.recover_hp_rate!=0 #HP 回复率。
  52.       height+=1
  53.     end   
  54.     if @item.recover_hp!=0 #HP 回复量。
  55.       height+=1
  56.     end
  57.     if @item.recover_sp_rate!=0 #SP 回复率。
  58.       height+=1
  59.     end
  60.     if @item.recover_sp!=0 #SP 回复量。
  61.       height+=1
  62.     end
  63.     if @item.parameter_type!=0 #增加能力值
  64.       height+=1
  65.     end      
  66.     if @item.element_set.empty?!=true  #属性。为属性 ID 的数组
  67.       height+=1
  68.     end  
  69.     if @item.plus_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  70.       height+=@item.plus_state_set.size  
  71.     end
  72.     if @item.minus_state_set.empty?!=true  #解除状态。为状态 ID 的数组
  73.       height+=@item.minus_state_set.size   
  74.     end     
  75.     self.height=height*15+40+15   
  76.     self.contents = Bitmap.new(self.width - 32,self.height - 32)
  77.     self.contents.clear
  78.     #描绘名字
  79.     text=@item.name
  80.     self.contents.font.color.set(255, 255, 128) # 颜色 黄色
  81.     self.contents.font.size=22
  82.     if text!=nil
  83.       self.visible = true
  84.       self.contents.draw_text(0,0, @item.name.size*70, 22, text, 0)
  85.     else
  86.       self.visible = false
  87.     end
  88.     x=0
  89.     y+=1
  90.     text=description
  91.     #描绘描叙
  92.     while ((text = description.slice!(/./m)) != nil)
  93.       self.contents.font.color = normal_color
  94.       self.contents.font.size=18
  95.       self.contents.draw_text(x*15, y*15+13, 160, 18, text, 0)
  96.       x+=1
  97.       if x==12#每行10个字
  98.         x=0
  99.         y+=1.2   
  100.       end
  101.     end
  102.     #由特技属性确定高
  103.     #效果范围
  104.     scope = {0=>"特殊物品",1=>"敌单体",2=>"敌全体",3=>"己方单体",4=>"己方全体",5=>"己方昏死单体",6=>"己方昏死全体",7=>"使用者"}#HASH表
  105.     text="范围:"+scope[@item.scope]
  106.     x=0
  107.     y+=2  #空一行
  108.     self.contents.font.color = normal_color
  109.     self.contents.font.size=14
  110.     self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  111.     #============================================================
  112.     # 显示物品图片
  113.     bitmap = RPG::Cache.icon('物品大图/' + item.icon_name+"_W")
  114.     self.contents.blt(190, 0, bitmap, Rect.new(0, 0, 120, 120))#物品
  115.     #============================================================
  116.     #价格
  117. #      x=0
  118. #      y+=1      
  119. #      text="价格:"+@item.price.to_s
  120. #      self.contents.font.color = normal_color
  121. #      self.contents.font.size=14   
  122. #      self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)

  123.     #HP 回复率   
  124.     if @item.recover_hp_rate!=0
  125.       x=0
  126.       y+=1      
  127.       text="回复HP:"+@item.recover_hp_rate.to_s+"%"
  128.       self.contents.font.color = normal_color
  129.       self.contents.font.size=14   
  130.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)      
  131.     end
  132.     #HP回复量
  133.     if @item.recover_hp!=0
  134.       x=0
  135.       y+=1      
  136.       text="回复HP:"+@item.recover_hp.to_s
  137.       self.contents.font.color = normal_color
  138.       self.contents.font.size=14   
  139.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  140.     end
  141.      #SP 回复率
  142.     if @item.recover_sp_rate!=0
  143.       x=0
  144.       y+=1      
  145.       text="回复SP:"+@item.recover_sp_rate.to_s+"%"
  146.       self.contents.font.color = normal_color
  147.       self.contents.font.size=14   
  148.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  149.     end
  150.     #SP 回复量
  151.     if @item.recover_sp!=0
  152.       x=0
  153.       y+=1      
  154.       text="回复SP:"+@item.recover_sp.to_s
  155.       self.contents.font.color = normal_color
  156.       self.contents.font.size=14   
  157.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  158.     end
  159.     #增加能力值
  160.     if @item.parameter_type!=0
  161.       parameter_type={1=>"MaxHP",2=>"MaxSP",3=>$data_system.words.str,4=>$data_system.words.dex,5=>$data_system.words.agi,6=>$data_system.words.int}
  162.       x=0
  163.       y+=1      
  164.       text="增益:"+parameter_type[@item.parameter_type]+" +"+@item.parameter_points.to_s
  165.       self.contents.font.color = normal_color
  166.       self.contents.font.size=14   
  167.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  168.     end      

  169.     #物品属性   
  170.     if @item.element_set.empty?!=true  #属性。为属性 ID 的数组
  171.       element_set={1=>"火",2=>"冰",3=>"光",4=>"暗",9=>"特殊物品",11=>"宠物书籍",12=>"金柳露"}
  172.       text="属性:"
  173.       for i in 0...@item.element_set.size
  174.         text+=element_set[@item.element_set[i]]+" "
  175.       end
  176.       x=0
  177.       y+=1
  178.       self.contents.font.color = normal_color
  179.       self.contents.font.size=14
  180.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  181.     end
  182.     #附加状态
  183.     if @item.plus_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  184.       text="附加状态:"
  185.       x=0
  186.       y+=1
  187.       self.contents.font.color = normal_color
  188.       self.contents.font.size=14
  189.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  190.       y-=1
  191.       x+=text.size*5      
  192.       for i in 0...@item.plus_state_set.size
  193.         y+=1
  194.         text=$data_states[@item.plus_state_set[i]].name        
  195.         self.contents.font.color = normal_color
  196.         self.contents.font.size=14
  197.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  198.       end  
  199.     end
  200.     #解除状态
  201.     if @item.minus_state_set.empty?!=true  #解除状态。为状态 ID 的数组
  202.       text="解除状态:"
  203.       x=0
  204.       y+=1
  205.       self.contents.font.color = normal_color
  206.       self.contents.font.size=14
  207.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  208.       y-=1
  209.       x+=text.size*5      
  210.       for i in 0...@item.minus_state_set.size
  211.         y+=1
  212.         text=$data_states[@item.minus_state_set[i]].name        
  213.         self.contents.font.color = normal_color
  214.         self.contents.font.size=14
  215.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  216.       end  
  217.     end     
  218.   end
  219.   #--------------------------------------------------------------------------
  220.   # ● 武器帮助窗口
  221.   #--------------------------------------------------------------------------
  222.   def set_weapon_text(weapon)
  223.     @weapon=weapon
  224.     description=@weapon.description
  225.     x=0
  226.     y=0
  227.     height=0.5+1     #依要显示的内容确定高
  228.     #由描叙确定高
  229.     height+=description.size/3/10
  230.     if description.size%10!=0
  231.       height+=1
  232.     end
  233.     height+=3  #2个空行,攻击,价格
  234.     if @weapon.pdef!=0 #物理防御
  235.       height+=1
  236.     end      
  237.     if @weapon.mdef!=0 #魔法防御
  238.       height+=1
  239.     end
  240.     if @weapon.str_plus!=0 #力量
  241.       height+=1
  242.     end
  243.     if @weapon.dex_plus!=0#体质
  244.       height+=1
  245.     end
  246.     if @weapon.agi_plus!=0#敏捷
  247.       height+=1
  248.     end
  249.     if @weapon.int_plus!=0 #智力
  250.       height+=1
  251.     end      
  252.     if @weapon.element_set.empty?!=true  #属性。为属性 ID 的数组
  253.       height+=1
  254.     end  
  255.     if @weapon.plus_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  256.       height+=@weapon.plus_state_set.size  
  257.     end
  258.     if @weapon.minus_state_set.empty?!=true  #解除状态。为状态 ID 的数组
  259.       height+=@weapon.minus_state_set.size   
  260.     end     
  261.     self.height=height*15+40+15   
  262.     self.contents = Bitmap.new(self.width - 32,self.height - 32)
  263.     self.contents.clear
  264.     #描绘名字
  265.     text=@weapon.name
  266.     self.contents.font.color.set(255, 255, 128) # 颜色 黄色
  267.     self.contents.font.size=22
  268.     if text!=nil
  269.       self.visible = true
  270.       self.contents.draw_text(0,0, @weapon.name.size*70, 22, text, 0)
  271.     else
  272.       self.visible = false
  273.     end
  274.     x=0
  275.     y+=1.5
  276.     text=description
  277.     #描绘描叙
  278.     while ((text = description.slice!(/./m)) != nil)
  279.       self.contents.font.color = normal_color
  280.       self.contents.font.size=18
  281.       self.contents.draw_text(x*15, y*15+5, 160, 18, text, 0)
  282.       x+=1
  283.       if x==12#每行10个字
  284.         x=0
  285.         y+=1.2      
  286.       end
  287.     end
  288.     #由特技属性确定高
  289.     #攻击
  290.       x=0
  291.       y+=2 #空行     
  292.       text="攻击:"+@weapon.atk.to_s
  293.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  294.       self.contents.font.size=14   
  295.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  296.       #============================================================
  297.       # 显示武器图片
  298.       bitmap = RPG::Cache.icon('物品大图/' + weapon.icon_name+"_W")
  299.       self.contents.blt(190, 0, bitmap, Rect.new(0, 0, 120, 120))#武器
  300.       #============================================================
  301.     #价格
  302. #      x=0
  303. #      y+=1      
  304. #      text="价格:"+@weapon.price.to_s
  305. #      self.contents.font.color = normal_color
  306. #      self.contents.font.size=14   
  307. #      self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
  308.     if @weapon.pdef!=0 #物理防御
  309.       x=0
  310.       y+=1      
  311.       text="物理防御:"+@weapon.pdef.to_s
  312.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  313.       self.contents.font.size=14   
  314.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  315.     end      
  316.     if @weapon.mdef!=0 #魔法防御
  317.       x=0
  318.       y+=1      
  319.       text="魔法防御:"+@weapon.mdef.to_s
  320.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  321.       self.contents.font.size=14   
  322.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  323.     end

  324.     #武器属性   
  325.     if @weapon.element_set.empty?!=true  #属性。为属性 ID 的数组
  326.       element_set={1=>"火",2=>"冰",3=>"光",4=>"暗",9=>"特殊物品",11=>"宠物书籍",12=>"金柳露"}
  327.       text="属性:"
  328.       for i in 0...@weapon.element_set.size
  329.         text+=element_set[@weapon.element_set[i]]+" "
  330.       end
  331.       x=0
  332.       y+=1
  333.       self.contents.font.color = normal_color
  334.       self.contents.font.size=14
  335.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  336.     end
  337.     #附加状态
  338.     if @weapon.plus_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  339.       text="附加状态:"
  340.       x=0
  341.       y+=1
  342.       self.contents.font.color = normal_color
  343.       self.contents.font.size=14
  344.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  345.       y-=1
  346.       x+=text.size*5      
  347.       for i in 0...@weapon.plus_state_set.size
  348.         y+=1
  349.         text=$data_states[@weapon.plus_state_set[i]].name        
  350.         self.contents.font.color = normal_color
  351.         self.contents.font.size=14
  352.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  353.       end  
  354.     end
  355.     #解除状态
  356.     if @weapon.minus_state_set.empty?!=true  #解除状态。为状态 ID 的数组
  357.       text="解除状态:"
  358.       x=0
  359.       y+=1
  360.       self.contents.font.color = normal_color
  361.       self.contents.font.size=14
  362.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  363.       y-=1
  364.       x+=text.size*5      
  365.       for i in 0...@weapon.minus_state_set.size
  366.         y+=1
  367.         text=$data_states[@weapon.minus_state_set[i]].name        
  368.         self.contents.font.color = normal_color
  369.         self.contents.font.size=14
  370.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  371.       end  
  372.     end
  373.     y+=1 #空行
  374.     if @weapon.str_plus!=0 #力量
  375.       x=0
  376.       y+=1      
  377.       text=$data_system.words.str+"  + "+@weapon.str_plus.to_s
  378.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  379.       self.contents.font.size=14   
  380.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  381.     end
  382.     if @weapon.dex_plus!=0#体质
  383.       x=0
  384.       y+=1      
  385.       text=$data_system.words.dex+"  + "+@weapon.dex_plus.to_s
  386.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  387.       self.contents.font.size=14   
  388.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  389.     end
  390.     if @weapon.agi_plus!=0#敏捷
  391.       x=0
  392.       y+=1      
  393.       text=$data_system.words.agi+"  + "+@weapon.agi_plus.to_s
  394.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  395.       self.contents.font.size=14   
  396.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  397.     end
  398.     if @weapon.int_plus!=0 #智力
  399.       x=0
  400.       y+=1      
  401.       text=$data_system.words.int+"  + "+@weapon.int_plus.to_s
  402.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  403.       self.contents.font.size=14   
  404.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  405.     end
  406.   end
  407.   #--------------------------------------------------------------------------
  408.   # ● 防具帮助窗口
  409.   #--------------------------------------------------------------------------
  410.   def set_armor_text(armor)
  411.     def set_armor_text(armor)
  412.     @armor=armor
  413.     description=@armor.description
  414.     x=0
  415.     y=0
  416.     height=1+0.5    #依要显示的内容确定高
  417.     #由描叙确定高
  418.     height+=description.size/3/10
  419.     if description.size%10!=0
  420.       height+=1
  421.     end
  422.     height+=2  #2个空行,价格
  423.     if @armor.pdef!=0 #物理防御
  424.       height+=1
  425.     end      
  426.     if @armor.mdef!=0 #魔法防御
  427.       height+=1
  428.     end
  429.     if @armor.str_plus!=0 #力量
  430.       height+=1
  431.     end
  432.     if @armor.dex_plus!=0#体质
  433.       height+=1
  434.     end
  435.     if @armor.agi_plus!=0#敏捷
  436.       height+=1
  437.     end
  438.     if @armor.int_plus!=0 #智力
  439.       height+=1
  440.     end      
  441.     if @armor.guard_element_set.empty?!=true  #属性防御。为属性 ID 的数组
  442.       height+=1
  443.     end  
  444.     if @armor.guard_state_set.empty?!=true  #状态防御。为状态 ID 的数组
  445.       height+=@armor.guard_state_set.size  
  446.     end   
  447.     self.height=height*15+40+15   
  448.     self.contents = Bitmap.new(self.width - 32,self.height - 32)
  449.     self.contents.clear
  450.     #描绘名字
  451.     text=@armor.name
  452.     self.contents.font.color.set(255, 255, 128) # 颜色 黄色
  453.     self.contents.font.size=22
  454.     if text!=nil
  455.       self.visible = true
  456.       self.contents.draw_text(0,0, @armor.name.size*70, 22, text, 0)
  457.     else
  458.       self.visible = false
  459.     end
  460.     x=0
  461.     y+=1.5
  462.     text=description
  463.     #描绘描叙
  464.     while ((text = description.slice!(/./m)) != nil)
  465.       self.contents.font.color = normal_color
  466.       self.contents.font.size=18
  467.       self.contents.draw_text(x*15, y*15+5, 160, 18, text, 0)
  468.       x+=1
  469.       if x==12#每行10个字
  470.         x=0
  471.         y+=1.2      
  472.       end
  473.     end
  474.     #由特技属性确定高
  475.     #============================================================
  476.     # 显示防具图片
  477.     bitmap = RPG::Cache.icon('物品大图/' + armor.icon_name+"_W")
  478.     self.contents.blt(190, 0, bitmap, Rect.new(0, 0, 120, 120))#防具
  479.     #============================================================
  480.     #价格
  481. #      x=0
  482.       y+=1#空行      
  483. #      text="价格:"+@armor.price.to_s
  484. #      self.contents.font.color = normal_color
  485. #      self.contents.font.size=14   
  486. #      self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
  487.     if @armor.pdef!=0 #物理防御
  488.       x=0
  489.       y+=1      
  490.       text="物理防御:"+@armor.pdef.to_s
  491.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  492.       self.contents.font.size=14   
  493.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  494.     end      
  495.     if @armor.mdef!=0 #魔法防御
  496.       x=0
  497.       y+=1      
  498.       text="魔法防御:"+@armor.mdef.to_s
  499.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  500.       self.contents.font.size=14   
  501.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  502.     end

  503.     #属性防御   
  504.     if @armor.guard_element_set.empty?!=true  #属性。为属性 ID 的数组
  505.       element_set={1=>"火",2=>"冰",3=>"光",4=>"暗",9=>"特殊物品",11=>"宠物书籍",12=>"金柳露"}
  506.       text="属性防御:"
  507.       for i in 0...@armor.guard_element_set.size
  508.         text+=element_set[@armor.guard_element_set[i]]+" "
  509.       end
  510.       x=0
  511.       y+=1
  512.       self.contents.font.color = normal_color
  513.       self.contents.font.size=14
  514.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  515.     end
  516.     #状态防御
  517.     if @armor.guard_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  518.       text="状态防御:"
  519.       x=0
  520.       y+=1
  521.       self.contents.font.color = normal_color
  522.       self.contents.font.size=14
  523.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  524.       y-=1
  525.       x+=text.size*5      
  526.       for i in 0...@armor.guard_state_set.size
  527.         y+=1
  528.         text=$data_states[@armor.guard_state_set[i]].name        
  529.         self.contents.font.color = normal_color
  530.         self.contents.font.size=14
  531.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  532.       end  
  533.     end

  534.     y+=1 #空行
  535.     if @armor.str_plus!=0 #力量
  536.       x=0
  537.       y+=1      
  538.       text=$data_system.words.str+"  + "+@armor.str_plus.to_s
  539.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  540.       self.contents.font.size=14   
  541.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  542.     end
  543.     if @armor.dex_plus!=0#体质
  544.       x=0
  545.       y+=1      
  546.       text=$data_system.words.dex+"  + "+@armor.dex_plus.to_s
  547.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  548.       self.contents.font.size=14   
  549.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  550.     end
  551.     if @armor.agi_plus!=0#敏捷
  552.       x=0
  553.       y+=1      
  554.       text=$data_system.words.agi+"  + "+@armor.agi_plus.to_s
  555.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  556.       self.contents.font.size=14   
  557.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  558.     end
  559.     if @armor.int_plus!=0 #智力
  560.       x=0
  561.       y+=1      
  562.       text=$data_system.words.int+"  + "+@armor.int_plus.to_s
  563.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  564.       self.contents.font.size=14   
  565.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  566.     end
  567.   end
  568.   end
  569.   #--------------------------------------------------------------------------
  570.   # ● 设置角色
  571.   #     actor : 要显示状态的角色
  572.   #--------------------------------------------------------------------------
  573.   def set_actor(actor)
  574.     if actor != @actor
  575.       self.contents.clear
  576.       draw_actor_name(actor, 4, 0)
  577.       draw_actor_state(actor, 140, 0)
  578.       draw_actor_hp(actor, 284, 0)
  579.       draw_actor_sp(actor, 460, 0)
  580.       @actor = actor
  581.       @text = nil
  582.       self.visible = true
  583.     end
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ● 设置敌人
  587.   #     enemy : 要显示名字和状态的敌人
  588.   #--------------------------------------------------------------------------
  589.   def set_enemy(enemy)
  590.     text = enemy.name
  591.     state_text = make_battler_state_text(enemy, 112, false)
  592.     if state_text != ""
  593.       text += "  " + state_text
  594.     end
  595.     set_text(text, 1)
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ● 校正帮助窗口位置
  599.   #--------------------------------------------------------------------------
  600.   def set_pos(x,y,width,oy,index,column_max)
  601.     #光标坐标
  602.     xx = index % column_max * 59.5 - ox
  603.     yy = index / column_max * 60 - oy
  604.     self.x=xx+x+74
  605.     self.y=yy+y+74
  606.     if self.x+self.width>1024
  607.       self.x=1024-self.width
  608.     end
  609.     if self.y+self.height>420
  610.       self.y=420-self.height
  611.     end  
  612.   end
  613. end
复制代码
梦石
24
星屑
8942
在线时间
248 小时
注册时间
2020-12-4
回帖
259

极短24获奖极短23获奖极短22获奖

发表于 2022-8-11 17:42:03 | 显示全部楼层
本帖最后由 纯属小虫 于 2022-8-11 17:44 编辑

防具自动状态变量是 @armor.auto_state_id    # 防具自动状态的状态的ID

如果要获取自动状态的名字  应该是 $data_states[@armor.auto_state_id].name

把这个信息依葫芦画瓢地放在413行(防具帮助窗口)之后就好了

【前部分】
if $data_states[@armor.auto_state_id].name != nil
height += 1
end

【后部分】
if $data_states[@armor.auto_state_id].name != nil
      text = "自动状态:" + $data_states[@armor.auto_state_id].name
      self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
      self.contents.font.size=14   
      self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
end

至于显示的位置,以及要不要显示"【自动状态】" 这样的专栏,那你得把这个窗口脚本好好琢磨琢磨了~

评分

参与人数 1星屑 +30 赞 +1 收起 理由
guoxiaomi + 30 + 1 认可答案

查看全部评分

回复

使用道具 举报

梦石
0
星屑
3850
在线时间
1899 小时
注册时间
2010-6-19
回帖
917
 楼主| 发表于 2022-8-11 22:26:28 | 显示全部楼层
纯属小虫 发表于 2022-8-11 17:42
防具自动状态变量是 @armor.auto_state_id    # 防具自动状态的状态的ID

如果要获取自动状态的名字  应该 ...

话说,用if $data_states[@armor.auto_state_id].name != nil的话,会脚本错误,
直接用 ID  
if $data_states[@armor.auto_state_id]!=nil

这样就没问题,也不知道啥原因,不过还是搞定了

2.png

点评

哦 那可能是之前还要加一个 if $data_states[@armor.auto_state_id] != nil 的判定~~~  发表于 2022-8-11 23:45
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部