Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #================================================= ==============================
- #
- # Shanghai Simple Script - Enemy Linked Deaths
- # Last Date Updated: 2010.06.12
- # Level: Normal
- #
- # Sometimes you have a hand or foot or some other random body part as a part of
- # a larger monster. However, should that larger monster die, the other body
- # parts will remain until they're killed off, too. This script allows you to
- # link an enemy's death with another's.
- #================================================= ==============================
- # 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.
- #
- # <linked death: x>
- # <linked death: x, x, x>
- # Place this in an enemy's notebox. When this enemy dies, all enemies in the
- # party with the x ID links are killed along with the central enemy.
- #
- # <linked death all>
- # Place this in an enemy's notebox. When this enemy dies, all enemies in the
- # party are dead, linked or not.
- #================================================= ==============================
- $imported = {} if $imported == nil
- $imported["EnemyLinkedDeaths"] = true
- #================================================= =============================
- # RPG::Enemy
- #================================================= =============================
- class RPG::Enemy
- #--------------------------------------------------------------------------
- # linked_death
- #--------------------------------------------------------------------------
- def linked_death
- return @linked_death if @linked_death != nil
- @linked_death = []
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:LINKED DEATH|link death):[ ](\d+(?:\s*,\s*\d+)*)>/i
- $1.scan(/\d+/).each { |num|
- @linked_death.push(num.to_i) if num.to_i > 0 }
- end
- }
- return @linked_death
- end
- #--------------------------------------------------------------------------
- # linked_death_all
- #--------------------------------------------------------------------------
- def linked_death_all
- return @linked_death_all if @linked_death_all != nil
- @linked_death_all = false
- self.note.split(/[\r\n]+/).each { |line|
- case line
- when /<(?:LINKED DEATH ALL|link death everything)>/i
- @linked_death_all = true
- end
- }
- return @linked_death_all
- end
- end
- #================================================= =============================
- # ** Game_Enemy
- #================================================= =============================
- class Game_Enemy < Game_Battler
- #--------------------------------------------------------------------------
- # * Perform Collapse
- #--------------------------------------------------------------------------
- alias perform_collapse_sss_enemy_linked_deaths perform_collapse unless $@
- def perform_collapse
- perform_collapse_sss_enemy_linked_deaths
- perform_linked_deaths if $game_temp.in_battle and dead?
- end
- #--------------------------------------------------------------------------
- # * Perform Linked Deaths
- #--------------------------------------------------------------------------
- def perform_linked_deaths
- unless enemy.linked_death.empty?
- for member in $game_troop.existing_members
- next unless enemy.linked_death.include?(member.enemy_id)
- member.add_state(1)
- member.perform_collapse
- end
- end
- if enemy.linked_death_all
- for member in $game_troop.existing_members
- member.add_state(1)
- member.perform_collapse
- end
- end
- end
- end
- #================================================= ==============================
- #
- # END OF FILE
- #
- #================================================= ==============================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement