Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #===============================================================================
- #
- # Shanghai Simple Script - Enemy Autostates
- # Last Date Updated: 2010.05.06
- # Level: Normal
- #
- # To make enemies start out with an autostate that never leaves, use this. It
- # will make the state present for that enemy at the start of battle and cannot
- # be removed.
- #===============================================================================
- # 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.
- #
- # <autostate: x>
- # <autostates: x, x, x>
- # Place this tag into the enemy's notebox. It will have state x on all the time.
- #===============================================================================
- $imported = {} if $imported == nil
- $imported["EnemyAutostates"] = true
- #==============================================================================
- # RPG::Enemy
- #==============================================================================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # autostates
- #--------------------------------------------------------------------------
- def autostates
- return @autostates if @autostates != nil
- @autostates = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:AUTOSTATE|autostates):[ ](\d+(?:\s*,\s*\d+)*)>/i
- $1.scan(/\d+/).each { |num|
- @autostates.push($data_states[num.to_i]) if num.to_i > 0 }
- end
- }
- return @autostates
- end
- end
- #==============================================================================
- # ** Game_Enemy
- #==============================================================================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * states
- #--------------------------------------------------------------------------
- def states
- st = super
- for state in enemy.autostates
- st.push(state) unless state.nil?
- end
- return st.uniq
- end
- end
- #===============================================================================
- #
- # END OF FILE
- #
- #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement