- Pokémon Essentials Version
 - v21.1 ✅
 
This system basically allows you to play the game as two trainers, both with their separate teams and the ability to switch which one you control. This can be useful for example to create scenarios, where you'd play as someone else; either solo, or in a team along with the original trainer.
If set up correctly, it should work like this: Video on Reddit
I uploaded the plugin format to MEGA, which eliminates the script copying part. (Since in the original post there was no downloadable file uploaded, I can only insert the link here) Plugin on MEGA
Current features:
trainer_types
#-------------------------------
[POKEMONTRAINER_Red]
Name = Pokémon Trainer
Gender = Male
BaseMoney = 60
#-------------------------------
[POKEMONTRAINER_Leaf]
Name = Pokémon Trainer
Gender = Female
BaseMoney = 60
#-------------------------------
[POKEMONTRAINER_Brendan]
Name = Pokémon Trainer
Gender = Male
BaseMoney = 60
#-------------------------------
[POKEMONTRAINER_May]
Name = Pokémon Trainer
Gender = Female
BaseMoney = 60
#-------------------------------
trainers
#-------------------------------
[POKEMONTRAINER_May,May]
LoseText = ...
Pokemon = COMBUSKEN,19
#-------------------------------
[POKEMONTRAINER_Leaf,Leaf]
LoseText = ...
Pokemon = COMBUSKEN,19
#-------------------------------
[POKEMONTRAINER_Red,Red]
LoseText = ...
Pokemon = COMBUSKEN,19
#-------------------------------
[POKEMONTRAINER_Brendan,Brendan]
LoseText = ...
Pokemon = COMBUSKEN,19
#-------------------------------
metadata
#-------------------------------
[1]
TrainerType = POKEMONTRAINER_Red
WalkCharset = trainer_POKEMONTRAINER_Red
RunCharset = boy_run
CycleCharset = boy_bike
SurfCharset = boy_surf
DiveCharset = boy_surf
FishCharset = boy_fish_offset
SurfFishCharset = boy_fish_offset
#-------------------------------
[2]
TrainerType = POKEMONTRAINER_Leaf
WalkCharset = trainer_POKEMONTRAINER_Leaf
RunCharset = girl_run
CycleCharset = girl_bike
SurfCharset = girl_surf
DiveCharset = girl_surf
FishCharset = girl_fish_offset
SurfFishCharset = girl_fish_offset
#-------------------------------
[3]
TrainerType = POKEMONTRAINER_Brendan
WalkCharset = trainer_POKEMONTRAINER_Brendan
RunCharset = boy_run
CycleCharset = boy_bike
SurfCharset = boy_surf
DiveCharset = boy_surf
FishCharset = boy_fish_offset
SurfFishCharset = boy_fish_offset
#-------------------------------
[4]
TrainerType = POKEMONTRAINER_May
WalkCharset = trainer_POKEMONTRAINER_May
RunCharset = girl_run
CycleCharset = girl_bike
SurfCharset = girl_surf
DiveCharset = girl_surf
FishCharset = girl_fish_offset
SurfFishCharset = girl_fish_offset
NOTE: Brendan and May don’t have their special charsets in the default pokemon essentials sprite list, so when they’re the player characters and start running, their sprites will switch to Red or Leaf while running. (if you have the sprites, rename the charset names to match your sprite names)
When they’re only the follower, their walking animation speeds up into a goofy powerwalk
SETUP:
1: Intro
Branches right as you choose player gender:
After the Intro create an event that triggers when [switch id: NEW GAME DONE] = ON
Event Page1:
(Feel free to change the variables’ numbers as you’d like)
2: First Character Change
Create your event for getting your starter Pokemon (I used the gen1 starters)
Then set up 4 events:
Female partner: activates when: [switch id: SISTER] = ON (optionally triggers after you get your starter)
Male partner: activates when: [switch id: BROTHER] = ON (optionally triggers after you get your starter)
Rest of their setup is the same:
You will need 3 event pages:
This is necessary to initialize the partner’s team. From this on, you’ll be able to switch freely between the 2 characters (you need to set up the common events too first!!)
3: Common Events
2 for the players: Boy - Girl
2 for the partners: Boy - Girl
Both player events have the exact same setup, except for the different pbSWAPPER and switches when discarding them.
And both partner events have the exact same setup, except for the different pbSWAPPER and switches when discarding them
Player Dependent Events:
Show Choices: Change Leader, Follower, Nothing
Partner Dependent Events:
Show Choices: Change Leader, Follower, Nothing
Change the common event IDs in the script to the correct numbers you got in all Followers.add_sprite instances
(Followers.add_sprite(“sprite file name”, pbGet(name variable), common event ID)
After setting these common events up, you’ll really be able to switch between characters freely now. But you won’t be able to discard them just yet!
4: Inactive Follower Events
2 for the players: Boy - Girl
2 for the partners: Boy - Girl
Player events:
3 Pages each:
Page 1:
Partner events:
3 Pages each:
Page 1:
SCRIPTS:
Follower module (Copy content into new script page):
Modification of Original Script:
It is coded into the original Pokemon Essentials script, that when you battle along a partner trainer, your pokemon are fully restored after each battle.
This is not what we want, so we need to modify the original script a bit.
In the script section: Overworld_BattleStarting
Find this part:
And change it to this:
This makes this script part just comments, so in case you want to revert to its original functionality, you can just remove the # and it will work again.
And now, for the mechanism itself:
Player Switch (Copy content into new script page):
					
					
	
		
			If set up correctly, it should work like this: Video on Reddit
I uploaded the plugin format to MEGA, which eliminates the script copying part. (Since in the original post there was no downloadable file uploaded, I can only insert the link here) Plugin on MEGA
Current features:
- Switch player and partner trainer freely, anywhere (except while surfing) in the game
 - Own set of parties, each gain exp and EVs during battle
 - Can send them away and tell them to follow you
 - Shared inventory
 - Shared PC
 
- Enable the use of Surf
 - Create a “Wait here” function
 - Check bike functionality
 
trainer_types
#-------------------------------
[POKEMONTRAINER_Red]
Name = Pokémon Trainer
Gender = Male
BaseMoney = 60
#-------------------------------
[POKEMONTRAINER_Leaf]
Name = Pokémon Trainer
Gender = Female
BaseMoney = 60
#-------------------------------
[POKEMONTRAINER_Brendan]
Name = Pokémon Trainer
Gender = Male
BaseMoney = 60
#-------------------------------
[POKEMONTRAINER_May]
Name = Pokémon Trainer
Gender = Female
BaseMoney = 60
#-------------------------------
trainers
#-------------------------------
[POKEMONTRAINER_May,May]
LoseText = ...
Pokemon = COMBUSKEN,19
#-------------------------------
[POKEMONTRAINER_Leaf,Leaf]
LoseText = ...
Pokemon = COMBUSKEN,19
#-------------------------------
[POKEMONTRAINER_Red,Red]
LoseText = ...
Pokemon = COMBUSKEN,19
#-------------------------------
[POKEMONTRAINER_Brendan,Brendan]
LoseText = ...
Pokemon = COMBUSKEN,19
#-------------------------------
metadata
#-------------------------------
[1]
TrainerType = POKEMONTRAINER_Red
WalkCharset = trainer_POKEMONTRAINER_Red
RunCharset = boy_run
CycleCharset = boy_bike
SurfCharset = boy_surf
DiveCharset = boy_surf
FishCharset = boy_fish_offset
SurfFishCharset = boy_fish_offset
#-------------------------------
[2]
TrainerType = POKEMONTRAINER_Leaf
WalkCharset = trainer_POKEMONTRAINER_Leaf
RunCharset = girl_run
CycleCharset = girl_bike
SurfCharset = girl_surf
DiveCharset = girl_surf
FishCharset = girl_fish_offset
SurfFishCharset = girl_fish_offset
#-------------------------------
[3]
TrainerType = POKEMONTRAINER_Brendan
WalkCharset = trainer_POKEMONTRAINER_Brendan
RunCharset = boy_run
CycleCharset = boy_bike
SurfCharset = boy_surf
DiveCharset = boy_surf
FishCharset = boy_fish_offset
SurfFishCharset = boy_fish_offset
#-------------------------------
[4]
TrainerType = POKEMONTRAINER_May
WalkCharset = trainer_POKEMONTRAINER_May
RunCharset = girl_run
CycleCharset = girl_bike
SurfCharset = girl_surf
DiveCharset = girl_surf
FishCharset = girl_fish_offset
SurfFishCharset = girl_fish_offset
NOTE: Brendan and May don’t have their special charsets in the default pokemon essentials sprite list, so when they’re the player characters and start running, their sprites will switch to Red or Leaf while running. (if you have the sprites, rename the charset names to match your sprite names)
When they’re only the follower, their walking animation speeds up into a goofy powerwalk
SETUP:
1: Intro
Branches right as you choose player gender:
- When boy: Control Switch [switch id: BOY] = ON
 - pbChangePlayer(1)
 - Insert the “enter name” sequence
 - Select Partner gender:
- Show Choices: Boy, Girl
 - When: Boy
 - pbChangePlayer(3)
 - pbSet(22,pbEnterPlayerName(_INTL("Your partner's name?"),0,7))
 - pbChangePlayer(1)
 - Control Switch [switch id: BROTHER] = ON
 - When: Girl
 - pbChangePlayer(4)
 - pbSet(22,pbEnterPlayerName(_INTL("Your partner's name?"),0,7))
 - pbChangePlayer(1)
 - Control Switch [switch id: SISTER] = ON
 
 - When girl: Control Switch [switch id: GIRL] = ON
 - pbChangePlayer(2)
 - Insert the “enter name” sequence
 - Select Partner gender:
- Show Choices: Boy, Girl
 - When: Boy
 - pbChangePlayer(3)
 - pbSet(22,pbEnterPlayerName(_INTL("Your partner's name?"),0,7))
 - pbChangePlayer(1)
 - Control Switch [switch id: BROTHER] = ON
 - When: Girl
 - pbChangePlayer(4)
 - pbSet(22,pbEnterPlayerName(_INTL("Your partner's name?"),0,7))
 - pbChangePlayer(2)
 - Control Switch [switch id: SISTER] = ON
 
 - The rest of the intro plays out as you want
 - Control Switch [switch id: NEW GAME DONE] = ON
 
After the Intro create an event that triggers when [switch id: NEW GAME DONE] = ON
Event Page1:
- pbSet(21, $player.name)
 - Control Self Switch [A] = ON
 
- Blank page
 
(Feel free to change the variables’ numbers as you’d like)
2: First Character Change
Create your event for getting your starter Pokemon (I used the gen1 starters)
Then set up 4 events:
- for the male partner,
 - for the female partner.
 - and 4.: The other 2 will be invisible dummy events using the player sprites (place these to an edge of the map, choose the sprite, set opacity to 0, and leave the event page blank).
 
- Choose the sprites you wish them to use (and change the sprite name in your script sheet accordingly. I used the default trchar000-003 files (Originals: Red, Leaf; Partners: Brendan, May)
 - The events will have the exact same basic setup structure
 
Female partner: activates when: [switch id: SISTER] = ON (optionally triggers after you get your starter)
Male partner: activates when: [switch id: BROTHER] = ON (optionally triggers after you get your starter)
Rest of their setup is the same:
You will need 3 event pages:
- is active when Switch [switch id: BOY] = ON
 - is active when Switch [switch id: GIRL] = ON
 - is active when Switch [switch id: FirstChangeClear] = ON
 
- pbBecomeBrendanFirst
toggleLeaderName
pbREGISTERERRedBrendan
Control Switch [switch id: First Clear] = ON - pbBecomeBrendanFirst
toggleLeaderName
pbREGISTERERLeafBrendan
Control Switch [switch id: First Clear] = ON - blank
 
- pbBecomeMayFirst
toggleLeaderName
pbREGISTERERRedMay
Control Switch [switch id: First Clear] = ON - pbBecomeMayFirst
toggleLeaderName
pbREGISTERERLeafMay
Control Switch [switch id: First Clear] = ON - blank
 
This is necessary to initialize the partner’s team. From this on, you’ll be able to switch freely between the 2 characters (you need to set up the common events too first!!)
3: Common Events
2 for the players: Boy - Girl
2 for the partners: Boy - Girl
Both player events have the exact same setup, except for the different pbSWAPPER and switches when discarding them.
And both partner events have the exact same setup, except for the different pbSWAPPER and switches when discarding them
Player Dependent Events:
Show Choices: Change Leader, Follower, Nothing
- When: [Change Leader]
Conditional Branch: Switch [switch id: BROTHER] = ON- pbSWAPPERRedBrendan (Or pbSWAPPERLeafBrendan when girl player)
else - pbSWAPPERRedMay (Or pbSWAPPERLeafMay when girl player)
Branch End 
 - pbSWAPPERRedBrendan (Or pbSWAPPERLeafBrendan when girl player)
 - When: [Follower]
- pbDEREGISTERER
 - Control Switch [switch id: Red Party] = Off
Control Switch [switch id: Leaf Party] = Off (when girl player) - Control Switch [switch id: Red Event On ] = ON
Control Switch [switch id: Leaf Event On ] = ON (when girl player) 
 - When: [Nothing]
- blank
 
 
Partner Dependent Events:
Show Choices: Change Leader, Follower, Nothing
- When: [Change Leader]
Conditional Branch: Switch [switch id: BOY] = ON- pbSWAPPERRedBrendan (Or pbSWAPPERRedMay when girl partner)
else - pbSWAPPERLeafBrendan (Or pbSWAPPERLeafMay when girl player)
Branch End 
 - pbSWAPPERRedBrendan (Or pbSWAPPERRedMay when girl partner)
 - When: [Follower]
- pbDEREGISTERER
 - Control Switch [switch id: Partner Party] = Off
 
 - When: [Nothing]
- blank
 
 
Change the common event IDs in the script to the correct numbers you got in all Followers.add_sprite instances
(Followers.add_sprite(“sprite file name”, pbGet(name variable), common event ID)
After setting these common events up, you’ll really be able to switch between characters freely now. But you won’t be able to discard them just yet!
4: Inactive Follower Events
2 for the players: Boy - Girl
2 for the partners: Boy - Girl
Player events:
3 Pages each:
- Active when:
Switch [switch id: Red Event On ] = ON
Switch [switch id: Leaf Event On ] = ON (when girl player)
Switch [switch id: BROTHER] = ON - Active when:
Switch [switch id: Red Event On ] = ON
Switch [switch id: Leaf Event On ] = ON (when girl player)
Switch [switch id: SISTER] = ON - Active when:
Switch [switch id: Red Party] = ON
Switch [switch id: Leaf Party] = ON (when girl player) 
Page 1:
- pbREGISTERERRedBrendan
pbREGISTERERLeafBrendan (when girl player) - Control Switch [switch id: Red Party] = ON
Control Switch [switch id: Leaf Party] = ON (when girl player) 
- pbREGISTERERRedMay
pbREGISTERERLeafMay (when girl player) - Control Switch [switch id: Red Party] = ON
Control Switch [switch id: Leaf Party] = ON (when girl player) 
Partner events:
3 Pages each:
- Active when:
Switch [switch id: FirstChangeClear] = ON
Switch [switch id: BOY] = ON - Active when:
Switch [switch id: FirstChangeClear] = ON
Switch [switch id: GIRL] = ON - Active when:
Switch [switch id: Partner Party] = ON 
Page 1:
- pbREGISTERERRedBrendan (pbREGISTERERRedMay when female partner)
 - Control Switch [switch id: Partner Party] = ON
 
- pbREGISTERERLeafBrendan (pbREGISTERERLeafMay when female partner)
 - Control Switch [switch id: Partner Party] = ON
 
SCRIPTS:
Follower module (Copy content into new script page):
module Followers  def self.add_sprite(sprite_name, name, common_event_id = nil)    event_id = 99  # Reserve this ID for dynamic followers    return if $game_map.events[event_id]  # Prevent duplicates    # Create a new RPG::Event and configure it    new_event = RPG::Event.new(0, 0)    new_event.id = event_id    page = RPG::Event::Page.new    page.graphic.character_name = sprite_name    page.graphic.character_hue = 0    page.graphic.direction = 2    page.graphic.pattern = 1    page.move_type = 0    page.trigger = 4  # Parallel Process or Action Button    new_event.pages << page    # Add the event to the current map    game_event = Game_Event.new($game_map.map_id, new_event)    $game_map.events[event_id] = game_event    # Register it as a follower like usual    self.add(event_id, name, common_event_id)  endendModification of Original Script:
It is coded into the original Pokemon Essentials script, that when you battle along a partner trainer, your pokemon are fully restored after each battle.
This is not what we want, so we need to modify the original script a bit.
In the script section: Overworld_BattleStarting
Find this part:
    if $PokemonGlobal.partner      $player.heal_party      $PokemonGlobal.partner[3].each do |pkmn|        pkmn.heal        pkmn.makeUnmega        pkmn.makeUnprimal      end    endAnd change it to this:
#    if $PokemonGlobal.partner#      $player.heal_party#      $PokemonGlobal.partner[3].each do |pkmn|#        pkmn.heal#        pkmn.makeUnmega#        pkmn.makeUnprimal#      end#    endThis makes this script part just comments, so in case you want to revert to its original functionality, you can just remove the # and it will work again.
And now, for the mechanism itself:
Player Switch (Copy content into new script page):
$PokemonTemp ||= {}$PokemonTemp[:original_party] ||= nil$PokemonTemp[:partner_party]  ||= nildef pbBecomeMayFirst  [imath]PokemonTemp[:original_party] =[/imath]player.party.map(&:clone)  pbChangePlayer(4)  starter = $player.party[0].species  new_species =    case starter    when :BULBASAUR then :CHARMANDER    when :CHARMANDER then :SQUIRTLE    when :SQUIRTLE then :BULBASAUR    else starter    end  $player.party.clear  $player.party.push(Pokemon.new(new_species, 5))enddef pbBecomeBrendanFirst  [imath]PokemonTemp[:original_party] =[/imath]player.party.map(&:clone)  pbChangePlayer(3)  starter = $player.party[0].species  new_species =    case starter    when :BULBASAUR then :CHARMANDER    when :CHARMANDER then :SQUIRTLE    when :SQUIRTLE then :BULBASAUR    else starter    end  $player.party.clear  $player.party.push(Pokemon.new(new_species, 5))enddef pbBecomeMay  [imath]PokemonTemp[:original_party] =[/imath]player.party.map(&:clone)  if [imath]PokemonGlobal.partner &&[/imath]PokemonGlobal.partner[3]    [imath]PokemonTemp[:partner_party] =[/imath]PokemonGlobal.partner[3].map(&:clone)  end  pbChangePlayer(4)  if [imath]PokemonGlobal.partner &&[/imath]PokemonGlobal.partner[3]    [imath]player.party =[/imath]PokemonGlobal.partner[3].map(&:clone)  end  $player.party.each do |pkmn|    next unless pkmn    pkmn.owner = Pokemon::Owner.new_from_trainer($player)  endenddef pbBecomeBrendan  [imath]PokemonTemp[:original_party] =[/imath]player.party.map(&:clone)  if [imath]PokemonGlobal.partner &&[/imath]PokemonGlobal.partner[3]    [imath]PokemonTemp[:partner_party] =[/imath]PokemonGlobal.partner[3].map(&:clone)  end  pbChangePlayer(3)  if [imath]PokemonGlobal.partner &&[/imath]PokemonGlobal.partner[3]    [imath]player.party =[/imath]PokemonGlobal.partner[3].map(&:clone)  end  $player.party.each do |pkmn|    next unless pkmn    pkmn.owner = Pokemon::Owner.new_from_trainer($player)  endenddef pbTurnBackToRed  [imath]PokemonTemp[:partner_party] =[/imath]player.party.map(&:clone)  if [imath]PokemonGlobal.partner &&[/imath]PokemonGlobal.partner[3]    [imath]PokemonTemp[:original_party] =[/imath]PokemonGlobal.partner[3].map(&:clone)  end  pbChangePlayer(1)  [imath]player.party =[/imath]PokemonTemp[:original_party].map(&:clone)  $player.party.each do |pkmn|    next unless pkmn    pkmn.owner = Pokemon::Owner.new_from_trainer($player)  end  [imath]PokemonGlobal.partner[3] =[/imath]PokemonTemp[:partner_party].map(&:clone)enddef pbTurnBackToLeaf  [imath]PokemonTemp[:partner_party] =[/imath]player.party.map(&:clone)  if [imath]PokemonGlobal.partner &&[/imath]PokemonGlobal.partner[3]    [imath]PokemonTemp[:original_party] =[/imath]PokemonGlobal.partner[3].map(&:clone)  end  pbChangePlayer(2)  [imath]player.party =[/imath]PokemonTemp[:original_party].map(&:clone)  $player.party.each do |pkmn|    next unless pkmn    pkmn.owner = Pokemon::Owner.new_from_trainer($player)  end  [imath]PokemonGlobal.partner[3] =[/imath]PokemonTemp[:partner_party].map(&:clone)enddef toggleLeaderName  if $player.name == pbGet(21)    $player.name = pbGet(22)  else    $player.name = pbGet(21)  endenddef pbDEREGISTERER  if $player.name == pbGet(21)    Followers.remove(pbGet(22))    pbDeregisterPartner    $game_map.events.delete(99)  elsif $player.name == pbGet(22)    Followers.remove(pbGet(21))    pbDeregisterPartner    $game_map.events.delete(99)  else    pbMessage ("Nobody to send away")  endenddef pbREGISTERERLeafMay  if $player.name == pbGet(21)    Followers.add_sprite("trchar003", pbGet(22), 5)    pbRegisterMayFromClone (pbGet(22))  elsif $player.name == pbGet(22)    Followers.add_sprite("trchar001", pbGet(21), 4)    pbRegisterLeafFromClone (pbGet(21))  else    pbMessage ("Nobody to swap with")  endenddef pbREGISTERERLeafBrendan  if $player.name == pbGet(21)    Followers.add_sprite("trchar002", pbGet(22), 9)    pbRegisterBrendanFromClone (pbGet(22))  elsif $player.name == pbGet(22)    Followers.add_sprite("trchar001", pbGet(21), 4)    pbRegisterLeafFromClone (pbGet(21))  else    pbMessage ("Nobody to swap with")  endenddef pbREGISTERERRedMay  if $player.name == pbGet(21)    Followers.add_sprite("trchar003", pbGet(22), 5)    pbRegisterMayFromClone (pbGet(22))  elsif $player.name == pbGet(22)    Followers.add_sprite("trchar000", pbGet(21), 8)    pbRegisterRedFromClone (pbGet(21))  else    pbMessage ("Nobody to swap with")  endenddef pbREGISTERERRedBrendan  if $player.name == pbGet(21)    Followers.add_sprite("trchar002", pbGet(22), 9)    pbRegisterBrendanFromClone (pbGet(22))  elsif $player.name == pbGet(22)    Followers.add_sprite("trchar000", pbGet(21), 8)    pbRegisterRedFromClone (pbGet(21))  else    pbMessage ("Nobody to swap with")  endenddef pbSWAPPERLeafMay  if $player.name == pbGet(21)    pbBecomeMay    pbDEREGISTERER    toggleLeaderName    pbREGISTERERLeafMay  else    pbTurnBackToLeaf    pbDEREGISTERER    toggleLeaderName    pbREGISTERERLeafMay  endenddef pbSWAPPERLeafBrendan  if $player.name == pbGet(21)    pbBecomeBrendan    pbDEREGISTERER    toggleLeaderName    pbREGISTERERLeafBrendan  else    pbTurnBackToLeaf    pbDEREGISTERER    toggleLeaderName    pbREGISTERERLeafBrendan  endenddef pbSWAPPERRedMay  if $player.name == pbGet(21)    pbBecomeMay    pbDEREGISTERER    toggleLeaderName    pbREGISTERERRedMay  else    pbTurnBackToRed    pbDEREGISTERER    toggleLeaderName    pbREGISTERERRedMay  endenddef pbSWAPPERRedBrendan  if $player.name == pbGet(21)    pbBecomeBrendan    pbDEREGISTERER    toggleLeaderName    pbREGISTERERRedBrendan  else    pbTurnBackToRed    pbDEREGISTERER    toggleLeaderName    pbREGISTERERRedBrendan  endenddef pbRegisterPartnerFromClone(tr_name, trainer_type_symbol)  return unless [imath]PokemonTemp[:partner_party] && ![/imath]PokemonTemp[:partner_party].empty?  trainer = NPCTrainer.new(tr_name, trainer_type_symbol)  trainer.id = $player.make_foreign_ID  trainer.items = []  trainer.lose_text = "I'll try better next time!"  $PokemonTemp[:partner_party].each do |pkmn|    next if !pkmn    new_pokemon = Marshal.load(Marshal.dump(pkmn))    new_pokemon.owner = Pokemon::Owner.new_from_trainer(trainer)    new_pokemon.calc_stats    trainer.party << new_pokemon  end  EventHandlers.trigger(:on_trainer_load, trainer)  trainer.party.each { |p| p.owner = Pokemon::Owner.new_from_trainer(trainer) }  $PokemonGlobal.partner = [trainer_type_symbol, tr_name, trainer.id, trainer.party]enddef pbRegisterOriginalFromClone(tr_name, trainer_type_symbol)  return unless [imath]PokemonTemp[:original_party] && ![/imath]PokemonTemp[:original_party].empty?  trainer = NPCTrainer.new(tr_name, trainer_type_symbol)  trainer.id = $player.make_foreign_ID  trainer.items = []  trainer.lose_text = "I'll try better next time!"  $PokemonTemp[:original_party].each do |pkmn|    next if !pkmn    new_pokemon = Marshal.load(Marshal.dump(pkmn))    new_pokemon.owner = Pokemon::Owner.new_from_trainer(trainer)    new_pokemon.calc_stats    trainer.party << new_pokemon  end  EventHandlers.trigger(:on_trainer_load, trainer)  trainer.party.each { |p| p.owner = Pokemon::Owner.new_from_trainer(trainer) }  $PokemonGlobal.partner = [trainer_type_symbol, tr_name, trainer.id, trainer.party]enddef pbRegisterMayFromClone(tr_name)  pbRegisterPartnerFromClone(tr_name, :POKEMONTRAINER_May)enddef pbRegisterBrendanFromClone(tr_name)  pbRegisterPartnerFromClone(tr_name, :POKEMONTRAINER_Brendan)enddef pbRegisterLeafFromClone(tr_name)  pbRegisterOriginalFromClone(tr_name, :POKEMONTRAINER_Leaf)enddef pbRegisterRedFromClone(tr_name)  pbRegisterOriginalFromClone(tr_name, :POKEMONTRAINER_Red)end- Credits
 - Credit is not necessary
 
	