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

Project1

 找回密码
 注册会员
搜索
123
返回列表 发新帖
楼主: chd114
打印 上一主题 下一主题

[已经解决] 为什么同样是RMXP游戏,有的存档后独挡是空白有的不会

[复制链接]

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

21
 楼主| 发表于 2012-8-30 10:23:57 | 只看该作者
Wind2010 发表于 2012-8-30 08:50
目测是Zlib导致的存取档出现的问题
另外有一个不大不小的bug:
▲Scene_Title中的的大小写错了 ...

刚才发现问题的脚本了···是那个耐久度脚本有问题,你能不能帮我看下
  1. #==============================================================================
  2. # 装备耐久度 测试版
  3. # by 沉影不器,chd114为兼容魔塔样板特意修改
  4. #==============================================================================
  5. #主要更改:
  6. #
  7. # ① 角色的每件装备都是原数据库的克隆品,使每件装备都有唯一id
  8. # ② 角色物品窗口中所有装备单独一格
  9. # ③ 更改了商店中对装备的买卖方式,跳过输入数量,只能一件一件买卖
  10. # ④ 战斗中,打人消耗武器耐久度(非物理攻击的技能不消耗),被打消耗防具耐久度,有一定机率
  11. # ⑤ 装备耐久度降为 0 时即是装备损坏,装备能力消失,可修复
  12. # ⑥ 损坏的装备将在大地图上显示
  13. #------------------------------------------------------------------------------
  14. #使用说明
  15. #
  16. # ① 武器耐久度在[数据库-武器]一栏的武器名称后输入,格式为"武器名,耐久度最大值"
  17. #    例如"铜剑,12"表示铜剑最大耐久度为12
  18. #    防具设定同上
  19. # ② 脚本第28行设定原数据库武器最大id
  20. #    例如:默认数据库里最后一个武器是密斯利尔杖,id是32
  21. # ③ 脚本第29行设定原数据库防具最大id,同上
  22. #    ●以上两个常量为必设,须根据您自己的数据库更改,否则出错
  23. # ④ 脚本第30行设定最大耐久度,
  24. # ⑤ 角色初期装备最好没有重复id的装备,比如默认数据库中几个人物都用了铜盾(id:1)
  25. #    这将使几个人物的该铜盾共享一个耐久度
  26. #==============================================================================
  27. module DUR
  28.   DATA_WEAPON_SIZE = 10# 原数据库武器最大id
  29.   DATA_ARMOR_SIZE = 15 # 原数据库防具最大id
  30.   DUR_SET_MAX = 999 # 最大耐久度
  31. end
  32. #==============================================================================

  33. class Game_Actor < Game_Battler
  34.   #--------------------------------------------------------------------------
  35.   def base_str
  36.     n = $data_actors[@actor_id].parameters[2, @level]
  37.     weapon = $data_weapons[@weapon_id]
  38.     armor1 = $data_armors[@armor1_id]
  39.     armor2 = $data_armors[@armor2_id]
  40.     armor3 = $data_armors[@armor3_id]
  41.     armor4 = $data_armors[@armor4_id]
  42.     armor5 = $data_armors[@armor5_id]
  43.     armor6 = $data_armors[@armor6_id]
  44.     armor7 = $data_armors[@armor7_id]
  45.     armor8 = $data_armors[@armor8_id]   
  46.     armor9 = $data_armors[@armor9_id]
  47.     armor10 = $data_armors[@armor10_id]
  48.     armor11 = $data_armors[@armor11_id]
  49.     armor12 = $data_armors[@armor12_id]
  50.     armor13 = $data_armors[@armor13_id]
  51.     n += (weapon != nil and weapon.dur > 0) ? weapon.str_plus : 0
  52.     n += (armor1 != nil and armor1.dur > 0) ? armor1.str_plus : 0
  53.     n += (armor2 != nil and armor2.dur > 0) ? armor2.str_plus : 0
  54.     n += (armor3 != nil and armor3.dur > 0) ? armor3.str_plus : 0
  55.     n += (armor4 != nil and armor4.dur > 0) ? armor4.str_plus : 0
  56.     return [[n, 1].max, 999].min
  57.   end
  58.   #--------------------------------------------------------------------------
  59.   def base_dex
  60.     n = $data_actors[@actor_id].parameters[3, @level]
  61.     weapon = $data_weapons[@weapon_id]
  62.     armor1 = $data_armors[@armor1_id]
  63.     armor2 = $data_armors[@armor2_id]
  64.     armor3 = $data_armors[@armor3_id]
  65.     armor4 = $data_armors[@armor4_id]
  66.     armor5 = $data_armors[@armor5_id]
  67.     armor6 = $data_armors[@armor6_id]
  68.     armor7 = $data_armors[@armor7_id]
  69.     armor8 = $data_armors[@armor8_id]   
  70.     armor9 = $data_armors[@armor9_id]
  71.     armor10 = $data_armors[@armor10_id]
  72.     armor11 = $data_armors[@armor11_id]
  73.     armor12 = $data_armors[@armor12_id]
  74.     armor13 = $data_armors[@armor13_id]
  75.     n += (weapon != nil and weapon.dur > 0) ? weapon.dex_plus : 0
  76.     n += (armor1 != nil and armor1.dur > 0) ? armor1.dex_plus : 0
  77.     n += (armor2 != nil and armor2.dur > 0) ? armor2.dex_plus : 0
  78.     n += (armor3 != nil and armor3.dur > 0) ? armor3.dex_plus : 0
  79.     n += (armor4 != nil and armor4.dur > 0) ? armor4.dex_plus : 0
  80.     return [[n, 1].max, 999].min
  81.   end
  82.   #--------------------------------------------------------------------------
  83.   def base_agi
  84.     n = $data_actors[@actor_id].parameters[4, @level]
  85.     weapon = $data_weapons[@weapon_id]
  86.     armor1 = $data_armors[@armor1_id]
  87.     armor2 = $data_armors[@armor2_id]
  88.     armor3 = $data_armors[@armor3_id]
  89.     armor4 = $data_armors[@armor4_id]   
  90.     armor5 = $data_armors[@armor5_id]
  91.     armor6 = $data_armors[@armor6_id]
  92.     armor7 = $data_armors[@armor7_id]
  93.     armor8 = $data_armors[@armor8_id]   
  94.     armor9 = $data_armors[@armor9_id]
  95.     armor10 = $data_armors[@armor10_id]
  96.     armor11 = $data_armors[@armor11_id]
  97.     armor12 = $data_armors[@armor12_id]
  98.     armor13 = $data_armors[@armor13_id]
  99.     n += (weapon != nil and weapon.dur > 0) ? weapon.agi_plus : 0
  100.     n += (armor1 != nil and armor1.dur > 0) ? armor1.agi_plus : 0
  101.     n += (armor2 != nil and armor2.dur > 0) ? armor2.agi_plus : 0
  102.     n += (armor3 != nil and armor3.dur > 0) ? armor3.agi_plus : 0
  103.     n += (armor4 != nil and armor4.dur > 0) ? armor4.agi_plus : 0
  104.     return [[n, 1].max, 999].min
  105.   end
  106.   #--------------------------------------------------------------------------
  107.   def base_int
  108.     n = $data_actors[@actor_id].parameters[5, @level]
  109.     weapon = $data_weapons[@weapon_id]
  110.     armor1 = $data_armors[@armor1_id]
  111.     armor2 = $data_armors[@armor2_id]
  112.     armor3 = $data_armors[@armor3_id]
  113.     armor4 = $data_armors[@armor4_id]   
  114.     armor5 = $data_armors[@armor5_id]
  115.     armor6 = $data_armors[@armor6_id]
  116.     armor7 = $data_armors[@armor7_id]
  117.     armor8 = $data_armors[@armor8_id]   
  118.     armor9 = $data_armors[@armor9_id]
  119.     armor10 = $data_armors[@armor10_id]
  120.     armor11 = $data_armors[@armor11_id]
  121.     armor12 = $data_armors[@armor12_id]
  122.     armor13 = $data_armors[@armor13_id]
  123.     n += (weapon != nil and weapon.dur > 0) ? weapon.int_plus : 0
  124.     n += (armor1 != nil and armor1.dur > 0) ? armor1.int_plus : 0
  125.     n += (armor2 != nil and armor2.dur > 0) ? armor2.int_plus : 0
  126.     n += (armor3 != nil and armor3.dur > 0) ? armor3.int_plus : 0
  127.     n += (armor4 != nil and armor4.dur > 0) ? armor4.int_plus : 0
  128.     return [[n, 1].max, 999].min
  129.   end
  130.   #--------------------------------------------------------------------------
  131.   def base_atk
  132.     weapon = $data_weapons[@weapon_id]
  133.     return (weapon != nil and weapon.dur > 0) ? weapon.atk : 0
  134.   end
  135.   #--------------------------------------------------------------------------
  136.   def base_pdef
  137.     weapon = $data_weapons[@weapon_id]
  138.     armor1 = $data_armors[@armor1_id]
  139.     armor2 = $data_armors[@armor2_id]
  140.     armor3 = $data_armors[@armor3_id]
  141.     armor4 = $data_armors[@armor4_id]   
  142.     armor5 = $data_armors[@armor5_id]
  143.     armor6 = $data_armors[@armor6_id]
  144.     armor7 = $data_armors[@armor7_id]
  145.     armor8 = $data_armors[@armor8_id]   
  146.     armor9 = $data_armors[@armor9_id]
  147.     armor10 = $data_armors[@armor10_id]
  148.     armor11 = $data_armors[@armor11_id]
  149.     armor12 = $data_armors[@armor12_id]
  150.     armor13 = $data_armors[@armor13_id]
  151.     pdef1 = (weapon != nil and weapon.dur > 0) ? weapon.pdef : 0
  152.     pdef2 = (armor1 != nil and armor1.dur > 0) ? armor1.pdef : 0
  153.     pdef3 = (armor2 != nil and armor2.dur > 0) ? armor2.pdef : 0
  154.     pdef4 = (armor3 != nil and armor3.dur > 0) ? armor3.pdef : 0
  155.     pdef5 = (armor4 != nil and armor4.dur > 0) ? armor4.pdef : 0
  156.     return pdef1 + pdef2 + pdef3 + pdef4 + pdef5
  157.   end
  158.   #--------------------------------------------------------------------------
  159.   def base_mdef
  160.     weapon = $data_weapons[@weapon_id]
  161.     armor1 = $data_armors[@armor1_id]
  162.     armor2 = $data_armors[@armor2_id]
  163.     armor3 = $data_armors[@armor3_id]
  164.     armor4 = $data_armors[@armor4_id]   
  165.     armor5 = $data_armors[@armor5_id]
  166.     armor6 = $data_armors[@armor6_id]
  167.     armor7 = $data_armors[@armor7_id]
  168.     armor8 = $data_armors[@armor8_id]   
  169.     armor9 = $data_armors[@armor9_id]
  170.     armor10 = $data_armors[@armor10_id]
  171.     armor11 = $data_armors[@armor11_id]
  172.     armor12 = $data_armors[@armor12_id]
  173.     armor13 = $data_armors[@armor13_id]
  174.     mdef1 = (weapon != nil and weapon.dur > 0) ? weapon.mdef : 0
  175.     mdef2 = (armor1 != nil and armor1.dur > 0) ? armor1.mdef : 0
  176.     mdef3 = (armor2 != nil and armor2.dur > 0) ? armor2.mdef : 0
  177.     mdef4 = (armor3 != nil and armor3.dur > 0) ? armor3.mdef : 0
  178.     mdef5 = (armor4 != nil and armor4.dur > 0) ? armor4.mdef : 0
  179.     return mdef1 + mdef2 + mdef3 + mdef4 + mdef5
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   def base_eva
  183.     armor1 = $data_armors[@armor1_id]
  184.     armor2 = $data_armors[@armor2_id]
  185.     armor3 = $data_armors[@armor3_id]
  186.     armor4 = $data_armors[@armor4_id]   
  187.     armor5 = $data_armors[@armor5_id]
  188.     armor6 = $data_armors[@armor6_id]
  189.     armor7 = $data_armors[@armor7_id]
  190.     armor8 = $data_armors[@armor8_id]   
  191.     armor9 = $data_armors[@armor9_id]
  192.     armor10 = $data_armors[@armor10_id]
  193.     armor11 = $data_armors[@armor11_id]
  194.     armor12 = $data_armors[@armor12_id]
  195.     armor13 = $data_armors[@armor13_id]
  196.     eva1 = (armor1 != nil and armor1.dur > 0) ? armor1.eva : 0
  197.     eva2 = (armor2 != nil and armor2.dur > 0) ? armor2.eva : 0
  198.     eva3 = (armor3 != nil and armor3.dur > 0) ? armor3.eva : 0
  199.     eva4 = (armor4 != nil and armor4.dur > 0) ? armor4.eva : 0
  200.     return eva1 + eva2 + eva3 + eva4
  201.   end
  202. end
  203. #==============================================================================

  204. class Game_Party
  205.   #--------------------------------------------------------------------------
  206.   attr_accessor   :weapons
  207.   attr_accessor   :armors
  208.   #--------------------------------------------------------------------------
  209.   def weapon_number(weapon_id)
  210.     return @weapons.include?(weapon_id) ? @weapons[weapon_id] : 0
  211.   end
  212.   #--------------------------------------------------------------------------
  213.   # 以下修改于<<武器攻击力波动>>(灼眼的夏娜)
  214.   def gain_weapon(weapon_id, n)
  215.     if weapon_id > 0
  216.       if n > 0 # 增加武器的情况
  217.         n = 1
  218.         # 装备栏中使用的武器不处理~
  219.         if $scene.is_a?(Scene_Equip)
  220.           @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
  221.         else
  222.           new_weapon = $data_weapons[weapon_id].clone
  223.           new_weapon.dur_set = $data_weapons[weapon_id].dur_set
  224.           new_weapon.dur = $data_weapons[weapon_id].dur_set
  225.           new_weapon.id = $data_weapons.size
  226.           #数据库扩容
  227.           $data_weapons.push(new_weapon)
  228.           # 职业可装备武器数组更新~
  229.           for i in 1...$data_classes.size
  230.             if $data_classes[i].weapon_set.include?(weapon_id)
  231.               $data_classes[i].weapon_set.push(new_weapon.id)
  232.             end
  233.           end
  234.           # 增加武器~
  235.           @weapons[new_weapon.id] = [[weapon_number(new_weapon.id) + n, 0].max, 99].min
  236.         end
  237.       else # n < 0 减少武器的情况(未定的情况: n = 0)
  238.         n = -1
  239.         # 装备栏中卸下的武器不处理~
  240.         if $scene.is_a?(Scene_Equip)
  241.           @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
  242.         else
  243.           lose_name = $data_weapons[weapon_id].name
  244.           dur_min = DUR::DUR_SET_MAX
  245.           for i in DUR::DATA_WEAPON_SIZE+1...$data_weapons.size
  246.             # 重新确定weapon_id,必定在原武器数据库之外
  247.             # 减少同名武器中耐久度最低的
  248.             if $data_weapons[i].name == lose_name and $data_weapons[i].dur < dur_min
  249.               weapon_id = i
  250.             end
  251.           end
  252.           # 已不存在的不做操作
  253.           if weapon_number(weapon_id) <= 0
  254.             return
  255.           end
  256.           # 减少武器
  257.           @weapons[weapon_id] = [[weapon_number(weapon_id) + n, 0].max, 99].min
  258.           # 删除行囊拥有的武器id,后id补进
  259.           @weapons.delete(weapon_id)
  260.           weapon_keys = @weapons.keys.sort!
  261.           for i in weapon_keys
  262.             if i > weapon_id
  263.               @weapons[i-1] = @weapons[i]
  264.               @weapons.delete(i)
  265.             end
  266.           end
  267.           # 更改角色使用中的武器id
  268.           for i in [email protected]
  269.             if @actors[i].weapon_id != nil and @actors[i].weapon_id > weapon_id
  270.               @actors[i].weapon_id -= 1
  271.             end
  272.           end
  273.           if weapon_id > DUR::DATA_WEAPON_SIZE
  274.             # 删除数据库武器id,后补进
  275.             for i in weapon_id+1...$data_weapons.size
  276.               $data_weapons[i].id -= 1
  277.             end
  278.             $data_weapons.delete_at(weapon_id)
  279.             # 职业可装备武器数组更新
  280.             for i in 1...$data_classes.size
  281.               if $data_classes[i].weapon_set.include?(weapon_id)
  282.                 $data_classes[i].weapon_set.delete(weapon_id)
  283.               end
  284.               for j in $data_classes[i].weapon_set
  285.                 if j > weapon_id
  286.                   $data_classes[i].weapon_set.delete(j)
  287.                   j -= 1
  288.                   $data_classes[i].weapon_set.push(j)
  289.                 end
  290.               end
  291.             end
  292.           end
  293.         end
  294.       end
  295.     end
  296.   end
  297.   #--------------------------------------------------------------------------
  298.   def gain_armor(armor_id, n)
  299.     if armor_id > 0
  300.       if n > 0 # 增加防具的情况
  301.         n = 1
  302.         # 装备栏中使用的防具不处理~
  303.         if $scene.is_a?(Scene_Equip)
  304.           @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
  305.         else
  306.           new_armor = $data_armors[armor_id].clone
  307.           new_armor.dur_set = $data_armors[armor_id].dur_set
  308.           new_armor.dur = $data_armors[armor_id].dur_set
  309.           new_armor.id = $data_armors.size
  310.           #数据库扩容
  311.           $data_armors.push(new_armor)
  312.           # 职业可装备防具数组更新~
  313.           for i in 1...$data_classes.size
  314.             if $data_classes[i].armor_set.include?(armor_id)
  315.               $data_classes[i].armor_set.push(new_armor.id)
  316.             end
  317.           end
  318.           # 增加防具
  319.           @armors[new_armor.id] = [[armor_number(new_armor.id) + n, 0].max, 99].min
  320.         end
  321.       else # n < 0 减少防具的情况(未定的情况: n = 0)
  322.         n = -1
  323.         # 装备栏中卸下的防具不处理
  324.         if $scene.is_a?(Scene_Equip)
  325.           @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
  326.         else
  327.           lose_name = $data_armors[armor_id].name
  328.           dur_min = DUR::DUR_SET_MAX
  329.           for i in DUR::DATA_ARMOR_SIZE+1...$data_armors.size
  330.             # 重新确定armor_id,必定在原防具数据库之外
  331.             # 减少同名防具中耐久度最低的
  332.             if $data_armors[i].name == lose_name and $data_armors[i].dur < dur_min
  333.               armor_id = i
  334.             end
  335.           end
  336.           # 已不存在的不做操作
  337.           if armor_number(armor_id) <= 0
  338.             return
  339.           end
  340.           # 减少防具
  341.           @armors[armor_id] = [[armor_number(armor_id) + n, 0].max, 99].min
  342.           # 删除行囊拥有的防具id,后id补进
  343.           @weapons.delete(armor_id)
  344.           armor_keys = @armors.keys.sort!
  345.           for i in armor_keys
  346.             if i > armor_id
  347.               @armors[i-1] = @armors[i]
  348.               @armors.delete(i)
  349.             end
  350.           end
  351.           # 更改角色使用中的防具id
  352.           for i in [email protected]
  353.             if @actors[i].armor1_id != nil and @actors[i].armor1_id > armor_id
  354.               @actors[i].armor1_id -= 1
  355.             end
  356.             if @actors[i].armor2_id != nil and @actors[i].armor2_id > armor_id
  357.               @actors[i].armor2_id -= 1
  358.             end
  359.             if @actors[i].armor3_id != nil and @actors[i].armor3_id > armor_id
  360.               @actors[i].armor3_id -= 1
  361.             end
  362.             if @actors[i].armor4_id != nil and @actors[i].armor4_id > armor_id
  363.               @actors[i].armor4_id -= 1
  364.             end
  365.           end
  366.           if armor_id > DUR::DATA_ARMOR_SIZE
  367.             # 删除数据库防具id,后补进
  368.             for i in armor_id+1...$data_armors.size
  369.               $data_armors[i].id -= 1
  370.             end
  371.             $data_armors.delete_at(armor_id)
  372.             # 职业可装备防具数组更新
  373.             for i in 1...$data_classes.size
  374.               if $data_classes[i].armor_set.include?(armor_id)
  375.                 $data_classes[i].armor_set.delete(armor_id)
  376.               end
  377.               for j in $data_classes[i].armor_set
  378.                 if j > armor_id
  379.                   $data_classes[i].armor_set.delete(j)
  380.                   j -= 1
  381.                   $data_classes[i].armor_set.push(j)
  382.                 end
  383.               end
  384.             end
  385.           end
  386.         end
  387.       end
  388.     end
  389.   end
  390. end
  391. # ===========================================================================

  392. class Window_Item < Window_Selectable
  393.   #--------------------------------------------------------------------------
  394.   def update_help
  395.     description = ""
  396.     if self.item != nil
  397.       description = self.item.description
  398.       if !self.item.is_a? RPG::Item
  399.         dur_set = item.dur_set
  400.         dur = item.dur
  401.         description = description + " 耐久度: #{dur}/#{dur_set}"
  402.       end
  403.     end
  404.     @help_window.set_text(description)
  405.   end
  406. end
  407. # ===========================================================================

  408. class Window_EquipItem < Window_Selectable
  409.   #--------------------------------------------------------------------------
  410.   def update_help
  411.     description = ""
  412.     if self.item != nil
  413.       description = self.item.description
  414.       dur_set = item.dur_set
  415.       dur = item.dur
  416.       description = description + " 耐久度: #{dur}/#{dur_set}"
  417.     end
  418.     @help_window.set_text(description)
  419.   end
  420. end
  421. # ===========================================================================

  422. class Window_EquipRight < Window_Selectable
  423.   #--------------------------------------------------------------------------
  424.   def update_help
  425.     description = ""
  426.     if self.item != nil
  427.       description = self.item.description
  428.       dur_set = item.dur_set
  429.       dur = item.dur
  430.       description = description + " 耐久度: #{dur}/#{dur_set}"
  431.     end
  432.     @help_window.set_text(description)
  433.   end
  434. end
  435. #==============================================================================

  436. class Window_ShopBuy < Window_Selectable
  437.   #--------------------------------------------------------------------------
  438.   def update_help
  439.     description = ""
  440.     if self.item != nil
  441.       description = self.item.description
  442.       if !self.item.is_a? RPG::Item
  443.         dur_set = item.dur_set
  444.         dur = item.dur
  445.         description = description + " 耐久度: #{dur}/#{dur_set}"
  446.       end
  447.     end
  448.     @help_window.set_text(description)
  449.   end
  450. end
  451. #==============================================================================

  452. class Window_ShopSell < Window_Selectable
  453.   #--------------------------------------------------------------------------
  454.   def update_help
  455.     description = ""
  456.     if self.item != nil
  457.       description = self.item.description
  458.       if !self.item.is_a? RPG::Item
  459.         dur_set = item.dur_set
  460.         dur = item.dur
  461.         description = description + " 耐久度: #{dur}/#{dur_set}"
  462.       end
  463.     end
  464.     @help_window.set_text(description)
  465.   end
  466. end
  467. #==============================================================================

  468. class Scene_Title
  469.   #--------------------------------------------------------------------------
  470.   alias main_add_dur main
  471.   def main
  472.     main_add_dur
  473.     # 战斗测试的情况下
  474.     if $BTEST
  475.       battle_test
  476.       return
  477.     end
  478.     $data_weapons = load_data("Data/Weapons.rxdata")
  479.     $data_armors = load_data("Data/Armors.rxdata")
  480.     # 初始化耐久度
  481.     for i in 1...$data_weapons.size
  482.       $data_weapons[i].dur = $data_weapons[i].dur_set
  483.     end
  484.     for i in 1...$data_armors.size
  485.       $data_armors[i].dur = $data_armors[i].dur_set
  486.     end
  487.   end
  488. end
  489. #==============================================================================

  490. class Scene_Shop
  491.   #--------------------------------------------------------------------------
  492.   def update_buy
  493.     @status_window.item = @buy_window.item
  494.     if Input.trigger?(Input::B)
  495.       $game_system.se_play($data_system.cancel_se)
  496.       # 窗口状态转向初期模式
  497.       @command_window.active = true
  498.       @dummy_window.visible = true
  499.       @buy_window.active = false
  500.       @buy_window.visible = false
  501.       @status_window.visible = false
  502.       @status_window.item = nil
  503.       @help_window.set_text("")
  504.       return
  505.     end
  506.     if Input.trigger?(Input::C)
  507.       @item = @buy_window.item
  508.       if @item == nil or @item.price > $game_party.gold
  509.         $game_system.se_play($data_system.buzzer_se)
  510.         return
  511.       end
  512.       case @item
  513.       when RPG::Item
  514.         number = $game_party.item_number(@item.id)
  515.       when RPG::Weapon
  516.         number = $game_party.weapon_number(@item.id)
  517.       when RPG::Armor
  518.         number = $game_party.armor_number(@item.id)
  519.       end
  520.       if number == 99
  521.         $game_system.se_play($data_system.buzzer_se)
  522.         return
  523.       end
  524.       $game_system.se_play($data_system.decision_se)
  525.       max = @item.price == 0 ? 99 : $game_party.gold / @item.price
  526.       max = [max, 99 - number].min
  527.       if @item.is_a? RPG::Item # 除物品外直接买进1件
  528.         @buy_window.active = false
  529.         @buy_window.visible = false
  530.         @number_window.set(@item, max, @item.price)
  531.         @number_window.active = true
  532.         @number_window.visible = true
  533.       else
  534.         update_number
  535.       end
  536.     end
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   def update_sell
  540.     if Input.trigger?(Input::B)
  541.       $game_system.se_play($data_system.cancel_se)
  542.       @command_window.active = true
  543.       @dummy_window.visible = true
  544.       @sell_window.active = false
  545.       @sell_window.visible = false
  546.       @status_window.item = nil
  547.       @help_window.set_text("")
  548.       return
  549.     end
  550.     if Input.trigger?(Input::C)
  551.       @item = @sell_window.item
  552.       @status_window.item = @item
  553.       if @item == nil or @item.price == 0
  554.         $game_system.se_play($data_system.buzzer_se)
  555.         return
  556.       end
  557.       $game_system.se_play($data_system.decision_se)
  558.       case @item
  559.       when RPG::Item
  560.         number = $game_party.item_number(@item.id)
  561.       when RPG::Weapon
  562.         number = $game_party.weapon_number(@item.id)
  563.       when RPG::Armor
  564.         number = $game_party.armor_number(@item.id)
  565.       end
  566.       max = number
  567.       if @item.is_a? RPG::Item # 除物品外直接卖出1件
  568.         @sell_window.active = false
  569.         @sell_window.visible = false
  570.         @number_window.set(@item, max, @item.price / 2)
  571.         @number_window.active = true
  572.         @number_window.visible = true
  573.         @status_window.visible = true
  574.       else
  575.         update_number
  576.       end
  577.     end
  578.   end
  579. end
  580. #==============================================================================

  581. class Window_Dur < Window_Base
  582.   #--------------------------------------------------------------------------
  583.   def initialize
  584.     super(0,0,320,480)
  585.     self.opacity = 0
  586.     self.contents = Bitmap.new(width - 32, height - 32)
  587.     @text_dur_old = [0]
  588.     @text_dur = []
  589.     refresh
  590.   end
  591.   #--------------------------------------------------------------------------
  592.   def draw_text_dur(index,y)
  593.     text = @text_dur[index]
  594.     tx = 0
  595.     ty = index * 24 + y
  596.     self.contents.font.color = normal_color
  597.     self.contents.draw_text(tx, ty, 320-32, 24, text)
  598.   end
  599.   #--------------------------------------------------------------------------
  600.   def refresh
  601.     # 节省内存
  602.     if @text_dur_old == @text_dur
  603.       return
  604.     end
  605.     @text_dur.clear
  606.     # 取得空耐久度的装备名
  607.     for i in $game_party.actors
  608.       if $data_weapons[i.weapon_id] != nil and $data_weapons[i.weapon_id].dur == 0
  609.         @text_dur.push(i.name + "-" + $data_weapons[i.weapon_id].name)
  610.       end
  611.       if $data_armors[i.armor1_id] != nil and $data_armors[i.armor1_id].dur == 0
  612.         @text_dur.push(i.name + "-" + $data_armors[i.armor1_id].name)
  613.       end
  614.       if $data_armors[i.armor2_id] != nil and $data_armors[i.armor2_id].dur == 0
  615.         @text_dur.push(i.name + "-" + $data_armors[i.armor2_id].name)
  616.       end
  617.       if $data_armors[i.armor3_id] != nil and $data_armors[i.armor3_id].dur == 0
  618.         @text_dur.push(i.name + "-" + $data_armors[i.armor3_id].name)
  619.       end
  620.       if $data_armors[i.armor4_id] != nil and $data_armors[i.armor4_id].dur == 0
  621.         @text_dur.push(i.name + "-" + $data_armors[i.armor4_id].name)
  622.       end
  623.     end
  624.     @text_dur_old = @text_dur
  625.     y = 448 - @text_dur.size * 24
  626.     self.contents.clear
  627.     self.contents.font.size = 14
  628.     if @text_dur != []
  629.       self.contents.font.color = Color.new(255, 0, 0) # 红色显示
  630.       self.contents.draw_text(0, y - 24, 320 - 32, 24, "装备损坏:")
  631.     end
  632.     for i in 0... @text_dur.size
  633.       draw_text_dur(i,y)
  634.     end
  635.     self.contents.font.size = Font.default_size
  636.   end
  637. end
  638. #↑
  639. #↓
  640. #==============================================================================

  641. class Scene_Save < Scene_File
  642.   #--------------------------------------------------------------------------
  643.   def write_save_data(file)
  644.     characters = []
  645.     for i in 0...$game_party.actors.size
  646.       actor = $game_party.actors[i]
  647.       characters.push([actor.character_name, actor.character_hue])
  648.     end
  649.     Marshal.dump(characters, file)
  650.     Marshal.dump(Graphics.frame_count, file)
  651.     $game_system.save_count += 1
  652.     $game_system.magic_number = $data_system.magic_number
  653.     Marshal.dump($game_system, file)
  654.     Marshal.dump($game_switches, file)
  655.     Marshal.dump($game_variables, file)
  656.     Marshal.dump($game_self_switches, file)
  657.     Marshal.dump($game_screen, file)
  658.     Marshal.dump($game_actors, file)
  659.     Marshal.dump($game_party, file)
  660.     Marshal.dump($game_troop, file)
  661.     Marshal.dump($game_map, file)
  662.     Marshal.dump($game_player, file)
  663.     Marshal.dump($data_weapons, file)
  664.     Marshal.dump($data_armors, file)
  665.     Marshal.dump($data_classes, file)
  666.   end
  667. end
  668. #==============================================================================

  669. module RPG
  670.   class Weapon
  671.     attr_accessor :dur_set
  672.     attr_accessor :dur
  673.     def name
  674.       name = @name.split(/,/)[0]
  675.       return name != nil ? name : ''
  676.     end
  677.     def dur_set
  678.       dur_set = @name.split(/-/)[1]
  679.       return dur_set != nil ? dur_set.to_i : 0
  680.     end
  681.   end
  682.   class Armor
  683.     attr_accessor :dur_set
  684.     attr_accessor :dur
  685.     def name
  686.       name = @name.split(/,/)[0]
  687.       return name != nil ? name : ''
  688.     end
  689.     def dur_set
  690.       dur_set = @name.split(/-/)[1]
  691.       return dur_set != nil ? dur_set.to_i : 0
  692.     end
  693.   end
  694. end
