Advertisement
LiTTleDRAgo

[RGSS] XAS - Respawn Control

May 5th, 2013
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.10 KB | None | 0 0
  1. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  2. # XAS - Respawn Control
  3. # Version: 1.00
  4. # Author : LiTTleDRAgo
  5. #:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:
  6. #==============================================================================
  7. # ** Game_Map
  8. #------------------------------------------------------------------------------
  9. #  This class handles the map. It includes scrolling and passable determining
  10. #  functions. Refer to "$game_map" for the instance of this class.
  11. #==============================================================================
  12. class Game_Map
  13.  
  14.   RESPAWN_MAP_LIMIT = 3
  15.   # After go to other maps X times, enemies in the oldest map will respawn
  16.  
  17.   alias respawn_control_setup setup
  18.   def setup(*args)
  19.     respawn_control_setup(*args)
  20.     e = $game_temp.instance_variable_get(:@e3x504)
  21.     e = $game_temp.instance_variable_set(:@e3x504,Hash.new{|h,k|h[k]=[]}) if !e
  22.     @events.values.each {|event| event.erase if e[@map_id].include?(event.id)}
  23.     $game_temp.instance_variable_get(:@e3x504).shift if e.size>RESPAWN_MAP_LIMIT
  24.   end
  25. end
  26. #==============================================================================
  27. # ** Game_Event
  28. #------------------------------------------------------------------------------
  29. #  This class deals with events. It handles functions including event page
  30. #  switching via condition determinants, and running parallel process events.
  31. #  It's used within the Game_Map class.
  32. #==============================================================================
  33. class Game_Event < Game_Character
  34.   #--------------------------------------------------------------------------
  35.   # ● Defeated Effect  
  36.   #--------------------------------------------------------------------------
  37.   alias defeated_respawn_control_effect defeated_effect
  38.   def defeated_effect  
  39.     defeated_respawn_control_effect
  40.     return if !self.battler.is_a?(Game_Enemy)
  41.     unless self.tool_id > 0 or self.battler.e_item
  42.       $game_temp.instance_variable_get(:@e3x504)[$game_map.map_id] << @id
  43.     end
  44.   end
  45. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement