How do I make a party member leave the party after a battle is complete?

Hello! This is my first time posting here, I was wondering if anybody knew how could I make it so a party member will leave my party after a battle is finished.
The reason I am asking this is in my game I'm making, I want there to be a skill where you can summon a temporary Slime party member you help you in battle. Though, once the battle ends it would leave. I've figured out all the stuff for this skill, however I am stumped on the part where the Slime has to leave the fight every time a battle ends.
This little snippet should do it. Just add all affected IDs to the configuration, there's an example in header how it should look if multiple actors have to apply this behaviour.

Spoiler: CODE
Ruby:
#==============================================================================
# ** Make specific Actors always leave after Battle
#------------------------------------------------------------------------------
#  How to use: Add all necessary IDs to the "BattleEndLeavers" array.
#  Example: [6, 8, 13, 17] will make Actors #6, #8, #13 and #17 leave.
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # * IDs of Actors that will leave when a Battle ends
  #--------------------------------------------------------------------------
  BattleEndLeavers = []
  #--------------------------------------------------------------------------
  # * Battle End Processing
  #--------------------------------------------------------------------------
  def on_battle_end
    BattleEndLeavers.each {|si| remove_actor(si) if @actors.include?(si) }
    super
  end
end

The code assumes there is no other script that defines Game_Party#on_battle_end, it usually does not exist (but in Game_Unit, it does).

~炬燵あ
This little snippet should do it. Just add all affected IDs to the configuration, there's an example in header how it should look if multiple actors have to apply this behaviour.

Spoiler: CODE
Ruby:
#==============================================================================
# ** Make specific Actors always leave after Battle
#------------------------------------------------------------------------------
#  How to use: Add all necessary IDs to the "BattleEndLeavers" array.
#  Example: [6, 8, 13, 17] will make Actors #6, #8, #13 and #17 leave.
#==============================================================================

class Game_Party < Game_Unit
  #--------------------------------------------------------------------------
  # * IDs of Actors that will leave when a Battle ends
  #--------------------------------------------------------------------------
  BattleEndLeavers = []
  #--------------------------------------------------------------------------
  # * Battle End Processing
  #--------------------------------------------------------------------------
  def on_battle_end
    BattleEndLeavers.each {|si| remove_actor(si) if @actors.include?(si) }
    super
  end
end

The code assumes there is no other script that defines Game_Party#on_battle_end, it usually does not exist (but in Game_Unit, it does).

~炬燵あ

THANK YOU SO MUCH!!!!!!!!! I tried it out and it worked, thank you tons and tons!! ^_^

Original thread: https://forums.rpgmakerweb.com/threads/how-do-i-make-a-party-member-leave-the-party-after-a-battle-is-complete.170671/