Archeia

Non-Combatant Party Member/Guest Party Member

Nov 29th, 2014
305
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #===========================================================================
  2. # Non-Combatant Party Member/Guest Party Member
  3. #===========================================================================
  4. # Okay, so put a tag in the actor notebox like this: <in_battle_switch: x>
  5. # (x is the switch ID). If you do this, the member won't participate in fights
  6. # until the switch is turned on.
  7. #===========================================================================
  8. # ■ DataManager
  9. #===========================================================================
  10.  
  11. module DataManager  
  12.     class << self; alias_method(:krx_ibp_dm_ld, :load_database);end
  13.     def self.load_database
  14.         krx_ibp_dm_ld
  15.         load_ibp_notetags
  16.     end  
  17.     #--------------------------------------------------------------------------
  18.     def self.load_ibp_notetags
  19.         groups = [$data_actors]
  20.         for group in groups
  21.             for obj in group
  22.                 next if obj.nil?
  23.                 obj.load_ibp_notetags
  24.             end
  25.         end
  26.     end
  27. end
  28.  
  29. #===========================================================================
  30. # ■ RPG::Actor
  31. #===========================================================================
  32.  
  33. class RPG::Actor < RPG::BaseItem
  34.   attr_reader   :in_battle_switch
  35.     #--------------------------------------------------------------------------
  36.     def load_ibp_notetags
  37.         @note.split(/[\r\n]+/).each do |line|
  38.       case line
  39.             when /<in_battle_switch:[ ]*(\d+)>/i
  40.         @in_battle_switch = $1.to_i
  41.             end
  42.         end
  43.     end
  44. end
  45.  
  46. #==============================================================================
  47. # ■ Game_Actor
  48. #==============================================================================
  49.  
  50. class Game_Actor < Game_Battler
  51.   def battle_participant?
  52.     if self.actor.in_battle_switch
  53.       return $game_switches[self.actor.in_battle_switch]
  54.     end
  55.     true
  56.   end
  57. end
  58.  
  59. #==============================================================================
  60. # ■ Game_Party
  61. #==============================================================================
  62.  
  63. class Game_Party < Game_Unit
  64.   def battle_members
  65.     all_members[0, max_battle_members].select {|actor|
  66.       actor.exist? && actor.battle_participant?
  67.     }
  68.   end
  69. end
RAW Paste Data