Double Weapons Script é um script para o RPG Maker XP feito por makeamidget.
Basicamente, ele permite o herói usar duas armas, uma em cada mão, ao invés do escudo. Ele fica com Left Hand (Mão Esquerda) e Right Hand (Mão Direita).
Vemos este tipo de ataque (duas mãos, two-handed) em vários RPGs, como por exemplo Might And Magic VI, depois que você consegue o Sword Master com algum herói seu.
Para instalar o script, basta copiar e colar o código abaixo em cima do “Main”:
#================================= # Double Weapons Script by makeamidget #================================= # credit to Clock, who found an error, go Clock #================================= #================================= # changes to class Game_Actor # i'll try to expain the changes when i make them #================================= class Game_Actor < Game_Battler def animation3_id weapon = $data_weapons[@armor1_id] return weapon != nil ? weapon.animation1_id : 0 end #-------------------------------------------------------------------------- # ● 通常攻撃 対象側アニメーション ID の取得 #-------------------------------------------------------------------------- def animation4_id weapon = $data_weapons[@armor1_id] return (weapon != nil ? weapon.animation2_id : 0) end def base_str #took out the armor1 addition to the base_str n = $data_actors[@actor_id].parameters[2, @level] weapon = $data_weapons[@weapon_id] armor2 = $data_armors[@armor2_id] armor3 = $data_armors[@armor3_id] armor4 = $data_armors[@armor4_id] n += weapon != nil ? weapon.str_plus : 0 n += armor2 != nil ? armor2.str_plus : 0 n += armor3 != nil ? armor3.str_plus : 0 n += armor4 != nil ? armor4.str_plus : 0 return [[n, 1].max, 999].min end #-------------------------------------------------------------------------- # ● 基本攻撃力の取得 #-------------------------------------------------------------------------- def base_atk #now instead of adding to the strength, the strength stat of armor1 #add to the base_atk(attack power) armor1 = $data_armors[@armor1_id] weapon = $data_weapons[@weapon_id] atk1 = armor1 != nil ? armor1.str_plus : 0 atk2 = weapon !=nil ? weapon.atk : 0 return atk1 + atk2 end #this is to hard for me to explain, but it works as far as i can see def equip(equip_type, id, sechand = "none") @sechand = sechand 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 # 盾 #beginning of crap i added case @sechand when true if @armor1_id == 0 and ($data_armors[id].guard_state_set[0].id == 35) $two_weapons[@actor_id] = true $game_party.gain_weapon(@armor1_id, 1) @armor1_id = id $game_party.lose_weapon(id, 1) return end if ($data_armors[@armor1_id].guard_state_set[0].id == 35) and ($data_armors[id].guard_state_set[0].id == 35) $two_weapons[@actor_id] = true $game_party.gain_weapon(@armor1_id, 1) @armor1_id = id $game_party.lose_weapon(id, 1) return elsif ($data_armors[@armor1_id].guard_state_set[0].id != 35) and ($data_armors[id].guard_state_set[0].id == 35) $two_weapons[@actor_id] = true $game_party.gain_armor(@armor1_id, 1) @armor1_id = id $game_party.lose_weapon(id, 1) return end when false if @armor1_id == 0 and id == 0 return end if @armor1_id == 0 and ($data_armors[id].guard_state_set[0].id != 35) $two_weapons[@actor_id] = false $game_party.gain_armor(@armor1_id, 1) @armor1_id = id $game_party.lose_armor(id, 1) return end if ($data_armors[@armor1_id].guard_state_set[0].id == 35) and (id == 0) $two_weapons[@actor_id] = false $game_party.gain_weapon(@armor1_id, 1) @armor1_id = id $game_party.lose_armor(id, 1) return end if ($data_armors[@armor1_id].guard_state_set[0].id == 35) and ($data_armors[id].guard_state_set[0].id != 35) $two_weapons[@actor_id] = false $game_party.gain_weapon(@armor1_id, 1) @armor1_id = id $game_party.lose_armor(id, 1) return elsif id == 0 $two_weapons[@actor_id] = false 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) return else $two_weapons[@actor_id] = false 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) return end end#end case #end of crap i added 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 end end end #================================= # end of class Game_Actor changes #================================= #================================= # changes to Window_EquipItem, displays the weapons # in the shield selection #================================= class Window_EquipItem < Window_Selectable #-------------------------------------------------------------------------- # ● オブジェクト初期化 # actor : アクター # equip_type : 装備部位 (0~3) #-------------------------------------------------------------------------- def initialize(actor, equip_type) super(0, 256, 640, 224) @actor = actor @equip_type = equip_type @column_max = 2 refresh self.active = false self.index = -1 end #-------------------------------------------------------------------------- # ● アイテムの取得 #-------------------------------------------------------------------------- def item return @data[self.index] end #-------------------------------------------------------------------------- # ● リフレッシュ #-------------------------------------------------------------------------- def refresh if self.contents != nil self.contents.dispose self.contents = nil end @data = [] # 装備可能な武器を追加 if @equip_type == 0 weapon_set = $data_classes[@actor.class_id].weapon_set for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) @data.push($data_weapons[i]) end end end # 装備可能な防具を追加 if @equip_type != 0 armor_set = $data_classes[@actor.class_id].armor_set #this is to display the weapons in the shield equip weapon_set = $data_classes[@actor.class_id].weapon_set if @equip_type == 1 for i in 1...$data_weapons.size if $game_party.weapon_number(i) > 0 and weapon_set.include?(i) @data.push($data_armors[i]) end end end #end of weapon display for i in 1...$data_armors.size if $game_party.armor_number(i) > 0 and armor_set.include?(i) if $data_armors[i].kind == @equip_type-1 @data.push($data_armors[i]) end end end end # 空白を追加 @data.push(nil) # ビットマップを作成し、全項目を描画 @item_max = @data.size self.contents = Bitmap.new(width - 32, row_max * 32) self.contents.font.name = $defaultfonttype # "Equip" bottom (Item List) window font self.contents.font.size = $defaultfontsize for i in 0...@item_max-1 draw_item(i) end end #-------------------------------------------------------------------------- # ● 項目の描画 # index : 項目番号 #-------------------------------------------------------------------------- def draw_item(index) item = @data[index] x = 4 + index % 2 * (288 + 32) y = index / 2 * 32 case item when RPG::Weapon number = $game_party.weapon_number(item.id) when RPG::Armor #so you get the number of weapons for the left hand if item.guard_state_set[0].id == 35 number = $game_party.weapon_number(item.id) #end of weapon number else number = $game_party.armor_number(item.id) end end bitmap = RPG::Cache.icon(item.icon_name) self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24)) self.contents.font.color = normal_color self.contents.draw_text(x + 28, y, 212, 32, item.name, 0) self.contents.draw_text(x + 240, y, 16, 32, ":", 1) self.contents.draw_text(x + 256, y, 24, 32, number.to_s, 2) end end #================================= # end of changes to Window_EquipItem #================================= #================================= # Changes to Scene_Equip #================================= class Scene_Equip def refresh # アイテムウィンドウの可視状態設定 @item_window1.visible = (@right_window.index == 0) @item_window2.visible = (@right_window.index == 1) @item_window3.visible = (@right_window.index == 2) @item_window4.visible = (@right_window.index == 3) @item_window5.visible = (@right_window.index == 4) # 現在装備中のアイテムを取得 item1 = @right_window.item # 現在のアイテムウィンドウを @item_window に設定 case @right_window.index when 0 @item_window = @item_window1 when 1 @item_window = @item_window2 when 2 @item_window = @item_window3 when 3 @item_window = @item_window4 when 4 @item_window = @item_window5 end # ライトウィンドウがアクティブの場合 if @right_window.active # 装備変更後のパラメータを消去 @left_window.set_new_parameters(nil, nil, nil) end # アイテムウィンドウがアクティブの場合 if @item_window.active # 現在選択中のアイテムを取得 item2 = @item_window.item # 装備を変更 last_hp = @actor.hp last_sp = @actor.sp if item2.type == RPG::Armor if item2.guard_state_set[0].id == 35 @actor.equip (@right_window.index,item2 == nil ? 0 : item2.id, true) else @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id, false) end elsif @right_window.index == 1 and item2 == nil @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id, false) else @actor.equip(@right_window.index, item2 == nil ? 0 : item2.id, "none") end # 装備変更後のパラメータを取得 new_atk = @actor.atk new_pdef = @actor.pdef new_mdef = @actor.mdef # 装備を戻す if item1.type == RPG::Armor if item1.guard_state_set[0].id == 35 @actor.equip (@right_window.index,item1 == nil ? 0 : item1.id, true) else @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id, false) end elsif @right_window.index == 1 and item1 == nil @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id, false) else @actor.equip(@right_window.index, item1 == nil ? 0 : item1.id, "none") end @actor.hp = last_hp @actor.sp = last_sp # レフトウィンドウに描画 @left_window.set_new_parameters(new_atk, new_pdef, new_mdef) end end def update_item # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # ライトウィンドウをアクティブ化 @right_window.active = true @item_window.active = false @item_window.index = -1 return end # C ボタンが押された場合 if Input.trigger?(Input::C) # 装備 SE を演奏 $game_system.se_play($data_system.equip_se) # アイテムウィンドウで現在選択されているデータを取得 item = @item_window.item if item.type == RPG::Armor if item.guard_state_set[0].id == 35 @actor.equip (@right_window.index,item == nil ? 0 : item.id, true) else @actor.equip(@right_window.index, item == nil ? 0 : item.id, false) end elsif @right_window.index == 1 and item == nil @actor.equip(@right_window.index, item == nil ? 0 : item.id, false) else @actor.equip(@right_window.index, item == nil ? 0 : item.id, "none") end # ライトウィンドウをアクティブ化 @right_window.active = true @item_window.active = false @item_window.index = -1 # ライトウィンドウ、アイテムウィンドウの内容を再作成 @right_window.refresh @item_window2.refresh @item_window1.refresh @item_window.refresh return end end end #================================= # end of changes to Scene_Equip #================================= #================================= # Changes to Window_EquipRight #================================= class Window_EquipRight < Window_Selectable def refresh self.contents.clear @data = [] @data.push($data_weapons[@actor.weapon_id]) @data.push($data_armors[@actor.armor1_id]) @data.push($data_armors[@actor.armor2_id]) @data.push($data_armors[@actor.armor3_id]) @data.push($data_armors[@actor.armor4_id]) @item_max = @data.size self.contents.font.color = system_color #makes it say right hand, left hand, instead of weapon, shield self.contents.draw_text(4, 32 * 0, 92, 32, "Right Hand") self.contents.draw_text(4, 32 * 1, 92, 32, "Left Hand") #end of above self.contents.draw_text(4, 32 * 2, 92, 32, $data_system.words.armor2) self.contents.draw_text(4, 32 * 3, 92, 32, $data_system.words.armor3) self.contents.draw_text(5, 32 * 4, 92, 32, $data_system.words.armor4) draw_item_name(@data[0], 92, 32 * 0) draw_item_name(@data[1], 92, 32 * 1) draw_item_name(@data[2], 92, 32 * 2) draw_item_name(@data[3], 92, 32 * 3) draw_item_name(@data[4], 92, 32 * 4) end end #================================= # end of changes to Window_EquipRight #================================= #================================= # Changes to Scene_Battle #================================= class Scene_Battle def update_phase3_basic_command # B ボタンが押された場合 if Input.trigger?(Input::B) # キャンセル SE を演奏 $game_system.se_play($data_system.cancel_se) # 前のアクターのコマンド入力へ phase3_prior_actor return end # C ボタンが押された場合 if Input.trigger?(Input::C) # アクターコマンドウィンドウのカーソル位置で分岐 case @actor_command_window.index when 0 # 攻撃 if $two_weapons[@active_battler.id] == true $game_system.se_play($data_system.decision_se) @active_battler.current_action.kind = 0 @active_battler.current_action.basic = 4 start_enemy_select else # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アクションを設定 @active_battler.current_action.kind = 0 @active_battler.current_action.basic = 0 # エネミーの選択を開始 start_enemy_select end when 1 # スキル # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アクションを設定 @active_battler.current_action.kind = 1 # スキルの選択を開始 start_skill_select when 2 # 防御 # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アクションを設定 @active_battler.current_action.kind = 0 @active_battler.current_action.basic = 1 # 次のアクターのコマンド入力へ phase3_next_actor when 3 # アイテム # 決定 SE を演奏 $game_system.se_play($data_system.decision_se) # アクションを設定 @active_battler.current_action.kind = 2 # アイテムの選択を開始 start_item_select end return end end def make_basic_action_result # 攻撃の場合 if @active_battler.current_action.basic == 0 # アニメーション ID を設定 @animation1_id = @active_battler.animation1_id @animation2_id = @active_battler.animation2_id # 行動側バトラーがエネミーの場合 if @active_battler.is_a?(Game_Enemy) if @active_battler.restriction == 3 target = $game_troop.random_target_enemy elsif @active_battler.restriction == 2 target = $game_party.random_target_actor else index = @active_battler.current_action.target_index target = $game_party.smooth_target_actor(index) end end # 行動側バトラーがアクターの場合 if @active_battler.is_a?(Game_Actor) if @active_battler.restriction == 3 target = $game_party.random_target_actor elsif @active_battler.restriction == 2 target = $game_troop.random_target_enemy else index = @active_battler.current_action.target_index target = $game_troop.smooth_target_enemy(index) end end # 対象側バトラーの配列を設定 @target_battlers = [target] # 通常攻撃の効果を適用 for target in @target_battlers target.attack_effect(@active_battler) end return end # 防御の場合 if @active_battler.current_action.basic == 1 # ヘルプウィンドウに "防御" を表示 @help_window.set_text($data_system.words.guard, 1) return end # 逃げるの場合 if @active_battler.is_a?(Game_Enemy) and @active_battler.current_action.basic == 2 # ヘルプウィンドウに "逃げる" を表示 @help_window.set_text("逃げる", 1) # 逃げる @active_battler.escape return end # 何もしないの場合 if @active_battler.current_action.basic == 3 # アクション強制対象のバトラーをクリア $game_temp.forcing_battler = nil # ステップ 1 に移行 @phase4_step = 1 return end #add if @active_battler.current_action.basic == 4 @new = nil @sec_attack = nil @animation1_id = @active_battler.animation1_id @animation2_id = @active_battler.animation2_id @animation3_id = @active_battler.animation3_id @animation4_id = @active_battler.animation4_id if @active_battler.is_a?(Game_Actor) if @active_battler.restriction == 3 target = $game_party.random_target_actor elsif @active_battler.restriction == 2 target = $game_troop.random_target_enemy else index = @active_battler.current_action.target_index target = $game_troop.smooth_target_enemy(index) end end # 対象側バトラーの配列を設定 @target_battlers = [target] # 通常攻撃の効果を適用 for target in @target_battlers target.attack_effect(@active_battler) end return end #end add end def update_phase4_step4 # 対象側アニメーション #add if @active_battler.is_a?(Game_Actor) if $two_weapons[@active_battler.id] == true && @new != nil && @sec_attack == 0 for target in @target_battlers target.animation_id = @animation4_id target.animation_hit = (target.damage != "Miss") @phase4_step = 5 return end end end #end add for target in @target_battlers target.animation_id = @animation2_id target.animation_hit = (target.damage != "Miss") end # アニメーションの長さにかかわらず、最低 8 フレーム待つ @wait_count = 8 # ステップ 5 に移行 @phase4_step = 5 end def update_phase4_step5 # ヘルプウィンドウを隠す @help_window.visible = false # ステータスウィンドウをリフレッシュ @status_window.refresh # ダメージ表示 #add if @active_battler.is_a?(Game_Actor) if $two_weapons[@active_battler.id] == true && @sec_attack == nil @sec_attack = 0 @new = 1 @phase4_step = 3 return end end #end add for target in @target_battlers if target.damage != nil target.damage_pop = true end end # ステップ 6 に移行 @phase4_step = 6 end end #================================= # end of changes to Scene_Battle #================================= #================================= # Changes to Scene_Title #================================= class Scene_Title alias two_weapons_start command_new_game def command_new_game two_weapons_start $two_weapons = [] for i in 1...$data_actors.size $two_weapons[i] = false end end end #================================= # end of changes to Scene_Title #================================= #================================= # Changes to Scene_Save #================================= class Scene_Save alias two_weapons_write_save_data write_save_data def write_save_data(file) two_weapons_write_save_data(file) Marshal.dump($two_weapons, file) end end #================================= # end of changes to Scene_Save #================================= #================================= # Changes to Scene_Load #================================= class Scene_Load < Scene_File alias two_weapons_read_save_data read_save_data def read_save_data(file) two_weapons_read_save_data(file) $two_weapons = Marshal.load(file) end end #================================== # end of changes to Scene_Load #==================================
Observação: se você gostou deste post ou ele lhe foi útil de alguma forma, por favor considere apoiar financeiramente a Gaming Room. Fico feliz só de ajudar, mas a contribuição do visitante é muito importante para que este site continua existindo e para que eu possa continuar provendo este tipo de conteúdo e melhorar cada vez mais. Acesse aqui e saiba como. Obrigado!