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

Project1

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

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

[复制链接]

Lv3.寻梦者

梦石
0
星屑
3171
在线时间
1863 小时
注册时间
2010-6-19
帖子
1205
跳转到指定楼层
1
发表于 2022-8-11 15:13:12 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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







RUBY 代码复制
  1. #==============================================================================
  2. # ■ Shop_Help
  3. #------------------------------------------------------------------------------
  4. # 特技及物品的说明、角色的状态显示的窗口。
  5. # 若要更改属性,请搜索element_set={1=>"火",2=>"冰",3=>"光",4=>"暗",9=>"特殊物品",11=>"宠物书籍",12=>"金柳露"} 改成对应属性即可
  6. #==============================================================================
  7.  
  8. class Shop_Help < Window_Base
  9.   #--------------------------------------------------------------------------
  10.   # ● 初始化对像
  11.   #--------------------------------------------------------------------------
  12.   def initialize
  13.     super(150,200, 342, 431)
  14.     self.opacity = 255
  15.     self.z = 999
  16.     # 隐藏帮助窗口
  17.     self.visible = false
  18.     # 更改窗口皮肤
  19.     self.windowskin = RPG::Cache.windowskin('物品皮肤/物品')
  20.   end
  21.   #--------------------------------------------------------------------------
  22.   # ● 设置文本
  23.   #     text  : 窗口显示的字符串
  24.   #     align : 对齐方式 (0..左对齐、1..中间对齐、2..右对齐)
  25.   #--------------------------------------------------------------------------
  26.   def set_text(data)
  27.     @data=data
  28.     case @data
  29.     when RPG::Item           # 物品
  30.       set_item_text(@data)
  31.     when RPG::Weapon         # 武器
  32.       set_weapon_text(@data)
  33.     when RPG::Armor          # 防具
  34.       set_armor_text(@data)
  35.     end
  36.   end
  37.   #--------------------------------------------------------------------------
  38.   # ● 物品帮助窗口
  39.   #--------------------------------------------------------------------------
  40.   def set_item_text(item)
  41.     @item=item
  42.     description=@item.description
  43.     x=0
  44.     y=0
  45.     height=0.5+2.5     #依要显示的内容确定高
  46.     #由描叙确定高
  47.     height+=description.size/3/10
  48.     if description.size%10!=0
  49.       height+=1
  50.     end
  51.     height+=3  #空行,效果范围,价格
  52.     if @item.recover_hp_rate!=0 #HP 回复率。
  53.       height+=1
  54.     end   
  55.     if @item.recover_hp!=0 #HP 回复量。
  56.       height+=1
  57.     end
  58.     if @item.recover_sp_rate!=0 #SP 回复率。
  59.       height+=1
  60.     end
  61.     if @item.recover_sp!=0 #SP 回复量。
  62.       height+=1
  63.     end
  64.     if @item.parameter_type!=0 #增加能力值
  65.       height+=1
  66.     end      
  67.     if @item.element_set.empty?!=true  #属性。为属性 ID 的数组
  68.       height+=1
  69.     end  
  70.     if @item.plus_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  71.       height+=@item.plus_state_set.size  
  72.     end
  73.     if @item.minus_state_set.empty?!=true  #解除状态。为状态 ID 的数组
  74.       height+=@item.minus_state_set.size   
  75.     end     
  76.     self.height=height*15+40+15   
  77.     self.contents = Bitmap.new(self.width - 32,self.height - 32)
  78.     self.contents.clear
  79.     #描绘名字
  80.     text=@item.name
  81.     self.contents.font.color.set(255, 255, 128) # 颜色 黄色
  82.     self.contents.font.size=22
  83.     if text!=nil
  84.       self.visible = true
  85.       self.contents.draw_text(0,0, @item.name.size*70, 22, text, 0)
  86.     else
  87.       self.visible = false
  88.     end
  89.     x=0
  90.     y+=1
  91.     text=description
  92.     #描绘描叙
  93.     while ((text = description.slice!(/./m)) != nil)
  94.       self.contents.font.color = normal_color
  95.       self.contents.font.size=18
  96.       self.contents.draw_text(x*15, y*15+13, 160, 18, text, 0)
  97.       x+=1
  98.       if x==12#每行10个字
  99.         x=0
  100.         y+=1.2   
  101.       end
  102.     end
  103.     #由特技属性确定高
  104.     #效果范围
  105.     scope = {0=>"特殊物品",1=>"敌单体",2=>"敌全体",3=>"己方单体",4=>"己方全体",5=>"己方昏死单体",6=>"己方昏死全体",7=>"使用者"}#HASH表
  106.     text="范围:"+scope[@item.scope]
  107.     x=0
  108.     y+=2  #空一行
  109.     self.contents.font.color = normal_color
  110.     self.contents.font.size=14
  111.     self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  112.     #============================================================
  113.     # 显示物品图片
  114.     bitmap = RPG::Cache.icon('物品大图/' + item.icon_name+"_W")
  115.     self.contents.blt(190, 0, bitmap, Rect.new(0, 0, 120, 120))#物品
  116.     #============================================================
  117.     #价格
  118. #      x=0
  119. #      y+=1      
  120. #      text="价格:"[email protected]_s
  121. #      self.contents.font.color = normal_color
  122. #      self.contents.font.size=14   
  123. #      self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
  124.  
  125.     #HP 回复率   
  126.     if @item.recover_hp_rate!=0
  127.       x=0
  128.       y+=1      
  129.       text="回复HP:"+@item.recover_hp_rate.to_s+"%"
  130.       self.contents.font.color = normal_color
  131.       self.contents.font.size=14   
  132.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)      
  133.     end
  134.     #HP回复量
  135.     if @item.recover_hp!=0
  136.       x=0
  137.       y+=1      
  138.       text="回复HP:"+@item.recover_hp.to_s
  139.       self.contents.font.color = normal_color
  140.       self.contents.font.size=14   
  141.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  142.     end
  143.      #SP 回复率
  144.     if @item.recover_sp_rate!=0
  145.       x=0
  146.       y+=1      
  147.       text="回复SP:"+@item.recover_sp_rate.to_s+"%"
  148.       self.contents.font.color = normal_color
  149.       self.contents.font.size=14   
  150.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  151.     end
  152.     #SP 回复量
  153.     if @item.recover_sp!=0
  154.       x=0
  155.       y+=1      
  156.       text="回复SP:"+@item.recover_sp.to_s
  157.       self.contents.font.color = normal_color
  158.       self.contents.font.size=14   
  159.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  160.     end
  161.     #增加能力值
  162.     if @item.parameter_type!=0
  163.       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}
  164.       x=0
  165.       y+=1      
  166.       text="增益:"+parameter_type[@item.parameter_type]+" +"+@item.parameter_points.to_s
  167.       self.contents.font.color = normal_color
  168.       self.contents.font.size=14   
  169.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  170.     end      
  171.  
  172.     #物品属性   
  173.     if @item.element_set.empty?!=true  #属性。为属性 ID 的数组
  174.       element_set={1=>"火",2=>"冰",3=>"光",4=>"暗",9=>"特殊物品",11=>"宠物书籍",12=>"金柳露"}
  175.       text="属性:"
  176.       for i in 0...@item.element_set.size
  177.         text+=element_set[@item.element_set[i]]+" "
  178.       end
  179.       x=0
  180.       y+=1
  181.       self.contents.font.color = normal_color
  182.       self.contents.font.size=14
  183.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  184.     end
  185.     #附加状态
  186.     if @item.plus_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  187.       text="附加状态:"
  188.       x=0
  189.       y+=1
  190.       self.contents.font.color = normal_color
  191.       self.contents.font.size=14
  192.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  193.       y-=1
  194.       x+=text.size*5      
  195.       for i in 0...@item.plus_state_set.size
  196.         y+=1
  197.         text=$data_states[@item.plus_state_set[i]].name        
  198.         self.contents.font.color = normal_color
  199.         self.contents.font.size=14
  200.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  201.       end  
  202.     end
  203.     #解除状态
  204.     if @item.minus_state_set.empty?!=true  #解除状态。为状态 ID 的数组
  205.       text="解除状态:"
  206.       x=0
  207.       y+=1
  208.       self.contents.font.color = normal_color
  209.       self.contents.font.size=14
  210.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  211.       y-=1
  212.       x+=text.size*5      
  213.       for i in 0...@item.minus_state_set.size
  214.         y+=1
  215.         text=$data_states[@item.minus_state_set[i]].name        
  216.         self.contents.font.color = normal_color
  217.         self.contents.font.size=14
  218.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  219.       end  
  220.     end     
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # ● 武器帮助窗口
  224.   #--------------------------------------------------------------------------
  225.   def set_weapon_text(weapon)
  226.     @weapon=weapon
  227.     description=@weapon.description
  228.     x=0
  229.     y=0
  230.     height=0.5+1     #依要显示的内容确定高
  231.     #由描叙确定高
  232.     height+=description.size/3/10
  233.     if description.size%10!=0
  234.       height+=1
  235.     end
  236.     height+=3  #2个空行,攻击,价格
  237.     if @weapon.pdef!=0 #物理防御
  238.       height+=1
  239.     end      
  240.     if @weapon.mdef!=0 #魔法防御
  241.       height+=1
  242.     end
  243.     if @weapon.str_plus!=0 #力量
  244.       height+=1
  245.     end
  246.     if @weapon.dex_plus!=0#体质
  247.       height+=1
  248.     end
  249.     if @weapon.agi_plus!=0#敏捷
  250.       height+=1
  251.     end
  252.     if @weapon.int_plus!=0 #智力
  253.       height+=1
  254.     end      
  255.     if @weapon.element_set.empty?!=true  #属性。为属性 ID 的数组
  256.       height+=1
  257.     end  
  258.     if @weapon.plus_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  259.       height+=@weapon.plus_state_set.size  
  260.     end
  261.     if @weapon.minus_state_set.empty?!=true  #解除状态。为状态 ID 的数组
  262.       height+=@weapon.minus_state_set.size   
  263.     end     
  264.     self.height=height*15+40+15   
  265.     self.contents = Bitmap.new(self.width - 32,self.height - 32)
  266.     self.contents.clear
  267.     #描绘名字
  268.     text=@weapon.name
  269.     self.contents.font.color.set(255, 255, 128) # 颜色 黄色
  270.     self.contents.font.size=22
  271.     if text!=nil
  272.       self.visible = true
  273.       self.contents.draw_text(0,0, @weapon.name.size*70, 22, text, 0)
  274.     else
  275.       self.visible = false
  276.     end
  277.     x=0
  278.     y+=1.5
  279.     text=description
  280.     #描绘描叙
  281.     while ((text = description.slice!(/./m)) != nil)
  282.       self.contents.font.color = normal_color
  283.       self.contents.font.size=18
  284.       self.contents.draw_text(x*15, y*15+5, 160, 18, text, 0)
  285.       x+=1
  286.       if x==12#每行10个字
  287.         x=0
  288.         y+=1.2      
  289.       end
  290.     end
  291.     #由特技属性确定高
  292.     #攻击
  293.       x=0
  294.       y+=2 #空行     
  295.       text="攻击:"+@weapon.atk.to_s
  296.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  297.       self.contents.font.size=14   
  298.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  299.       #============================================================
  300.       # 显示武器图片
  301.       bitmap = RPG::Cache.icon('物品大图/' + weapon.icon_name+"_W")
  302.       self.contents.blt(190, 0, bitmap, Rect.new(0, 0, 120, 120))#武器
  303.       #============================================================
  304.     #价格
  305. #      x=0
  306. #      y+=1      
  307. #      text="价格:"[email protected]_s
  308. #      self.contents.font.color = normal_color
  309. #      self.contents.font.size=14   
  310. #      self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
  311.     if @weapon.pdef!=0 #物理防御
  312.       x=0
  313.       y+=1      
  314.       text="物理防御:"+@weapon.pdef.to_s
  315.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  316.       self.contents.font.size=14   
  317.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  318.     end      
  319.     if @weapon.mdef!=0 #魔法防御
  320.       x=0
  321.       y+=1      
  322.       text="魔法防御:"+@weapon.mdef.to_s
  323.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  324.       self.contents.font.size=14   
  325.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  326.     end
  327.  
  328.     #武器属性   
  329.     if @weapon.element_set.empty?!=true  #属性。为属性 ID 的数组
  330.       element_set={1=>"火",2=>"冰",3=>"光",4=>"暗",9=>"特殊物品",11=>"宠物书籍",12=>"金柳露"}
  331.       text="属性:"
  332.       for i in 0...@weapon.element_set.size
  333.         text+=element_set[@weapon.element_set[i]]+" "
  334.       end
  335.       x=0
  336.       y+=1
  337.       self.contents.font.color = normal_color
  338.       self.contents.font.size=14
  339.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  340.     end
  341.     #附加状态
  342.     if @weapon.plus_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  343.       text="附加状态:"
  344.       x=0
  345.       y+=1
  346.       self.contents.font.color = normal_color
  347.       self.contents.font.size=14
  348.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  349.       y-=1
  350.       x+=text.size*5      
  351.       for i in 0...@weapon.plus_state_set.size
  352.         y+=1
  353.         text=$data_states[@weapon.plus_state_set[i]].name        
  354.         self.contents.font.color = normal_color
  355.         self.contents.font.size=14
  356.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  357.       end  
  358.     end
  359.     #解除状态
  360.     if @weapon.minus_state_set.empty?!=true  #解除状态。为状态 ID 的数组
  361.       text="解除状态:"
  362.       x=0
  363.       y+=1
  364.       self.contents.font.color = normal_color
  365.       self.contents.font.size=14
  366.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  367.       y-=1
  368.       x+=text.size*5      
  369.       for i in 0...@weapon.minus_state_set.size
  370.         y+=1
  371.         text=$data_states[@weapon.minus_state_set[i]].name        
  372.         self.contents.font.color = normal_color
  373.         self.contents.font.size=14
  374.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  375.       end  
  376.     end
  377.     y+=1 #空行
  378.     if @weapon.str_plus!=0 #力量
  379.       x=0
  380.       y+=1      
  381.       text=$data_system.words.str+"  + "+@weapon.str_plus.to_s
  382.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  383.       self.contents.font.size=14   
  384.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  385.     end
  386.     if @weapon.dex_plus!=0#体质
  387.       x=0
  388.       y+=1      
  389.       text=$data_system.words.dex+"  + "+@weapon.dex_plus.to_s
  390.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  391.       self.contents.font.size=14   
  392.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  393.     end
  394.     if @weapon.agi_plus!=0#敏捷
  395.       x=0
  396.       y+=1      
  397.       text=$data_system.words.agi+"  + "+@weapon.agi_plus.to_s
  398.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  399.       self.contents.font.size=14   
  400.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  401.     end
  402.     if @weapon.int_plus!=0 #智力
  403.       x=0
  404.       y+=1      
  405.       text=$data_system.words.int+"  + "+@weapon.int_plus.to_s
  406.       self.contents.font.color = text_color(weapon.name_color_66RPG)#颜色脚本
  407.       self.contents.font.size=14   
  408.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  409.     end
  410.   end
  411.   #--------------------------------------------------------------------------
  412.   # ● 防具帮助窗口
  413.   #--------------------------------------------------------------------------
  414.   def set_armor_text(armor)
  415.     def set_armor_text(armor)
  416.     @armor=armor
  417.     description=@armor.description
  418.     x=0
  419.     y=0
  420.     height=1+0.5    #依要显示的内容确定高
  421.     #由描叙确定高
  422.     height+=description.size/3/10
  423.     if description.size%10!=0
  424.       height+=1
  425.     end
  426.     height+=2  #2个空行,价格
  427.     if @armor.pdef!=0 #物理防御
  428.       height+=1
  429.     end      
  430.     if @armor.mdef!=0 #魔法防御
  431.       height+=1
  432.     end
  433.     if @armor.str_plus!=0 #力量
  434.       height+=1
  435.     end
  436.     if @armor.dex_plus!=0#体质
  437.       height+=1
  438.     end
  439.     if @armor.agi_plus!=0#敏捷
  440.       height+=1
  441.     end
  442.     if @armor.int_plus!=0 #智力
  443.       height+=1
  444.     end      
  445.     if @armor.guard_element_set.empty?!=true  #属性防御。为属性 ID 的数组
  446.       height+=1
  447.     end  
  448.     if @armor.guard_state_set.empty?!=true  #状态防御。为状态 ID 的数组
  449.       height+=@armor.guard_state_set.size  
  450.     end   
  451.     self.height=height*15+40+15   
  452.     self.contents = Bitmap.new(self.width - 32,self.height - 32)
  453.     self.contents.clear
  454.     #描绘名字
  455.     text=@armor.name
  456.     self.contents.font.color.set(255, 255, 128) # 颜色 黄色
  457.     self.contents.font.size=22
  458.     if text!=nil
  459.       self.visible = true
  460.       self.contents.draw_text(0,0, @armor.name.size*70, 22, text, 0)
  461.     else
  462.       self.visible = false
  463.     end
  464.     x=0
  465.     y+=1.5
  466.     text=description
  467.     #描绘描叙
  468.     while ((text = description.slice!(/./m)) != nil)
  469.       self.contents.font.color = normal_color
  470.       self.contents.font.size=18
  471.       self.contents.draw_text(x*15, y*15+5, 160, 18, text, 0)
  472.       x+=1
  473.       if x==12#每行10个字
  474.         x=0
  475.         y+=1.2      
  476.       end
  477.     end
  478.     #由特技属性确定高
  479.     #============================================================
  480.     # 显示防具图片
  481.     bitmap = RPG::Cache.icon('物品大图/' + armor.icon_name+"_W")
  482.     self.contents.blt(190, 0, bitmap, Rect.new(0, 0, 120, 120))#防具
  483.     #============================================================
  484.     #价格
  485. #      x=0
  486.       y+=1#空行      
  487. #      text="价格:"[email protected]_s
  488. #      self.contents.font.color = normal_color
  489. #      self.contents.font.size=14   
  490. #      self.contents.draw_text(x, y*15+5, text.size*6, 14, text, 0)
  491.     if @armor.pdef!=0 #物理防御
  492.       x=0
  493.       y+=1      
  494.       text="物理防御:"+@armor.pdef.to_s
  495.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  496.       self.contents.font.size=14   
  497.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  498.     end      
  499.     if @armor.mdef!=0 #魔法防御
  500.       x=0
  501.       y+=1      
  502.       text="魔法防御:"+@armor.mdef.to_s
  503.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  504.       self.contents.font.size=14   
  505.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  506.     end
  507.  
  508.     #属性防御   
  509.     if @armor.guard_element_set.empty?!=true  #属性。为属性 ID 的数组
  510.       element_set={1=>"火",2=>"冰",3=>"光",4=>"暗",9=>"特殊物品",11=>"宠物书籍",12=>"金柳露"}
  511.       text="属性防御:"
  512.       for i in 0...@armor.guard_element_set.size
  513.         text+=element_set[@armor.guard_element_set[i]]+" "
  514.       end
  515.       x=0
  516.       y+=1
  517.       self.contents.font.color = normal_color
  518.       self.contents.font.size=14
  519.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  520.     end
  521.     #状态防御
  522.     if @armor.guard_state_set.empty?!=true  #附加状态。为状态 ID 的数组
  523.       text="状态防御:"
  524.       x=0
  525.       y+=1
  526.       self.contents.font.color = normal_color
  527.       self.contents.font.size=14
  528.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  529.       y-=1
  530.       x+=text.size*5      
  531.       for i in 0...@armor.guard_state_set.size
  532.         y+=1
  533.         text=$data_states[@armor.guard_state_set[i]].name        
  534.         self.contents.font.color = normal_color
  535.         self.contents.font.size=14
  536.         self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)        
  537.       end  
  538.     end
  539.  
  540.     y+=1 #空行
  541.     if @armor.str_plus!=0 #力量
  542.       x=0
  543.       y+=1      
  544.       text=$data_system.words.str+"  + "+@armor.str_plus.to_s
  545.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  546.       self.contents.font.size=14   
  547.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  548.     end
  549.     if @armor.dex_plus!=0#体质
  550.       x=0
  551.       y+=1      
  552.       text=$data_system.words.dex+"  + "+@armor.dex_plus.to_s
  553.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  554.       self.contents.font.size=14   
  555.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  556.     end
  557.     if @armor.agi_plus!=0#敏捷
  558.       x=0
  559.       y+=1      
  560.       text=$data_system.words.agi+"  + "+@armor.agi_plus.to_s
  561.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  562.       self.contents.font.size=14   
  563.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  564.     end
  565.     if @armor.int_plus!=0 #智力
  566.       x=0
  567.       y+=1      
  568.       text=$data_system.words.int+"  + "+@armor.int_plus.to_s
  569.       self.contents.font.color = text_color(armor.name_color_66RPG)#颜色脚本
  570.       self.contents.font.size=14   
  571.       self.contents.draw_text(x, y*15+5, text.size*60, 16, text, 0)
  572.     end
  573.   end
  574.   end
  575.   #--------------------------------------------------------------------------
  576.   # ● 设置角色
  577.   #     actor : 要显示状态的角色
  578.   #--------------------------------------------------------------------------
  579.   def set_actor(actor)
  580.     if actor != @actor
  581.       self.contents.clear
  582.       draw_actor_name(actor, 4, 0)
  583.       draw_actor_state(actor, 140, 0)
  584.       draw_actor_hp(actor, 284, 0)
  585.       draw_actor_sp(actor, 460, 0)
  586.       @actor = actor
  587.       @text = nil
  588.       self.visible = true
  589.     end
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   # ● 设置敌人
  593.   #     enemy : 要显示名字和状态的敌人
  594.   #--------------------------------------------------------------------------
  595.   def set_enemy(enemy)
  596.     text = enemy.name
  597.     state_text = make_battler_state_text(enemy, 112, false)
  598.     if state_text != ""
  599.       text += "  " + state_text
  600.     end
  601.     set_text(text, 1)
  602.   end
  603.   #--------------------------------------------------------------------------
  604.   # ● 校正帮助窗口位置
  605.   #--------------------------------------------------------------------------
  606.   def set_pos(x,y,width,oy,index,column_max)
  607.     #光标坐标
  608.     xx = index % column_max * 59.5 - ox
  609.     yy = index / column_max * 60 - oy
  610.     self.x=xx+x+74
  611.     self.y=yy+y+74
  612.     if self.x+self.width>1024
  613.       self.x=1024-self.width
  614.     end
  615.     if self.y+self.height>420
  616.       self.y=420-self.height
  617.     end  
  618.   end
  619. end

Lv5.捕梦者

梦石
24
星屑
7007
在线时间
247 小时
注册时间
2020-12-4
帖子
306

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

2
发表于 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 认可答案

查看全部评分

回复 支持 反对

使用道具 举报

Lv3.寻梦者

梦石
0
星屑
3171
在线时间
1863 小时
注册时间
2010-6-19
帖子
1205
3
 楼主| 发表于 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

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

点评

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

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-4-20 06:40

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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