赞 | 0 |
VIP | 0 |
好人卡 | 2 |
积分 | 1 |
经验 | 2993 |
最后登录 | 2016-1-16 |
在线时间 | 130 小时 |
Lv1.梦旅人
- 梦石
- 0
- 星屑
- 50
- 在线时间
- 130 小时
- 注册时间
- 2011-3-10
- 帖子
- 65
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
本帖最后由 s20810 于 2011-12-2 09:54 编辑
本来是上6r请求帮忙改掉此脚本中武器属性只能拥有一个的窘境
但在求助无门的情况下只好让我这个脚本盲用最愚蠢的方法...加上不断的尝试
终于找出了修改的方法 唉... 顺便分享一下 虽然不知道有没有帮上忙 Orz
原帖在这#[url]http://rpg.blue/thread-208284-1-1.html[/url]
原脚本如下- #==============================================================================
- # ● 简易装备强化 Ver 1.0
- #http://rpg.blue/thread-208284-1-1.html
- #-----------------------------------------------------------------------------
- #可以强化武器和防具,但是强化的是一个类型。
- #即强化时不分数量只分类型。
- #-----------------------------------------------------------------------------
- #最大支持8素材(显示窗口还可以看的状态)
- #每次只能添加一种附加状态
- #武器只能存在一种属性(防具不限)
- #-----------------------------------------------------------------------------
- #S键切换武器强化和防具强化
- #-----------------------------------------------------------------------------
- #调用请在脚本添加$scene = Scene_Equip_Strengthen.new
- #在对话框后调用等设置等待5帧(否则对话框来不及消失)
- #=============================================================================
- #==============================================================================
- # ■ Nanaka_Equip_Strengthen
- #------------------------------------------------------------------------------
- # 武器强化系统设定部分
- #==============================================================================
- module Nanaka_Equip_Strengthen
-
- #场景背景图的名称
- #不需要时请填写为nil
- Background_Picture_Name = "03"
- #用来记录武器名称的数组
- Equip_Name_List = []
- #用来记录武器图标的数组
- Equip_Icon_List = []
- #用来记录武器编号的数组
- Equip_Index_List = []
- #用来记录武器强化素材的哈希表
- Equip_Material_List = {
- #--------------------------------------------------------------------------
- # 哈希表对应的依次为
- # [ 每级强化的素材种类 ] (一维数组)
- # [ [ 每级对应的素材ID ] ] (二维数组)
- # [ [ 每级素材的需求数量 ] ] (二维数组)
- # 最大强化次数 (数字)
- #
- # 例中棍子的含义为
- # 最多强化3次,
- # 每次分别需要8种、4种、3种素材
- # 第一次强化各素材依次需要1、1、1、1、99、99、99、6个
- # 第二次强化各素材依次需要1、1、1、1个
- # 下略
- #--------------------------------------------------------------------------
- "练习用木刀" => [ [1,1,1],
- [ [3], [3], [3]],
- [ [1],[2],[3]], 3],
-
- "皮盾" => [ [4,4,3],
- [[1,2,3,4],[4,6,7,8],[9,10,11]],
- [[1,1,1,1],[1,1,1,1],[1,1,1]],
- 3],
- "长剑" => [ [1],
- [[1,2,3,4]],
- [[1,1,1,1]],
- 1]
- }
- #用来记录武器强化效果的哈希表
- #--------------------------------------------------------------------------
- #一维数组依次对应攻击、防御、敏捷、精神、附加状态、属性变更
- #请对应强化次数来填写
- #前四项正负均可,后两项请保证对应数据库,无附加状态和属性变更时请填0
- #--------------------------------------------------------------------------
- Strengthen_Effect_List = {
- # [攻击] [防御] [敏捷] [精神] [附加状态] [属性变更]
- "练习用木刀" => [[9,2,3], [9,2,3], [9,1,1], [-9,0,0], [1,0,0], [1,2,3]],
-
- "皮盾" => [[1,2,3], [1,2,3], [0,1,1], [0,0,0], [1,0,0], [1,0,0]],
-
- "长剑" => [[1], [1], [1], [1], [0], [0]]
- }
- #帮助窗口提示文字
- Msg_Weapon_Help = "请选择要强化的武器"
- Msg_Armor_Help = "请选择要强化的防具"
- #无法强化的武器提示文字
- Msg_Weapon_Disable = "-该武器无法强化-"
- Msg_Armor_Disable = "-该防具无法强化-"
- #武器强化到满级的提示文字
- Msg_Weapon_Max_Level = "-该武器已强化到极限-"
- Msg_Armor_Max_Level = "-该防具已强化到极限-"
- #强化素材说明文字
- Msg_Material = "-强化素材-"
- #强化效果说明文字
- Msg_Effect = "-强化效果-"
- #各个效果的名称
- Msg_Weapon_Effect_Text = ["攻击:","防御:","敏捷:","精神:","附加:","属性:"]
- Msg_Armor_Effect_Text = ["攻击:","防御:","敏捷:","精神:","无效:","抵抗:"]
- #强化完成的确认文字
- Msg_Strengthen_Complete = "★☆★☆★☆强化完成★☆★☆★☆"
- #武器和防具的识别文字
- Weapon_Type = "weapon"
- Armor_Type = "armor"
-
- #--------------------------------------------------------------------------
- # ☆Nanaka_Equip_Strengthen★
- # 初始化方法
- # 原则上每次进入场景需要调用一次
- #--------------------------------------------------------------------------
- def self.init(type)
- Equip_Name_List.clear
- Equip_Icon_List.clear
- Equip_Index_List.clear
- if type == Weapon_Type
- for weapon in $data_weapons
- next if weapon == nil
- if $game_party.has_item?(weapon, true)
- Equip_Name_List.push(weapon.name)
- Equip_Icon_List.push(weapon.icon_index)
- Equip_Index_List.push(weapon.id)
- end
- end
- else
- for armor in $data_armors
- next if armor == nil
- if $game_party.has_item?(armor, true)
- Equip_Name_List.push(armor.name)
- Equip_Icon_List.push(armor.icon_index)
- Equip_Index_List.push(armor.id)
- end
- end
- end
- end
-
- end
- #==============================================================================
- # ■ Scene_Equip_Strengthen
- #------------------------------------------------------------------------------
- # 处理武器强化的类
- #==============================================================================
- class Scene_Equip_Strengthen < Scene_Base
- include Nanaka_Equip_Strengthen
- #--------------------------------------------------------------------------
- # ☆Scene_Equip_Strengthen★
- # 开始处理
- #--------------------------------------------------------------------------
- def start
-
- #初始化武器强化模组
- Nanaka_Equip_Strengthen.init(Weapon_Type)
- #默认Type为武器强化
- @now_type = Weapon_Type
- if Background_Picture_Name != nil
- @background_sprite = Sprite.new
- @background_sprite.bitmap = Cache.picture(Background_Picture_Name)
- end
- create_weapon_strengthen_menu(@now_type)
- end
-
- def create_weapon_strengthen_menu(type)
- @help_window.dispose if @help_window != nil
- @window_weapon_selecte.dispose if @window_weapon_selecte != nil
- @window_strengthen_detail.dispose if @window_strengthen_detail != nil
- #生成帮助条
- @help_window = Window_Help.new
- @help_window.set_text(Msg_Weapon_Help, 1) if type == Weapon_Type
- @help_window.set_text(Msg_Armor_Help, 1) if type == Armor_Type
-
- #生成武器强化菜单栏
- command = []
- for i in Equip_Name_List
- command.push(i)
- end
- @window_weapon_selecte = Window_Weapon_Selecte.new(160, command)
- update_window_selecte
- #设定y坐标
- @window_weapon_selecte.y = @help_window.height
- #计算显示区域
- @window_weapon_selecte.height = Graphics.height - @help_window.height
-
- #生成武器强化细节
- @window_strengthen_detail = Window_Strengthen_Detail.new(type)
- @window_strengthen_detail.refresh(0)
- end
- #--------------------------------------------------------------------------
- # ☆Scene_Equip_Strengthen★
- # 更新武器强化菜单栏
- #--------------------------------------------------------------------------
- def update_window_selecte
- for i in 0...Equip_Name_List.size
- if !is_can_strengthen?(i, @now_type)
- @window_weapon_selecte.draw_item(i, false)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ☆Scene_Equip_Strengthen★
- # 处理武器强化
- #--------------------------------------------------------------------------
- def weapon_strengthen(index, type)
- #获取装备及装备等级
- if type == Weapon_Type
- equip = $data_weapons[Equip_Index_List[index]]
- equip_level = $weapons_level[equip.id]
- else
- equip = $data_armors[Equip_Index_List[index]]
- equip_level = $armors_level[equip.id]
- end
- equip_level = 0 if equip_level == nil
- #获取装备强化效果列表
- equip_effect_hash = Strengthen_Effect_List[equip.name]
- #获取本次装备强化效果
- effect_value = []
- for array in equip_effect_hash
- effect_value.push(array[equip_level])
- end
- #装备强化效果处理
- equip.atk += effect_value[0]
- equip.def += effect_value[1]
- equip.agi += effect_value[2]
- equip.spi += effect_value[3]
- equip.state_set.push(effect_value[4]) if effect_value[4] != 0
- #武器只存在一种属性
- if effect_value[5] != 0
- equip.element_set.clear if type == Weapon_Type
- equip.element_set.push(effect_value[5])
- end
- if type == Weapon_Type
- $weapons_level[equip.id] = equip_level + 1
- else
- $armors_level[equip.id] = equip_level + 1
- end
- #获取武器强化素材列表
- equip_material_hash = Equip_Material_List[equip.name]
- material_list = []
- amount_list = []
- #获取本次强化素材
- for material_index in equip_material_hash[1][equip_level]
- material_list.push(material_index)
- end
- #获取本次强化素材所需数量
- for amount in equip_material_hash[2][equip_level]
- amount_list.push(amount)
- end
- #武器强化素材消费处理
- for index in 0...material_list.size
- material = $data_items[index]
- $game_party.lose_item(material, amount_list[index])
- end
- call_determine_window
- end
- #--------------------------------------------------------------------------
- # ☆Scene_Equip_Strengthen★
- # 判断强化武器的素材是否足够
- #--------------------------------------------------------------------------
- def is_can_strengthen?(index, type)
- #获取武器强化素材
- equip_name = Equip_Name_List[index]
- equip_hash = Equip_Material_List[equip_name]
- if type == Weapon_Type
- equip_level = $weapons_level[$data_weapons[Equip_Index_List[index]].id]
- else
- equip_level = $armors_level[$data_armors[Equip_Index_List[index]].id]
- end
- equip_level = 0 if equip_level == nil
- return false if equip_hash == nil
- return false if equip_level == equip_hash[3]
- #获取素材总数,素材编号和素材数量
- total_amount = equip_hash[0][equip_level]
- equip_material_array = equip_hash[1][equip_level]
- material_amount_array = equip_hash[2][equip_level]
- #判断是否可以强化
- for i in 0...total_amount
- equip_material_index = equip_material_array[i]
- material_amount = material_amount_array[i]
- equip_material = $data_items[equip_material_index]
- if $game_party.item_number(equip_material) < material_amount
- return false
- end
- end
- return true
- end
- #--------------------------------------------------------------------------
- # ☆Scene_Equip_Strengthen★
- # 更新画面
- #--------------------------------------------------------------------------
- def update
- @window_weapon_selecte.update
- @window_strengthen_detail.update
- @help_window.update
- @window_strengthen_detail.refresh(@window_weapon_selecte.index)
- if Input.trigger?(Input::B)
- Sound.play_cancel
- $scene = Scene_Map.new
- end
- if Input.trigger?(Input::C)
- if is_can_strengthen?(@window_weapon_selecte.index, @now_type)
- Sound.play_decision
- #强化武器
- weapon_strengthen(@window_weapon_selecte.index, @now_type)
- #更新窗口栏目
- update_window_selecte
- #更新武器强化素材需求和强化效果的窗口
- @window_strengthen_detail.refresh(@window_weapon_selecte.index, true)
- else
- Sound.play_buzzer
- end
- end
- if Input.trigger?(Input::Y)
- Sound.play_decision
- if @now_type == Weapon_Type
- @now_type = Armor_Type
- else
- @now_type = Weapon_Type
- end
- Nanaka_Equip_Strengthen.init(@now_type)
- create_weapon_strengthen_menu(@now_type)
- end
- end
- #--------------------------------------------------------------------------
- # ☆Scene_Equip_Strengthen★
- # 确认强化完成的窗口
- #--------------------------------------------------------------------------
- def call_determine_window
- @window_strengthen_success = Window_Base.new(0,0,384,56)
- @window_strengthen_success.x = (544 - @window_strengthen_success.width) / 2
- @window_strengthen_success.y = (416 - @window_strengthen_success.height) / 2
- @window_strengthen_success.contents.clear
- Audio.se_play("Audio/SE/1",80)
- @window_strengthen_success.contents.font.color = @window_strengthen_success.system_color
- @window_strengthen_success.contents.draw_text(0,0,360,24,Nanaka_Equip_Strengthen::Msg_Strengthen_Complete,1)
- Graphics.wait(120)
- @window_strengthen_success.dispose
- end
- #--------------------------------------------------------------------------
- # ☆Scene_Equip_Strengthen★
- # 结束处理
- #--------------------------------------------------------------------------
- def terminate
- @window_weapon_selecte.dispose
- @window_strengthen_detail.dispose
- @help_window.dispose
- if @background_sprite != nil
- @background_sprite.bitmap.dispose
- @background_sprite.dispose
- end
- end
-
- end
- #==============================================================================
- # ■ Window_Weapon_Selecte
- #------------------------------------------------------------------------------
- # 武器强化菜单栏目的窗口
- #==============================================================================
- class Window_Weapon_Selecte < Window_Command
- #--------------------------------------------------------------------------
- # ☆Window_Weapon_Selecte★
- # 描画物品图标及说明
- #--------------------------------------------------------------------------
- def draw_item(index, enabled = true)
- rect = item_rect(index)
- rect.x += 4
- rect.width -= 8
- icon_index = 0
- self.contents.clear_rect(rect)
- if Nanaka_Equip_Strengthen::Equip_Icon_List[index] != nil
- icon_index = Nanaka_Equip_Strengthen::Equip_Icon_List[index]
- end
-
- if icon_index != 0
- rect.x -= 4
- draw_icon(icon_index, rect.x, rect.y, enabled)
- rect.x += 26
- rect.width -= 20
- end
- self.contents.clear_rect(rect)
- self.contents.font.color = normal_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(rect, @commands[index])
- end
- #--------------------------------------------------------------------------
- # ☆Window_Weapon_Selecte★
- # 光标下移
- #--------------------------------------------------------------------------
- def cursor_down(wrap = false)
- if @index < @item_max - 1 or wrap
- @index = (@index + 1) % @item_max
- end
- end
- #--------------------------------------------------------------------------
- # ☆Window_Weapon_Selecte★
- # 光标上移
- #--------------------------------------------------------------------------
- def cursor_up(wrap = false)
- if @index > 0 or wrap
- @index = (@index - 1 + @item_max) % @item_max
- end
- end
- end
- #==============================================================================
- # ■ Window_Strengthen_Detail
- #------------------------------------------------------------------------------
- # 武器强化素材需求和强化效果的显示窗口
- #==============================================================================
- class Window_Strengthen_Detail < Window_Base
- include Nanaka_Equip_Strengthen
- #--------------------------------------------------------------------------
- # ☆Window_Strengthen_Detail★
- # 初始化
- #--------------------------------------------------------------------------
- def initialize(type)
- super(160, 56, 384, 360)
- @index = -1
- @type = type
- end
- #--------------------------------------------------------------------------
- # ☆Window_Strengthen_Detail★
- # 刷新
- #--------------------------------------------------------------------------
- def refresh(index, update_flag = false)
- if @index != index or update_flag
- equip_name = Equip_Name_List[index]
- if @type == Weapon_Type
- equip_level = $weapons_level[$data_weapons[Equip_Index_List[index]].id]
- else
- equip_level = $armors_level[$data_armors[Equip_Index_List[index]].id]
- end
- equip_level = 0 if equip_level == nil
- draw_material_text(equip_name,equip_level, @type)
- draw_strengthen_effect(equip_name, equip_level, @type)
- @index = index
- end
- end
- #--------------------------------------------------------------------------
- # ☆Window_Strengthen_Detail★
- # 描画素材需求说明
- #--------------------------------------------------------------------------
- def draw_material_text(equip_name, equip_level, type)
- equip_hash = Equip_Material_List[equip_name]
- self.contents.clear
- #当武器无法强化时的说明生成
- if equip_hash == nil
- width = self.width / 2 + self.x
- height = self.height / 2 + 56
- self.contents.font.color = system_color
- self.contents.draw_text(96, 36, width , height, Msg_Weapon_Disable) if type == Weapon_Type
- self.contents.draw_text(96, 36, width , height, Msg_Armor_Disable) if type == Armor_Type
- #当武器已经强化到满级时
- elsif equip_level == equip_hash[3]
- width = self.width / 2 + self.x
- height = self.height / 2 + 56
- self.contents.font.color = system_color
- self.contents.draw_text(72, 36, width , height, Msg_Weapon_Max_Level) if type == Weapon_Type
- self.contents.draw_text(72, 36, width , height, Msg_Armor_Max_Level) if type == Armor_Type
- #当武器可以强化时的说明生成
- else
- self.contents.font.color = system_color
- self.contents.draw_text(132, 24, 120, 24, Msg_Material)
- total_amount = equip_hash[0][equip_level]
- equip_material_array = equip_hash[1][equip_level]
- material_amount_array = equip_hash[2][equip_level]
- @x_coordinate = 0
- @y_coordinate = 56
- for i in 0...total_amount
- equip_material_index = equip_material_array[i]
- equip_material = $data_items[equip_material_index]
- material_amount = material_amount_array[i]
- string = ":" + "#{material_amount}"
- self.draw_item_name(equip_material, @x_coordinate, @y_coordinate)
- self.contents.font.color = normal_color
- self.contents.draw_text(140 + @x_coordinate, @y_coordinate, 120, 24, string, 0)
- @x_coordinate += 180
- @y_coordinate += 32 if @x_coordinate > 180
- @x_coordinate = 0 if @x_coordinate > 180
- end
- @y_coordinate += 32 if total_amount % 2
- @y_coordinate = 200 if @y_coordinate > 200
- end
- end
- #--------------------------------------------------------------------------
- # ☆Window_Strengthen_Detail★
- # 描画物品名称
- #--------------------------------------------------------------------------
- def draw_item_name(item, x, y, enabled = true)
- if item != nil
- draw_icon(item.icon_index, x, y, enabled)
- self.contents.font.color = system_color
- self.contents.font.color.alpha = enabled ? 255 : 128
- self.contents.draw_text(x + 24, y, 120, WLH, item.name)
- end
- end
-
- #--------------------------------------------------------------------------
- # ☆Window_Strengthen_Detail★
- # 描画强化效果说明
- #--------------------------------------------------------------------------
- def draw_strengthen_effect(equip_name, equip_level, type)
- #获取素材强化列表
- equip_hash = Strengthen_Effect_List[equip_name]
- return if equip_hash == nil
- #获取武器最大等级
- equip_max_level = Equip_Material_List[equip_name][3]
- return if equip_level == equip_max_level
- self.contents.font.color = system_color
- #绘制强化效果标题文字
- self.contents.draw_text(132, @y_coordinate, 120, 24, Msg_Effect)
- @y_coordinate += 32
- @x_coordinate = 0
- #获取强化效果数组
- effect_value = []
- for array in equip_hash
- effect_value.push(array[equip_level])
- end
- #绘制强化效果说明
- for index in 0...effect_value.size
- value = effect_value[index]
- value_text = " 0"
- value_text = " +" + "#{value}" if value > 0
- value_text = " " + "#{value}" if value < 0
- if index == 4
- state = $data_states[value]
- value_text = " 无"
- value_text = "#{state.name}" if state != nil
- end
- if index == 5
- elem_text = $data_system.elements[value]
- value_text = "不变"
- value_text = elem_text if elem_text != ""
- end
- self.contents.font.color = system_color
- if type == Weapon_Type
- self.contents.draw_text(@x_coordinate + 24, @y_coordinate, 120, 24, Msg_Weapon_Effect_Text[index])
- else
- self.contents.draw_text(@x_coordinate + 24, @y_coordinate, 120, 24, Msg_Armor_Effect_Text[index])
- end
- self.contents.font.color = normal_color
- self.contents.draw_text(@x_coordinate + 72, @y_coordinate, 120, 24, value_text)
- @x_coordinate += 180
- @y_coordinate += 32 if @x_coordinate > 180
- @x_coordinate = 0 if @x_coordinate > 180
- end
- end
- end
- class Scene_Title < Scene_Base
- alias nanaka_create_game_objects create_game_objects
- def create_game_objects
- nanaka_create_game_objects
- $weapons_level = []
- $armors_level = []
- end
- end
- class Scene_File < Scene_Base
- alias nanaka_read_save_data read_save_data
- alias nanaka_write_save_data write_save_data
- def write_save_data(file)
- nanaka_write_save_data(file)
- Marshal.dump($weapons_level, file)
- Marshal.dump($armors_level, file)
- end
- def read_save_data(file)
- nanaka_read_save_data(file)
- $weapons_level = Marshal.load(file)
- $armors_level = Marshal.load(file)
- load_equip_strengthen_data
- end
-
- def load_equip_strengthen_data
- length = [$weapons_level.length,$armors_level.length].max
- for index in 0...length
- weapon_level = $weapons_level[index]
- armor_level = $armors_level[index]
- weapon_level = 0 if weapon_level == nil
- armor_level = 0 if armor_level == nil
- weapon = $data_weapons[index]
- armor = $data_armors[index]
- for level in 0...weapon_level
- weapon_effect_hash = Nanaka_Equip_Strengthen::Strengthen_Effect_List[weapon.name]
- effect_value = []
- for array in weapon_effect_hash
- effect_value.push(array[level])
- end
- weapon.atk += effect_value[0]
- weapon.def += effect_value[1]
- weapon.agi += effect_value[2]
- weapon.spi += effect_value[3]
- weapon.state_set.push(effect_value[4]) if effect_value[4] != 0
- if effect_value[5] != 0
- weapon.element_set.clear
- weapon.element_set.push(effect_value[5])
- end
- end
- for level in 0...armor_level
- armor_effect_hash = Nanaka_Equip_Strengthen::Strengthen_Effect_List[armor.name]
- effect_value = []
- for array in armor_effect_hash
- effect_value.push(array[level])
- end
- armor.atk += effect_value[0]
- armor.def += effect_value[1]
- armor.agi += effect_value[2]
- armor.spi += effect_value[3]
- armor.state_set.push(effect_value[4]) if effect_value[4] != 0
- armor.element_set.push(effect_value[5]) if effect_value[5] != 0
- end
- end
- end
-
- end
- #======================================================================
- # Equip_Strengthen by Nanaka
- #======================================================================
复制代码 在217行处找到以下脚本- #武器只存在一种属性
- if effect_value[5] != 0
- equip.element_set.clear if type == Weapon_Type
- equip.element_set.push(effect_value[5])
- end
- if type == Weapon_Type
- $weapons_level[equip.id] = equip_level + 1
- else
- $armors_level[equip.id] = equip_level + 1
- end
复制代码 更改成下面内容- #武器只存在一种属性
- equip.element_set.push(effect_value[5]) if effect_value[5] != 0
- if type == Weapon_Type
- $weapons_level[equip.id] = equip_level + 1
- else
- $armors_level[equip.id] = equip_level + 1
- end
复制代码 就可以了 Orz...
6r的高手们 顺便能请教一下 能将这个脚本武器跟防具的附加状态
修改成强化后装备可直接获得该状态效果吗ˊˋ
例如 "短剑"的强化后附加状态 为 "攻击力上升" 变成装备后就直接获得"攻击力上升"的效果
最好是能设定成敌方无效= =" 感恩先.. |
|