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

Project1

 找回密码
 注册会员
搜索
查看: 50|回复: 2

[已经解决] 如何使拓展后实现装备固定?

[复制链接]

Lv1.梦旅人

梦石
0
星屑
104
在线时间
14 小时
注册时间
2018-12-22
帖子
4
发表于 2019-1-1 02:56:36 | 显示全部楼层 |阅读模式

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

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

x
也就是防具5和防具6
$data_actors[1].armor5_fix=true
$data_actors[1].armor6_fix=true
用这行脚本改,会报错,不知道怎么改
以下为脚本
  1. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  2. #
  3. #                                防具类追加
  4. #
  5. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  6. module RPG
  7.   class Armor
  8.     def name
  9.       name = @name.split(/,/)[0]
  10.       return name != nil ? name : ''
  11.     end
  12.     def kind
  13.       kind  = @name.split(/,/)[1]
  14.       return kind  != nil ? kind.to_i : @kind
  15.     end
  16.   end
  17. end
  18. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  19. #
  20. #                  Game_Actor添加新的防具ID,并对相关方法修正
  21. #
  22. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  23. class Game_Actor < Game_Battler
  24.   attr_reader   :armor5_id                # 佩戴 ID
  25.   attr_reader   :armor6_id                # 道具 ID
  26.   #--------------------------------------------------------------------------
  27.   # ● 设置
  28.   #     actor_id : 角色 ID
  29.   #--------------------------------------------------------------------------
  30.   alias old_setup setup
  31.   def setup(actor_id)
  32.     old_setup(actor_id)
  33.     @armor5_id = 0
  34.     @armor6_id = 0
  35.     update_auto_state(nil, $data_armors[@armor5_id])
  36.     update_auto_state(nil, $data_armors[@armor6_id])
  37.   end
  38.   #--------------------------------------------------------------------------
  39.   # ● 取得属性修正值
  40.   #     element_id : 属性 ID
  41.   #--------------------------------------------------------------------------
  42.   def element_rate(element_id)
  43.     # 获取对应属性有效度的数值
  44.     table = [0,200,150,100,50,0,-100]
  45.     result = table[$data_classes[@class_id].element_ranks[element_id]]
  46.     # 防具能防御本属性的情况下效果减半
  47.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  48.       armor = $data_armors[i]
  49.       if armor != nil and armor.guard_element_set.include?(element_id)
  50.         result /= 2
  51.       end
  52.     end
  53.     # 状态能防御本属性的情况下效果减半
  54.     for i in @states
  55.       if $data_states[i].guard_element_set.include?(element_id)
  56.         result /= 2
  57.       end
  58.     end
  59.     # 过程结束
  60.     return result
  61.   end
  62.   #--------------------------------------------------------------------------
  63.   # ● 判定防御属性
  64.   #     state_id : 属性 ID
  65.   #--------------------------------------------------------------------------
  66.   def state_guard?(state_id)
  67.     for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id]
  68.       armor = $data_armors[i]
  69.       if armor != nil
  70.         if armor.guard_state_set.include?(state_id)
  71.           return true
  72.         end
  73.       end
  74.     end
  75.     return false
  76.   end
  77.   #--------------------------------------------------------------------------
  78.   # ● 装备固定判定
  79.   #     equip_type : 装备类型
  80.   #--------------------------------------------------------------------------
  81.   def equip_fix?(equip_type)
  82.     case equip_type
  83.     when 0  # 武器
  84.       return $data_actors[@actor_id].weapon_fix
  85.     when 1  # 盾
  86.       return $data_actors[@actor_id].armor1_fix
  87.     when 2  # 头
  88.       return $data_actors[@actor_id].armor2_fix
  89.     when 3  # 身体
  90.       return $data_actors[@actor_id].armor3_fix
  91.     when 4  # 道具
  92.       return $data_actors[@actor_id].armor4_fix
  93.     end
  94.     return false
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 变更装备
  98.   #     equip_type : 装备类型
  99.   #     id    : 武器 or 防具 ID  (0 为解除装备)
  100.   #--------------------------------------------------------------------------
  101.   def equip(equip_type, id)
  102.     case equip_type
  103.     when 0  # 武器
  104.       if id == 0 or $game_party.weapon_number(id) > 0
  105.         $game_party.gain_weapon(@weapon_id, 1)
  106.         @weapon_id = id
  107.         $game_party.lose_weapon(id, 1)
  108.       end
  109.     when 1  # 盾
  110.       if id == 0 or $game_party.armor_number(id) > 0
  111.         update_auto_state($data_armors[@armor1_id], $data_armors[id])
  112.         $game_party.gain_armor(@armor1_id, 1)
  113.         @armor1_id = id
  114.         $game_party.lose_armor(id, 1)
  115.       end
  116.     when 2  # 头
  117.       if id == 0 or $game_party.armor_number(id) > 0
  118.         update_auto_state($data_armors[@armor2_id], $data_armors[id])
  119.         $game_party.gain_armor(@armor2_id, 1)
  120.         @armor2_id = id
  121.         $game_party.lose_armor(id, 1)
  122.       end
  123.     when 3  # 身体
  124.       if id == 0 or $game_party.armor_number(id) > 0
  125.         update_auto_state($data_armors[@armor3_id], $data_armors[id])
  126.         $game_party.gain_armor(@armor3_id, 1)
  127.         @armor3_id = id
  128.         $game_party.lose_armor(id, 1)
  129.       end
  130.     when 4  # 道具
  131.       if id == 0 or $game_party.armor_number(id) > 0
  132.         update_auto_state($data_armors[@armor4_id], $data_armors[id])
  133.         $game_party.gain_armor(@armor4_id, 1)
  134.         @armor4_id = id
  135.         $game_party.lose_armor(id, 1)
  136.       end
  137.     when 5  # 装饰品
  138.       if id == 0 or $game_party.armor_number(id) > 0
  139.         update_auto_state($data_armors[@armor5_id], $data_armors[id])
  140.         $game_party.gain_armor(@armor5_id, 1)
  141.         @armor5_id = id
  142.         $game_party.lose_armor(id, 1)
  143.       end
  144.     when 6  # 道具
  145.       if id == 0 or $game_party.armor_number(id) > 0
  146.         update_auto_state($data_armors[@armor6_id], $data_armors[id])
  147.         $game_party.gain_armor(@armor6_id, 1)
  148.         @armor6_id = id
  149.         $game_party.lose_armor(id, 1)
  150.       end
  151.     end
  152.   end
  153.   #--------------------------------------------------------------------------
  154.   # ● 更改职业 ID
  155.   #     class_id : 新的职业 ID
  156.   #--------------------------------------------------------------------------
  157.   def class_id=(class_id)
  158.     if $data_classes[class_id] != nil
  159.       @class_id = class_id
  160.       # 避开无法装备的物品
  161.       unless equippable?($data_weapons[@weapon_id])
  162.         equip(0, 0)
  163.       end
  164.       unless equippable?($data_armors[@armor1_id])
  165.         equip(1, 0)
  166.       end
  167.       unless equippable?($data_armors[@armor2_id])
  168.         equip(2, 0)
  169.       end
  170.       unless equippable?($data_armors[@armor3_id])
  171.         equip(3, 0)
  172.       end
  173.       unless equippable?($data_armors[@armor4_id])
  174.         equip(4, 0)
  175.       end
  176.       unless equippable?($data_armors[@armor5_id])
  177.         equip(5, 0)
  178.       end
  179.       unless equippable?($data_armors[@armor6_id])
  180.         equip(6, 0)
  181.       end
  182.     end
  183.   end
  184. end
  185. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  186. #
  187. #              Window_Base美化,增加属性增减颜色,及全能力值描绘
  188. #
  189. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  190. #==============================================================================
  191. # ■ Window_Base
  192. #------------------------------------------------------------------------------
  193. #  游戏中全部窗口的超级类。
  194. #==============================================================================

  195. class Window_Base < Window
  196.   ################## 属性增减颜色 ##############################
  197.   def up_color
  198.     return Color.new(255, 0, 0)
  199.   end
  200.   def down_color
  201.     return Color.new(0, 255, 0)
  202.   end
  203.   #--------------------------------------------------------------------------
  204.   # ● 描绘能力值
  205.   #     actor : 角色
  206.   #     x     : 描画目标 X 坐标
  207.   #     y     : 描画目标 Y 坐标
  208.   #     type  : 能力值种类 (0~6)
  209.   #--------------------------------------------------------------------------
  210.   def draw_actor_parameter(actor, x, y, type)
  211.     case type
  212.     when 0
  213.       parameter_name = $data_system.words.atk
  214.       parameter_value = actor.atk
  215.     when 1
  216.       parameter_name = $data_system.words.pdef
  217.       parameter_value = actor.pdef
  218.     when 2
  219.       parameter_name = $data_system.words.mdef
  220.       parameter_value = actor.mdef
  221.     when 3
  222.       parameter_name = $data_system.words.str
  223.       parameter_value = actor.str
  224.     when 4
  225.       parameter_name = $data_system.words.dex
  226.       parameter_value = actor.dex
  227.     when 5
  228.       parameter_name = $data_system.words.agi
  229.       parameter_value = actor.agi
  230.     when 6
  231.       parameter_name = $data_system.words.int
  232.       parameter_value = actor.int
  233.     when 7
  234.       parameter_name = "回避"
  235.       parameter_value = actor.eva
  236.     end
  237.     self.contents.font.color = system_color
  238.     self.contents.draw_text(x, y, 120, 32, parameter_name)
  239.     self.contents.font.color = normal_color
  240.     self.contents.draw_text(x + 120, y, 36, 32, parameter_value.to_s, 2)
  241.   end
  242. end
  243. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  244. #
  245. #              装备窗口美化,全能力值描绘并追加新的防具装备栏
  246. #
  247. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  248. #==============================================================================
  249. # ■ Window_EquipRight
  250. #------------------------------------------------------------------------------
  251. #  装备画面、显示角色现在装备的物品的窗口。
  252. #==============================================================================

  253. class Window_EquipRight < Window_Selectable
  254.   #--------------------------------------------------------------------------
  255.   # ● 初始化对像
  256.   #     actor : 角色
  257.   #--------------------------------------------------------------------------
  258.   def initialize(actor)
  259.     super(272, 64, 368, 256)
  260.     self.contents = Bitmap.new(width - 32, height - 32)
  261.     @actor = actor
  262.     refresh
  263.     self.index = 0
  264.   end
  265.   #--------------------------------------------------------------------------
  266.   # ● 刷新
  267.   #--------------------------------------------------------------------------
  268.   def refresh
  269.     self.contents.clear
  270.     @data = []
  271.     @data.push($data_weapons[@actor.weapon_id])
  272.     @data.push($data_armors[@actor.armor1_id])
  273.     @data.push($data_armors[@actor.armor2_id])
  274.     @data.push($data_armors[@actor.armor3_id])
  275.     @data.push($data_armors[@actor.armor4_id])
  276.     @data.push($data_armors[@actor.armor5_id])
  277.     @data.push($data_armors[@actor.armor6_id])
  278.     @item_max = @data.size
  279.     self.contents.font.color = system_color
  280.     self.contents.draw_text(4, 32 * 0, 92, 32, $data_system.words.weapon)
  281.     self.contents.draw_text(4, 32 * 1, 92, 32, $data_system.words.armor1)
  282.     self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2)
  283.     self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3)
  284.     self.contents.draw_text(4, 32 * 4, 92, 32, $data_system.words.armor4)
  285.     self.contents.draw_text(4, 32 * 5, 92, 32, "属性")
  286.     self.contents.draw_text(4, 32 * 6, 92, 32, "种族")
  287.     draw_item_name(@data[0], 92, 32 * 0)
  288.     draw_item_name(@data[1], 92, 32 * 1)
  289.     draw_item_name(@data[2], 92, 32 * 2)
  290.     draw_item_name(@data[3], 92, 32 * 3)
  291.     draw_item_name(@data[4], 92, 32 * 4)
  292.     draw_item_name(@data[5], 92, 32 * 5)
  293.     draw_item_name(@data[6], 92, 32 * 6)
  294.   end
  295. end

  296. #==============================================================================
  297. # ■ Window_EquipLeft
  298. #------------------------------------------------------------------------------
  299. #  装备画面的、显示角色能力值变化的窗口。
  300. #==============================================================================

  301. class Window_EquipLeft < Window_Base
  302.   #--------------------------------------------------------------------------
  303.   # ● 初始化对像
  304.   #     actor : 角色
  305.   #--------------------------------------------------------------------------
  306.   def initialize(actor)
  307.     super(0, 64, 272, 416)
  308.     self.contents = Bitmap.new(width - 32, height - 32)
  309.     @actor = actor
  310.     refresh
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● 刷新
  314.   #--------------------------------------------------------------------------
  315.   def refresh
  316.     self.contents.clear
  317.     draw_actor_name(@actor, 4, 0)
  318.     draw_actor_level(@actor, 4, 32)

  319.     draw_actor_parameter(@actor, 4, 64, 0)
  320.     draw_actor_parameter(@actor, 4, 96, 1)
  321.     draw_actor_parameter(@actor, 4, 128, 2)
  322.     draw_actor_parameter(@actor, 4, 160, 7)
  323.     draw_actor_parameter(@actor, 4, 192, 3)
  324.     draw_actor_parameter(@actor, 4, 224, 4)
  325.     draw_actor_parameter(@actor, 4, 256, 5)
  326.     draw_actor_parameter(@actor, 4, 288, 6)
  327.     if @new_atk != nil
  328.       self.contents.font.color = system_color
  329.       self.contents.draw_text(160, 64, 40, 32, "→", 1)
  330.       self.contents.font.color = @new_atk>@actor.atk ? up_color : down_color
  331.       self.contents.font.color = normal_color if @new_atk == @actor.atk
  332.       self.contents.draw_text(200, 64, 36, 32, @new_atk.to_s, 2)
  333.     end
  334.     if @new_pdef != nil
  335.       self.contents.font.color = system_color
  336.       self.contents.draw_text(160, 96, 40, 32, "→", 1)
  337.       self.contents.font.color = @new_pdef>@actor.pdef ? up_color : down_color
  338.       self.contents.font.color = normal_color if @new_pdef == @actor.pdef
  339.       self.contents.draw_text(200, 96, 36, 32, @new_pdef.to_s, 2)
  340.     end
  341.     if @new_mdef != nil
  342.       self.contents.font.color = system_color
  343.       self.contents.draw_text(160, 128, 40, 32, "→", 1)
  344.       self.contents.font.color = @new_mdef>@actor.mdef ? up_color : down_color
  345.       self.contents.font.color = normal_color if @new_mdef == @actor.mdef
  346.       self.contents.draw_text(200, 128, 36, 32, @new_mdef.to_s, 2)
  347.     end
  348.     if @new_eva != nil
  349.       self.contents.font.color = system_color
  350.       self.contents.draw_text(160, 160, 40, 32, "→", 1)
  351.       self.contents.font.color = @new_eva>@actor.eva ? up_color : down_color
  352.       self.contents.font.color = normal_color if @new_eva == @actor.eva
  353.       self.contents.draw_text(200, 160, 36, 32, @new_eva.to_s, 2)
  354.     end
  355.     if @new_str != nil
  356.       self.contents.font.color = system_color
  357.       self.contents.draw_text(160, 192, 40, 32, "→", 1)
  358.       self.contents.font.color = @new_str>@actor.str ? up_color : down_color
  359.       self.contents.font.color = normal_color if @new_str == @actor.str
  360.       self.contents.draw_text(200, 192, 36, 32, @new_str.to_s, 2)
  361.     end
  362.     if @new_dex != nil
  363.       self.contents.font.color = system_color
  364.       self.contents.draw_text(160, 224, 40, 32, "→", 1)
  365.       self.contents.font.color = @new_dex>@actor.dex ? up_color : down_color
  366.       self.contents.font.color = normal_color if @new_dex == @actor.dex
  367.       self.contents.draw_text(200, 224, 36, 32, @new_dex.to_s, 2)
  368.     end
  369.     if @new_agi != nil
  370.       self.contents.font.color = system_color
  371.       self.contents.draw_text(160, 256, 40, 32, "→", 1)
  372.       self.contents.font.color = @new_agi>@actor.agi ? up_color : down_color
  373.       self.contents.font.color = normal_color if @new_agi == @actor.agi
  374.       self.contents.draw_text(200, 256, 36, 32, @new_agi.to_s, 2)
  375.     end
  376.     if @new_int != nil
  377.       self.contents.font.color = system_color
  378.       self.contents.draw_text(160, 288, 40, 32, "→", 1)
  379.       self.contents.font.color = @new_int>@actor.int ? up_color : down_color
  380.       self.contents.font.color = normal_color if @new_int == @actor.int
  381.       self.contents.draw_text(200, 288, 36, 32, @new_int.to_s, 2)
  382.     end
  383.   end
  384.   #--------------------------------------------------------------------------
  385.   # ● 变更装备后的能力值设置
  386.   #     new_atk  : 变更装备后的攻击力
  387.   #     new_pdef : 变更装备后的物理防御
  388.   #     new_mdef : 变更装备后的魔法防御
  389.   #--------------------------------------------------------------------------
  390.   def set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  391.     if @new_atk != new_atk or @new_pdef !=new_pdef or @new_mdef != new_mdef or @new_eva != new_eva or @new_str != new_str or @new_dex !=new_dex or @new_agi != new_agi or @new_int != new_int
  392.       @new_atk = new_atk
  393.       @new_pdef = new_pdef
  394.       @new_mdef = new_mdef
  395.       @new_eva = new_eva
  396.       @new_str = new_str
  397.       @new_dex = new_dex
  398.       @new_agi = new_agi
  399.       @new_int = new_int
  400.       refresh
  401.     end
  402.   end
  403. end
  404. #==============================================================================
  405. # ■ Window_EquipItem
  406. #------------------------------------------------------------------------------
  407. #  装备画面、显示浏览变更装备的候补物品的窗口。
  408. #==============================================================================

  409. class Window_EquipItem < Window_Selectable
  410.   #--------------------------------------------------------------------------
  411.   # ● 初始化对像
  412.   #     actor      : 角色
  413.   #     equip_type : 装备部位 (0~3)
  414.   #--------------------------------------------------------------------------
  415.   def initialize(actor, equip_type)
  416.     super(272, 320, 368, 160)
  417.     @actor = actor
  418.     @equip_type = equip_type
  419.     @column_max = 1
  420.     refresh
  421.     self.active = false
  422.     self.index = -1
  423.   end
  424.   #--------------------------------------------------------------------------
  425.   # ● 项目的描绘
  426.   #     index : 项目符号
  427.   #--------------------------------------------------------------------------
  428.   def draw_item(index)
  429.     item = @data[index]
  430.     x = 4
  431.     y = index * 32
  432.     case item
  433.     when RPG::Weapon
  434.       number = $game_party.weapon_number(item.id)
  435.     when RPG::Armor
  436.       number = $game_party.armor_number(item.id)
  437.     end
  438.     bitmap = RPG::Cache.icon(item.icon_name)
  439.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  440.     self.contents.font.color = normal_color
  441.     self.contents.draw_text(x + 28, y, 212, 32, item.name, 0)
  442.     self.contents.draw_text(x + 240, y, 16, 32, ":", 1)
  443.     self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2)
  444.   end
  445. end

  446. class Scene_Equip
  447.   #--------------------------------------------------------------------------
  448.   # ● 主处理
  449.   #--------------------------------------------------------------------------
  450.   def main
  451.     # 获取角色
  452.     @actor = $game_party.actors[@actor_index]
  453.     # 生成窗口
  454.     @help_window = Window_Help.new
  455.     @left_window = Window_EquipLeft.new(@actor)
  456.     @right_window = Window_EquipRight.new(@actor)
  457.     @item_window1 = Window_EquipItem.new(@actor, 0)
  458.     @item_window2 = Window_EquipItem.new(@actor, 1)
  459.     @item_window3 = Window_EquipItem.new(@actor, 2)
  460.     @item_window4 = Window_EquipItem.new(@actor, 3)
  461.     @item_window5 = Window_EquipItem.new(@actor, 4)
  462.     @item_window6 = Window_EquipItem.new(@actor, 5)
  463.     @item_window7 = Window_EquipItem.new(@actor, 6)
  464.     # 关联帮助窗口
  465.     @right_window.help_window = @help_window
  466.     @item_window1.help_window = @help_window
  467.     @item_window2.help_window = @help_window
  468.     @item_window3.help_window = @help_window
  469.     @item_window4.help_window = @help_window
  470.     @item_window5.help_window = @help_window
  471.     @item_window6.help_window = @help_window
  472.     @item_window7.help_window = @help_window
  473.     # 设置光标位置
  474.     @right_window.index = @equip_index
  475.     refresh
  476.     # 执行过渡
  477.     Graphics.transition
  478.     # 主循环
  479.     loop do
  480.       # 刷新游戏画面
  481.       Graphics.update
  482.       # 刷新输入信息
  483.       Input.update
  484.       # 刷新画面
  485.       update
  486.       # 如果画面切换的话的就中断循环
  487.       if $scene != self
  488.         break
  489.       end
  490.     end
  491.     # 准备过渡
  492.     Graphics.freeze
  493.     # 释放窗口
  494.     @help_window.dispose
  495.     @left_window.dispose
  496.     @right_window.dispose
  497.     @item_window1.dispose
  498.     @item_window2.dispose
  499.     @item_window3.dispose
  500.     @item_window4.dispose
  501.     @item_window5.dispose
  502.     @item_window6.dispose
  503.     @item_window7.dispose
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● 刷新
  507.   #--------------------------------------------------------------------------
  508.   def refresh
  509.     # 设置物品窗口的可视状态
  510.     @item_window1.visible = (@right_window.index == 0)
  511.     @item_window2.visible = (@right_window.index == 1)
  512.     @item_window3.visible = (@right_window.index == 2)
  513.     @item_window4.visible = (@right_window.index == 3)
  514.     @item_window5.visible = (@right_window.index == 4)
  515.     @item_window6.visible = (@right_window.index == 5)
  516.     @item_window7.visible = (@right_window.index == 6)
  517.     # 获取当前装备中的物品
  518.     item1 = @right_window.item
  519.     # 设置当前的物品窗口到 @item_window
  520.     case @right_window.index
  521.     when 0
  522.       @item_window = @item_window1
  523.     when 1
  524.       @item_window = @item_window2
  525.     when 2
  526.       @item_window = @item_window3
  527.     when 3
  528.       @item_window = @item_window4
  529.     when 4
  530.       @item_window = @item_window5
  531.     when 5
  532.       @item_window = @item_window6
  533.     when 6
  534.       @item_window = @item_window7
  535.     end
  536.     # 右窗口被激活的情况下
  537.     if @right_window.active
  538.       # 删除变更装备后的能力
  539.     ###############################################################
  540.       @left_window.set_new_parameters(nil, nil, nil, nil, nil, nil, nil, nil)
  541.     end
  542.     # 物品窗口被激活的情况下
  543.     if @item_window.active
  544.       # 获取现在选中的物品
  545.       item2 = @item_window.item
  546.       # 变更装备
  547.       last_hp = @actor.hp
  548.       last_sp = @actor.sp
  549.       @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id)
  550.     ###############################################################
  551.       # 获取变更装备后的能力值
  552.       new_atk = @actor.atk
  553.       new_pdef = @actor.pdef
  554.       new_mdef = @actor.mdef
  555.       new_eva = @actor.eva
  556.       new_str = @actor.str
  557.       new_dex = @actor.dex
  558.       new_agi = @actor.agi
  559.       new_int = @actor.int
  560.       # 返回到装备
  561.       @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id)
  562.       @actor.hp = last_hp
  563.       @actor.sp = last_sp
  564.       # 描画左窗口
  565.     ###############################################################
  566.       @left_window.set_new_parameters(new_atk, new_pdef, new_mdef, new_eva, new_str, new_dex, new_agi, new_int)
  567.     ###############################################################
  568.     end
  569.   end
  570. end
  571. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  572. #
  573. #              状态窗口美化,全防具装备栏描绘
  574. #
  575. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  576. #==============================================================================
  577. # ■ Window_Status
  578. #------------------------------------------------------------------------------
  579. #  显示状态画面、完全规格的状态窗口。
  580. #==============================================================================

  581. class Window_Status < Window_Base
  582.   #--------------------------------------------------------------------------
  583.   # ● 刷新
  584.   #--------------------------------------------------------------------------
  585.   def refresh
  586.     self.contents.clear
  587.     draw_actor_graphic(@actor, 40, 112)
  588.     draw_actor_name(@actor, 4, 0)
  589.     draw_actor_class(@actor, 4 + 144, 0)
  590.     draw_actor_level(@actor, 96, 32)
  591.     draw_actor_state(@actor, 96, 64)
  592.     draw_actor_hp(@actor, 96, 112, 172)
  593.     draw_actor_sp(@actor, 96, 144, 172)
  594.     draw_actor_parameter(@actor, 96, 192, 0)
  595.     draw_actor_parameter(@actor, 96, 224, 1)
  596.     draw_actor_parameter(@actor, 96, 256, 2)
  597.     draw_actor_parameter(@actor, 96, 304, 3)
  598.     draw_actor_parameter(@actor, 96, 336, 4)
  599.     draw_actor_parameter(@actor, 96, 368, 5)
  600.     draw_actor_parameter(@actor, 96, 400, 6)
  601.     self.contents.font.color = system_color
  602.     self.contents.draw_text(320, 48, 80, 32, "EXP")
  603.     self.contents.draw_text(320, 80, 80, 32, "NEXT")
  604.     self.contents.font.color = normal_color
  605.     self.contents.draw_text(320 + 80, 48, 84, 32, @actor.exp_s, 2)
  606.     self.contents.draw_text(320 + 80, 80, 84, 32, @actor.next_rest_exp_s, 2)
  607.     self.contents.font.color = system_color
  608.     self.contents.draw_text(320, 160, 96, 32, "装备")
  609.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 16, 208)
  610.     draw_item_name($data_armors[@actor.armor1_id], 320 + 16, 240)
  611.     draw_item_name($data_armors[@actor.armor2_id], 320 + 16, 272)
  612.     draw_item_name($data_armors[@actor.armor3_id], 320 + 16, 304)
  613.     draw_item_name($data_armors[@actor.armor4_id], 320 + 16, 336)
  614.     draw_item_name($data_armors[@actor.armor5_id], 320 + 16, 368)
  615.     draw_item_name($data_armors[@actor.armor6_id], 320 + 16, 400)
  616.   end
  617.   def dummy
  618.     self.contents.font.color = system_color
  619.     self.contents.draw_text(320, 112, 96, 32, $data_system.words.weapon)
  620.     self.contents.draw_text(320, 176, 96, 32, $data_system.words.armor1)
  621.     self.contents.draw_text(320, 240, 96, 32, $data_system.words.armor2)
  622.     self.contents.draw_text(320, 304, 96, 32, $data_system.words.armor3)
  623.     self.contents.draw_text(320, 368, 96, 32, $data_system.words.armor4)
  624.     draw_item_name($data_weapons[@actor.weapon_id], 320 + 24, 144)
  625.     draw_item_name($data_armors[@actor.armor1_id], 320 + 24, 208)
  626.     draw_item_name($data_armors[@actor.armor2_id], 320 + 24, 272)
  627.     draw_item_name($data_armors[@actor.armor3_id], 320 + 24, 336)
  628.     draw_item_name($data_armors[@actor.armor4_id], 320 + 24, 400)
  629.   end
  630. end
  631. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  632. #
  633. #              商店购买窗口美化,增加对新装备位置的描述
  634. #
  635. # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
  636. #==============================================================================
  637. # ■ Window_ShopStatus
  638. #------------------------------------------------------------------------------
  639. #  商店画面、显示物品所持数与角色装备的窗口。
  640. #==============================================================================

  641. class Window_ShopStatus < Window_Base
  642.   #--------------------------------------------------------------------------
  643.   # ● 刷新
  644.   #--------------------------------------------------------------------------
  645.   def refresh
  646.     self.contents.clear
  647.     if @item == nil
  648.       return
  649.     end
  650.     case @item
  651.     when RPG::Item
  652.       number = $game_party.item_number(@item.id)
  653.     when RPG::Weapon
  654.       number = $game_party.weapon_number(@item.id)
  655.     when RPG::Armor
  656.       number = $game_party.armor_number(@item.id)
  657.     end
  658.     self.contents.font.color = system_color
  659.     self.contents.draw_text(4, 0, 200, 32, "所持数")
  660.     self.contents.font.color = normal_color
  661.     self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
  662.     if @item.is_a?(RPG::Item)
  663.       return
  664.     end
  665.     # 添加装备品信息
  666.     for i in 0...$game_party.actors.size
  667.       # 获取角色
  668.       actor = $game_party.actors[i]
  669.       # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
  670.       if actor.equippable?(@item)
  671.         self.contents.font.color = normal_color
  672.       else
  673.         self.contents.font.color = disabled_color
  674.       end
  675.       # 描绘角色名字
  676.       self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
  677.       # 获取当前的装备品
  678.       if @item.is_a?(RPG::Weapon)
  679.         item1 = $data_weapons[actor.weapon_id]
  680.       elsif @item.kind == 0
  681.         item1 = $data_armors[actor.armor1_id]
  682.       elsif @item.kind == 1
  683.         item1 = $data_armors[actor.armor2_id]
  684.       elsif @item.kind == 2
  685.         item1 = $data_armors[actor.armor3_id]
  686.       elsif @item.kind == 3
  687.         item1 = $data_armors[actor.armor4_id]
  688.       elsif @item.kind == 4
  689.         item1 = $data_armors[actor.armor5_id]
  690.       else# if @item.kind == 5
  691.         item1 = $data_armors[actor.armor6_id]
  692.       end
  693.       # 可以装备的情况
  694.       if actor.equippable?(@item)
  695.         # 武器的情况
  696.         if @item.is_a?(RPG::Weapon)
  697.           atk1 = item1 != nil ? item1.atk : 0
  698.           atk2 = @item != nil ? @item.atk : 0
  699.           change = atk2 - atk1
  700.         end
  701.         # 防具的情况
  702.         if @item.is_a?(RPG::Armor)
  703.           pdef1 = item1 != nil ? item1.pdef : 0
  704.           mdef1 = item1 != nil ? item1.mdef : 0
  705.           pdef2 = @item != nil ? @item.pdef : 0
  706.           mdef2 = @item != nil ? @item.mdef : 0
  707.           change = pdef2 - pdef1 + mdef2 - mdef1
  708.         end
  709.         # 描绘能力值变化
  710.         self.contents.draw_text(124, 64 + 64 * i, 112, 32,
  711.           sprintf("%+d", change), 2)
  712.       end
  713.       # 描绘物品
  714.       if item1 != nil
  715.         x = 4
  716.         y = 64 + 64 * i + 32
  717.         bitmap = RPG::Cache.icon(item1.icon_name)
  718.         opacity = self.contents.font.color == normal_color ? 255 : 128
  719.         self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
  720.         self.contents.draw_text(x + 28, y, 212, 32, item1.name)
  721.       end
  722.     end
  723.   end
  724. end
复制代码

看287和288行可以知道,我设置这个是摆来看的最后,知道的人帮我一下,万分感谢

Lv4.逐梦者

梦石
0
星屑
7732
在线时间
1599 小时
注册时间
2013-1-11
帖子
1083
发表于 2019-1-1 09:40:39 | 显示全部楼层
本帖最后由 张咚咚 于 2019-1-1 09:41 编辑

1.把下面这段脚本加到最上面
  1. module RPG
  2.   class Actor
  3.     attr_accessor :armor5_fix
  4.     attr_accessor :armor6_fix
  5.   end
  6. end
复制代码


2.在图中这个位置加入这一段

  1.     when 5  # 属性
  2.       return $data_actors[@actor_id].armor5_fix
  3.     when 6  # 种族
  4.       return $data_actors[@actor_id].armor6_fix
复制代码


3.然后用
$data_actors[1].armor5_fix=true
$data_actors[1].armor6_fix=true
再试试。

评分

参与人数 1星屑 +100 收起 理由
RyanBern + 100 认可答案

查看全部评分

回复 支持 1 反对 0

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
104
在线时间
14 小时
注册时间
2018-12-22
帖子
4
 楼主| 发表于 2019-1-1 20:42:06 | 显示全部楼层
张咚咚 发表于 2019-1-1 09:40
1.把下面这段脚本加到最上面

2.在图中这个位置加入这一段

可以了,非常感谢
回复 支持 反对

使用道具 举报

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

本版积分规则

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

站长信箱:fux2@moe9th.com|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2019-1-21 00:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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