复制代码
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

Lv1.梦旅人

虱子

梦石
0
星屑
121
在线时间
1782 小时
注册时间
2010-6-19
帖子
3597
22
发表于 2012-8-30 11:22:14 | 只看该作者
Scripts.rxdata (313 KB, 下载次数: 25)
旧存档不能使用

点评

那么耐久度脚本是正常的吗?重新存档的话新存的档可以读取吗?  发表于 2012-8-30 13:01
你是说改完这个脚本后旧的存档不能用?  发表于 2012-8-30 12:46

http://rpg.blue/thread-175056-1-2.html
PVZ型塔防物一个
http://rpg.blue/thread-155199-1-2.html
RMXP技术讨论区手动认可帖,得到答案请认可
回复

使用道具 举报

Lv4.逐梦者

梦石
0
星屑
9280
在线时间
2504 小时
注册时间
2011-5-20
帖子
15389

开拓者

23
 楼主| 发表于 2012-8-30 11:39:44 | 只看该作者
Wind2010 发表于 2012-8-30 11:22
旧存档不能使用

什么意思?

点评

是的  发表于 2012-8-30 12:56
修改后旧存档不能使用  发表于 2012-8-30 12:30
[img]http://service.t.sina.com.cn/widget/qmd/5339802982/c02e16bd/7.png
回复

使用道具 举报

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

本版积分规则

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

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

GMT+8, 2024-9-28 13:21

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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