Advertisement
LiTTleDRAgo

[RGSS2] One Time Encounter

Mar 4th, 2012
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.99 KB | None | 0 0
  1. #==============================================================================
  2. # ** Scene_Map
  3. #------------------------------------------------------------------------------
  4. #  This class performs the map screen processing.
  5. #==============================================================================
  6.  
  7. class Scene_Map < Scene_Base
  8.   #--------------------------------------------------------------------------
  9.   # * Constants
  10.   #--------------------------------------------------------------------------
  11.   TROOP_ONETIME = {
  12.   #--------------------------------------------------------------------------
  13.   # Format :  ID Troop => [ID Pengganti, ID Pengganti, ....],
  14.   #--------------------------------------------------------------------------
  15.   1  => [2,3],                             # Bakalan dieksekusi secara random
  16.   49 => [50],
  17.   #--------------------------------------------------------------------------
  18.   # * Alias Listing
  19.   #--------------------------------------------------------------------------
  20.   }; alias troop_onetime update_encounter
  21.   #--------------------------------------------------------------------------
  22.   # * Encounter Processing
  23.   #--------------------------------------------------------------------------
  24.   def update_encounter
  25.     return if $game_player.encounter_count > 0          # Check steps
  26.     return if $game_map.interpreter.running?            # Event being executed?
  27.     return if $game_system.encounter_disabled           # Encounters forbidden?
  28.     troop_onetime                                       # Run Old Method
  29.     id = $game_player.make_encounter_troop_id           # Determine troop
  30.     return if $data_troops[id] == nil or TROOP_ONETIME[id] == nil
  31.     if $game_self_switches[['One Time Encounter',id]]   # Troop is invalid?
  32.       $game_troop.setup(TROOP_ONETIME[id][rand(TROOP_ONETIME[id].size)])
  33.       $game_troop.can_escape = true
  34.       preemptive_or_surprise
  35.     end
  36.     $game_self_switches[['One Time Encounter',id]] = true
  37.   end
  38. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement