Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Shanghai Simple Script - Weapon Attack Replace
- # Last Date Updated: 2010.05.30
- # Level: Normal
- #
- # If an actor's weapons contain skills and the actor attacks, the actor will use
- # that skill instead as a replacement for the regular attack. Makes things like
- # Fire Wands actually cast fire.
- #===============================================================================
- # Instructions
- # -----------------------------------------------------------------------------
- # To install this script, open up your script editor and copy/paste this script
- # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
- #
- # <attack skill: x>
- # <attack skill: x, x, x>
- # This belongs in a weapon's notebox. x is the skill ID use for what skill will
- # replace the regular attack when the actor attacks with the weapon. If more
- # than one tag is used or the multiple x tag is used, then the regular attack
- # will choose randomly which of the skills to use.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["WeaponAttackReplace"] = true
- #==============================================================================
- # RPG::Weapon
- #==============================================================================
- class RPG::Weapon < RPG::BaseItem
- #--------------------------------------------------------------------------
- # # Attack Skills
- #--------------------------------------------------------------------------
- def attack_skills
- return @attack_skills if @attack_skills != nil
- @attack_skills = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:ATTACK_SKILL|attack skill):[ ](\d+(?:\s*,\s*\d+)*)>/i
- $1.scan(/\d+/).each { |num| @attack_skills.push(num.to_i) }
- end
- }
- return @attack_skills
- end
- end
- #==============================================================================
- # ** Game_Actor
- #==============================================================================
- class Game_Actor < Game_Battler
- #--------------------------------------------------------------------------
- # * Attack Skills
- #--------------------------------------------------------------------------
- def attack_skills
- n = []
- for weapon in weapons.compact do n += weapon.attack_skills end
- return n
- end
- end
- #==============================================================================
- # ** Scene_Battle
- #==============================================================================
- class Scene_Battle < Scene_Base
- #--------------------------------------------------------------------------
- # * Execute Battle Action: Attack
- #--------------------------------------------------------------------------
- alias execute_action_attack_sss_weapon_replace execute_action_attack unless $@
- def execute_action_attack
- if @active_battler.actor? and not @active_battler.attack_skills.empty?
- attack_skills = @active_battler.attack_skills
- skill_id = attack_skills[rand(attack_skills.size)]
- @active_battler.action.set_skill(skill_id)
- execute_action_skill
- else
- execute_action_attack_sss_weapon_replace
- end
- end
- end
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement