Advertisement
Scinaya

On Map Party Shift By Shanghai

Apr 28th, 2011
922
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.35 KB | None | 0 0
  1. #===============================================================================
  2. #
  3. # Shanghai Simple Script - On-Map Party Shift
  4. # Last Date Updated: 2010.05.11
  5. # Level: Normal
  6. #
  7. # Press the L or R buttons (Q and W respectively for keyboard) to switch out
  8. # who is the lead member. Switches with the next member.
  9. #===============================================================================
  10. # Instructions
  11. # -----------------------------------------------------------------------------
  12. # To install this script, open up your script editor and copy/paste this script
  13. # to an open slot below ▼ Materials but above ▼ Main. Remember to save.
  14. #
  15. # If you want to prevent actor shifting, make a script call event and insert:
  16. #   $game_system.prevent_actor_shift = true
  17. #   $game_system.prevent_actor_shift = false
  18. # How true and false works is self explanatory.
  19. #===============================================================================
  20.  
  21. $imported = {} if $imported == nil
  22. $imported["On-MapPartyShift"] = true
  23.  
  24. #==============================================================================
  25. # ** Game_System
  26. #==============================================================================
  27.  
  28. class Game_System
  29.   #--------------------------------------------------------------------------
  30.   # * Public Instance Variables
  31.   #--------------------------------------------------------------------------
  32.   attr_accessor :prevent_actor_shift
  33. end
  34.  
  35. #==============================================================================
  36. # ** Game_Party
  37. #==============================================================================
  38.  
  39. class Game_Party < Game_Unit
  40.   #--------------------------------------------------------------------------
  41.   # * Swap Actor
  42.   #--------------------------------------------------------------------------
  43.   def swap_actor(reverse = false)
  44.     if reverse
  45.       swap_actor = @actors.pop
  46.       @actors.insert(0, swap_actor)
  47.     else
  48.       swap_actor = @actors.shift
  49.       @actors.push(swap_actor)
  50.     end
  51.   end
  52. end
  53.  
  54. #==============================================================================
  55. # ** Scene_Map
  56. #==============================================================================
  57.  
  58. class Scene_Map < Scene_Base
  59.   #--------------------------------------------------------------------------
  60.   # * Frame Update
  61.   #--------------------------------------------------------------------------
  62.   alias update_sss_on_map_party_shift update unless $@
  63.   def update
  64.     update_sss_on_map_party_shift
  65.     unless $game_map.interpreter.running? or $game_message.visible
  66.       update_on_map_party_shift
  67.     end
  68.   end
  69.   #--------------------------------------------------------------------------
  70.   # * Update On-Map Party Shift
  71.   #--------------------------------------------------------------------------
  72.   def update_on_map_party_shift
  73.     return if $game_party.members.size < 2
  74.     return if $game_system.prevent_actor_shift
  75.     if Input.trigger?(Input::L)
  76.       $game_party.swap_actor(true)
  77.       $game_player.refresh
  78.     elsif Input.trigger?(Input::R)
  79.       $game_party.swap_actor(false)
  80.       $game_player.refresh
  81.     end
  82.   end
  83. end
  84.  
  85. #===============================================================================
  86. #
  87. # END OF FILE
  88. #
  89. #===============================================================================
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement