Weapon Unleash
by Dargor
Version 1.2
by Dargor
Version 1.2
Introduction
This script is based on Golden Sun weapons special attacks. When you attack, there is a chance (in percent) that your weapon unleash a skill.
It now supports Two Swords Style.
Script
Please read the instructions in the script header.
Script
Show
- #==============================================================================
- # ** Weapon Unleash
- #------------------------------------------------------------------------------
- # © Dargor, 2008
- # 04/03/08
- # Version 1.1
- #------------------------------------------------------------------------------
- # INSTRUCTIONS:
- # - Edit the constants in the Weapon_Unleash module and enjoy!
- # VERSION HISTORY:
- # - 1.0 (02/03/08), Initial release
- # - 1.1 (04/03/08), Two Swords Style support has been added
- # - 1.2 (04/03/08), Display bug fixed with Battle Frenzy script
- #==============================================================================
- #==============================================================================
- # ** Weapon Unleash Configuration
- #==============================================================================
- module Weapon_Unleash
- # Weapons that can unleash a skill
- Weapons = [1,2,3]
- # The skill unleashed by weapon_id
- # SYNTAX: weapon_id => skill_id
- Skill = {
- 1 => 59,
- 2 => 82
- }
- # Default skill unleashedÂ
- Skill.default = 1
- # Chances in percent to unleash a skill
- # SYNTAX: weapon_id => percent
- Rate = {
- 1 => 100,
- 2 => 100
- }
- # Default rateÂ
- Rate.default = 25Â
- end
- # Text displayed in the battle text window when the skill is unleashed
- Vocab::WeaponUnleash = "%s's %s unleashed %s!"
- #==============================================================================
- # ** Game_Actor
- #------------------------------------------------------------------------------
- # This class handles actors. It's used within the Game_Actors class
- # ($game_actors) and referenced by the Game_Party class ($game_party).
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # * Get Normal Attack Animation ID
- #--------------------------------------------------------------------------
- def atk_animation_id
- if two_swords_style
- return weapons[0].animation_id if weapons[0] != nil
- return weapons[1] == nil ? 1 : 1
- else
- return weapons[0] == nil ? 1 : weapons[0].animation_id
- end
- end
- #--------------------------------------------------------------------------
- # * Get Normal Attack Animation ID (Dual Wield: Weapon 2)
- #--------------------------------------------------------------------------
- def atk_animation_id2
- if two_swords_style
- return weapons[1] == nil ? 1 : weapons[1].animation_id
- else
- return 1
- end
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #------------------------------------------------------------------------------
- # This class performs battle screen processing.
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Alias listing
- #--------------------------------------------------------------------------
- alias dargor_execute_action_attack execute_action_attack
- #--------------------------------------------------------------------------
- # * Execute Battle Action: Attack
- #--------------------------------------------------------------------------
- def execute_action_attack
- # Execute weapon unleash check
- if @active_battler.is_a?(Game_Actor)
- weapon = @active_battler.weapons[0]
- if weapon_can_unleash?(weapon)
- # Execute weapon unleash for weapon 1
- execute_action_weapon_unleash(weapon)
- else
- # Execute normal attack for weapon 1
- execute_specific_action_attack(1)
- end
- # If battler has two swords style
- if @active_battler.two_swords_style
- weapon = @active_battler.weapons[1]
- if weapon_can_unleash?(weapon)
- # Execute weapon unleash for weapon 2
- execute_action_weapon_unleash(weapon)
- else
- # Execute normal attack for weapon 2
- execute_specific_action_attack(2)
- end
- endÂ
- # Execute normal attack
- else
- dargor_execute_action_attack
- end
- end
- #--------------------------------------------------------------------------
- # * Execute Specific Battle Action: Attack
- # weapon : actor's weapon (1 or 2)
- #--------------------------------------------------------------------------
- def execute_specific_action_attack(weapon)
- if weapon == 1
- animation = @active_battler.atk_animation_id
- end
- if weapon == 2
- animation = @active_battler.atk_animation_id2
- end
- text = sprintf(Vocab::DoAttack, @active_battler.name)
- @message_window.add_instant_text(text)
- targets = @active_battler.action.make_targets
- display_normal_animation(targets, animation)
- wait(30)
- for target in targets
- target.attack_effect(@active_battler)
- display_action_effects(target)
- end
- end
- #--------------------------------------------------------------------------
- # * Execute Battle Action: Weapon Unleash
- #--------------------------------------------------------------------------
- def execute_action_weapon_unleash(weapon)
- skill = $data_skills[Weapon_Unleash::Skill[weapon.id]]
- skill = $data_skills[Weapon_Unleash::Skill.default] if skill.nil?
- weapon_name = weapon.name
- text = sprintf(Vocab::WeaponUnleash, @active_battler.name, weapon_name, skill.name)
- @message_window.add_instant_text(text)
- targets = @active_battler.action.make_targets
- display_animation(targets, skill.animation_id)
- for target in targets
- target.skill_effect(@active_battler, skill)
- display_action_effects(target, skill)
- @message_window.back_to(4)
- end
- end
- #--------------------------------------------------------------------------
- # * Weapon can unleash?
- #--------------------------------------------------------------------------
- def weapon_can_unleash?(weapon)
- return false if @active_battler.is_a?(Game_Enemy)
- return false unless Weapon_Unleash::Weapons.include?(weapon.id)
- rate = Weapon_Unleash::Rate[weapon.id]
- rate = Weapon_Unleash::Rate.default if rate.nil?
- random = rand(100)
- return random <= rate
- end
- end
Expand to see the code.
Notes
This is my first script for RMVX, I hope you'll enjoy it!
Don't forget to give me credit!
-Dargor