赞 | 2 |
VIP | 0 |
好人卡 | 1 |
积分 | 1 |
经验 | 16088 |
最后登录 | 2023-9-12 |
在线时间 | 596 小时 |
Lv1.梦旅人 神仙
- 梦石
- 0
- 星屑
- 69
- 在线时间
- 596 小时
- 注册时间
- 2007-5-14
- 帖子
- 1289
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 李梦遥 于 2010-8-25 12:17 编辑
角色若在99级之内,查看菜单,点开状态,是正常的。
一旦突破99级,再去查看菜单里面的状态,就会弹错。
下面是出错的脚本,是不是破了99级,100级以后的状态,他无法读取啊?请求高人解决,在第93行
我用的是轩辕剑式菜单,我在范例工程里面添加了突破限制脚本,也是这样,突破99级,看状态就会弹错,和我一样,也是装备项扩充 n += weapon != nil ? weapon.str_plus : 0 这段错了- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # 防具类追加
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- module RPG
- class Armor
- def name
- name = @name.split(/,/)[0]
- return name != nil ? name : ''
- end
- def kind
- kind = @name.split(/,/)[1]
- return kind != nil ? kind.to_i : @kind
- end
- end
- end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # Game_Actor添加新的防具ID,并对相关方法修正
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- class Game_Actor < Game_Battler
- attr_reader :armor5_id # 手套 ID
- attr_reader :armor6_id # 鞋 ID
- attr_reader :armor7_id # 法宝2 ID
- #--------------------------------------------------------------------------
- # ● 设置
- # actor_id : 角色 ID
- #--------------------------------------------------------------------------
- alias old_setup setup
- def setup(actor_id)
- old_setup(actor_id)
- @armor5_id = 0
- @armor6_id = 0
- @armor7_id = 0
- update_auto_state(nil, $data_armors[@armor5_id])
- update_auto_state(nil, $data_armors[@armor6_id])
- update_auto_state(nil, $data_armors[@armor7_id])
- end
- #--------------------------------------------------------------------------
- # ● 取得属性修正值
- # element_id : 属性 ID
- #--------------------------------------------------------------------------
- def element_rate(element_id)
- # 获取对应属性有效度的数值
- table = [0,200,150,100,50,0,-100]
- result = table[$data_classes[@class_id].element_ranks[element_id]]
- # 防具能防御本属性的情况下效果减半
- for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id, @armor7_id]
- armor = $data_armors[i]
- if armor != nil and armor.guard_element_set.include?(element_id)
- result /= 2
- end
- end
- # 状态能防御本属性的情况下效果减半
- for i in @states
- if $data_states[i].guard_element_set.include?(element_id)
- result /= 2
- end
- end
- # 过程结束
- return result
- end
- #--------------------------------------------------------------------------
- # ● 判定防御属性
- # state_id : 属性 ID
- #--------------------------------------------------------------------------
- def state_guard?(state_id)
- for i in [@armor1_id, @armor2_id, @armor3_id, @armor4_id, @armor5_id, @armor6_id, @armor7_id]
- armor = $data_armors[i]
- if armor != nil
- if armor.guard_state_set.include?(state_id)
- return true
- end
- end
- end
- return false
- end
- #--------------------------------------------------------------------------
- # ● 获取基本力量
- #--------------------------------------------------------------------------
- def base_str
- n = $data_actors[@actor_id].parameters[2, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_id]
- n += weapon != nil ? weapon.str_plus : 0
- n += armor1 != nil ? armor1.str_plus : 0
- n += armor2 != nil ? armor2.str_plus : 0
- n += armor3 != nil ? armor3.str_plus : 0
- n += armor4 != nil ? armor4.str_plus : 0
- n += armor5 != nil ? armor5.str_plus : 0
- n += armor6 != nil ? armor6.str_plus : 0
- n += armor7 != nil ? armor7.str_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本灵巧
- #--------------------------------------------------------------------------
- def base_dex
- n = $data_actors[@actor_id].parameters[3, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_id]
- n += weapon != nil ? weapon.dex_plus : 0
- n += armor1 != nil ? armor1.dex_plus : 0
- n += armor2 != nil ? armor2.dex_plus : 0
- n += armor3 != nil ? armor3.dex_plus : 0
- n += armor4 != nil ? armor4.dex_plus : 0
- n += armor5 != nil ? armor5.dex_plus : 0
- n += armor6 != nil ? armor6.dex_plus : 0
- n += armor7 != nil ? armor7.dex_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本速度
- #--------------------------------------------------------------------------
- def base_agi
- n = $data_actors[@actor_id].parameters[4, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_id]
- n += weapon != nil ? weapon.agi_plus : 0
- n += armor1 != nil ? armor1.agi_plus : 0
- n += armor2 != nil ? armor2.agi_plus : 0
- n += armor3 != nil ? armor3.agi_plus : 0
- n += armor4 != nil ? armor4.agi_plus : 0
- n += armor5 != nil ? armor5.agi_plus : 0
- n += armor6 != nil ? armor6.agi_plus : 0
- n += armor7 != nil ? armor7.agi_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本魔力
- #--------------------------------------------------------------------------
- def base_int
- n = $data_actors[@actor_id].parameters[5, @level]
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_id]
- n += weapon != nil ? weapon.int_plus : 0
- n += armor1 != nil ? armor1.int_plus : 0
- n += armor2 != nil ? armor2.int_plus : 0
- n += armor3 != nil ? armor3.int_plus : 0
- n += armor4 != nil ? armor4.int_plus : 0
- n += armor5 != nil ? armor5.int_plus : 0
- n += armor6 != nil ? armor6.int_plus : 0
- n += armor7 != nil ? armor7.int_plus : 0
- return [[n, 1].max, 999].min
- end
- #--------------------------------------------------------------------------
- # ● 获取基本物理防御
- #--------------------------------------------------------------------------
- def base_pdef
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_id]
- pdef1 = weapon != nil ? weapon.pdef : 0
- pdef2 = armor1 != nil ? armor1.pdef : 0
- pdef3 = armor2 != nil ? armor2.pdef : 0
- pdef4 = armor3 != nil ? armor3.pdef : 0
- pdef5 = armor4 != nil ? armor4.pdef : 0
- pdef6 = armor5 != nil ? armor5.pdef : 0
- pdef7 = armor6 != nil ? armor6.pdef : 0
- pdef8 = armor7 != nil ? armor7.pdef : 0
- return pdef1 + pdef2 + pdef3 + pdef4 + pdef5 + pdef6 + pdef7 + pdef8
- end
- #--------------------------------------------------------------------------
- # ● 获取基本魔法防御
- #--------------------------------------------------------------------------
- def base_mdef
- weapon = $data_weapons[@weapon_id]
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_id]
- mdef1 = weapon != nil ? weapon.mdef : 0
- mdef2 = armor1 != nil ? armor1.mdef : 0
- mdef3 = armor2 != nil ? armor2.mdef : 0
- mdef4 = armor3 != nil ? armor3.mdef : 0
- mdef5 = armor4 != nil ? armor4.mdef : 0
- mdef6 = armor5 != nil ? armor5.mdef : 0
- mdef7 = armor6 != nil ? armor6.mdef : 0
- mdef8 = armor7 != nil ? armor7.mdef : 0
- return mdef1 + mdef2 + mdef3 + mdef4 + mdef5 + mdef6 + mdef7 + mdef8
- end
- #--------------------------------------------------------------------------
- # ● 获取基本回避修正
- #--------------------------------------------------------------------------
- def base_eva
- armor1 = $data_armors[@armor1_id]
- armor2 = $data_armors[@armor2_id]
- armor3 = $data_armors[@armor3_id]
- armor4 = $data_armors[@armor4_id]
- armor5 = $data_armors[@armor5_id]
- armor6 = $data_armors[@armor6_id]
- armor7 = $data_armors[@armor7_id]
- eva1 = armor1 != nil ? armor1.eva : 0
- eva2 = armor2 != nil ? armor2.eva : 0
- eva3 = armor3 != nil ? armor3.eva : 0
- eva4 = armor4 != nil ? armor4.eva : 0
- eva5 = armor5 != nil ? armor5.eva : 0
- eva6 = armor6 != nil ? armor6.eva : 0
- eva7 = armor7 != nil ? armor7.eva : 0
- return eva1 + eva2 + eva3 + eva4 + eva5 + eva6 + eva7
- end
- #--------------------------------------------------------------------------
- # ● 变更装备
- # equip_type : 装备类型
- # id : 武器 or 防具 ID (0 为解除装备)
- #--------------------------------------------------------------------------
- def equip(equip_type, id)
- case equip_type
- when 0 # 武器
- if id == 0 or $game_party.weapon_number(id) > 0
- $game_party.gain_weapon(@weapon_id, 1)
- @weapon_id = id
- $game_party.lose_weapon(id, 1)
- end
- when 1 # 盾
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor1_id], $data_armors[id])
- $game_party.gain_armor(@armor1_id, 1)
- @armor1_id = id
- $game_party.lose_armor(id, 1)
- end
- when 2 # 头
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor2_id], $data_armors[id])
- $game_party.gain_armor(@armor2_id, 1)
- @armor2_id = id
- $game_party.lose_armor(id, 1)
- end
- when 3 # 身体
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor3_id], $data_armors[id])
- $game_party.gain_armor(@armor3_id, 1)
- @armor3_id = id
- $game_party.lose_armor(id, 1)
- end
- when 4 # 手套
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor4_id], $data_armors[id])
- $game_party.gain_armor(@armor4_id, 1)
- @armor4_id = id
- $game_party.lose_armor(id, 1)
- end
- when 5 # 鞋
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor5_id], $data_armors[id])
- $game_party.gain_armor(@armor5_id, 1)
- @armor5_id = id
- $game_party.lose_armor(id, 1)
- end
- when 6 # 法宝1
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor6_id], $data_armors[id])
- $game_party.gain_armor(@armor6_id, 1)
- @armor6_id = id
- $game_party.lose_armor(id, 1)
- end
- when 7 # 法宝2
- if id == 0 or $game_party.armor_number(id) > 0
- update_auto_state($data_armors[@armor7_id], $data_armors[id])
- $game_party.gain_armor(@armor7_id, 1)
- @armor7_id = id
- $game_party.lose_armor(id, 1)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 更改职业 ID
- # class_id : 新的职业 ID
- #--------------------------------------------------------------------------
- def class_id=(class_id)
- if $data_classes[class_id] != nil
- @class_id = class_id
- # 避开无法装备的物品
- unless equippable?($data_weapons[@weapon_id])
- equip(0, 0)
- end
- unless equippable?($data_armors[@armor1_id])
- equip(1, 0)
- end
- unless equippable?($data_armors[@armor2_id])
- equip(2, 0)
- end
- unless equippable?($data_armors[@armor3_id])
- equip(3, 0)
- end
- unless equippable?($data_armors[@armor4_id])
- equip(4, 0)
- end
- unless equippable?($data_armors[@armor5_id])
- equip(5, 0)
- end
- unless equippable?($data_armors[@armor6_id])
- equip(6, 0)
- end
- unless equippable?($data_armors[@armor7_id])
- equip(7, 0)
- end
- end
- end
- end
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #
- # 商店购买窗口美化,增加对新装备位置的描述
- #
- # ★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★★
- #==============================================================================
- # ■ Window_ShopStatus
- #------------------------------------------------------------------------------
- # 商店画面、显示物品所持数与角色装备的窗口。
- #==============================================================================
- class Window_ShopStatus < Window_Base
- #--------------------------------------------------------------------------
- # ● 刷新
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- if @item == nil
- return
- end
- case @item
- when RPG::Item
- number = $game_party.item_number(@item.id)
- when RPG::Weapon
- number = $game_party.weapon_number(@item.id)
- when RPG::Armor
- number = $game_party.armor_number(@item.id)
- end
- self.contents.font.color = system_color
- self.contents.draw_text(4, 0, 200, 32, "所持数")
- self.contents.font.color = normal_color
- self.contents.draw_text(204, 0, 32, 32, number.to_s, 2)
- if @item.is_a?(RPG::Item)
- return
- end
- # 添加装备品信息
- for i in 0...$game_party.actors.size
- # 获取角色
- actor = $game_party.actors[i]
- # 可以装备为普通文字颜色、不能装备设置为无效文字颜色
- if actor.equippable?(@item)
- self.contents.font.color = normal_color
- else
- self.contents.font.color = disabled_color
- end
- # 描绘角色名字
- self.contents.draw_text(4, 64 + 64 * i, 120, 32, actor.name)
- # 获取当前的装备品
- if @item.is_a?(RPG::Weapon)
- item1 = $data_weapons[actor.weapon_id]
- elsif @item.kind == 0
- item1 = $data_armors[actor.armor1_id]
- elsif @item.kind == 1
- item1 = $data_armors[actor.armor2_id]
- elsif @item.kind == 2
- item1 = $data_armors[actor.armor3_id]
- elsif @item.kind == 3
- item1 = $data_armors[actor.armor4_id]
- elsif @item.kind == 4
- item1 = $data_armors[actor.armor5_id]
- elsif @item.kind == 5
- item1 = $data_armors[actor.armor6_id]
- else
- item1 = $data_armors[actor.armor7_id]
- end
- # 可以装备的情况
- if actor.equippable?(@item)
- # 武器的情况
- if @item.is_a?(RPG::Weapon)
- atk1 = item1 != nil ? item1.atk : 0
- atk2 = @item != nil ? @item.atk : 0
- change = atk2 - atk1
- end
- # 防具的情况
- if @item.is_a?(RPG::Armor)
- pdef1 = item1 != nil ? item1.pdef : 0
- mdef1 = item1 != nil ? item1.mdef : 0
- pdef2 = @item != nil ? @item.pdef : 0
- mdef2 = @item != nil ? @item.mdef : 0
- change = pdef2 - pdef1 + mdef2 - mdef1
- end
- # 描绘能力值变化
- self.contents.draw_text(124, 64 + 64 * i, 112, 32,
- sprintf("%+d", change), 2)
- end
- # 描绘物品
- if item1 != nil
- x = 4
- y = 64 + 64 * i + 32
- bitmap = RPG::Cache.icon(item1.icon_name)
- opacity = self.contents.font.color == normal_color ? 255 : 128
- self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
- self.contents.draw_text(x + 28, y, 212, 32, item1.name)
- end
- end
- end
- end
复制代码 |
|