# ResourceNew Replace Party Pokemon Script (Plug-and-Play)

#### Jonas930

##### Is anyonre there?
Member
Jonas930 submitted a new resource:

New Replace Party Pokemon Script - Make your game looks like gen 7 game!

THIS IS FOR CLEAR ESSENTIALS V17.2. DIDN'T TEST ON OLDER VERSION OR EBS.

This is the SIMPLE script that can make player keep the caught/gained Pokemon in player's party like Gen 7.

Installation:
There are two different you have to edit. If you are new to edit the script, just follow steps by steps, then you and your game will be fine.
1. Open...

#### Marin

Small suggestion to make it more plug-and-play, but since you want users to replace the whole def anyway, why not put this all in one section? It'd be just a copy/paste in a new section and everything would work.
Code:
module PokeBattle_BattleCommon
def pbStorePokemon(pokemon)
if pbDisplayConfirm(_INTL("Would you like to give a nickname to {1}?",pokemon.name))
species=PBSpecies.getName(pokemon.species)
nickname=@scene.pbNameEntry(_INTL("{1}'s nickname?",species),pokemon)
pokemon.name=nickname if nickname!=""
end
end
oldcurbox=@peer.pbCurrentBox()
storedbox=@peer.pbStorePokemon(self.pbPlayer,pokemon)
creator=@peer.pbGetStorageCreator()
return if storedbox<0
if pbDisplayConfirm(_INTL("Would you like to keep {1} in your party?",pokemon.name))
swap = true
pokemon2 = pokemon
pbChoosePokemon(1,2)
pokemon = $Trainer.pokemonParty[pbGet(1)] pbRemovePokemonAt(pbGet(1)) end curboxname=@peer.pbBoxName(oldcurbox) boxname=@peer.pbBoxName(storedbox) if storedbox!=oldcurbox if creator pbDisplayPaused(_INTL("Box \"{1}\" on {2}'s PC was full.",curboxname,creator)) else pbDisplayPaused(_INTL("Box \"{1}\" on someone's PC was full.",curboxname)) end pbDisplayPaused(_INTL("{1} was transferred to box \"{2}\".",pokemon.name,boxname)) else if creator pbDisplayPaused(_INTL("{1} was transferred to {2}'s PC.",pokemon.name,creator)) else pbDisplayPaused(_INTL("{1} was transferred to someone's PC.",pokemon.name)) end pbDisplayPaused(_INTL("It was stored in box \"{1}\".",boxname)) end if swap self.pbPlayer.party[self.pbPlayer.party.length]=pokemon2 pbDisplayPaused(_INTL("\\me[Pkmn get]{2} has added to {1}'s party!",$Trainer.name,pokemon2.name))
end
end
end

def pbStorePokemon(pokemon)
if pbBoxesFull?
Kernel.pbMessage(_INTL("There's no more room for Pokémon!\1"))
Kernel.pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
return
end
pokemon.pbRecordFirstMoves
if $Trainer.party.length<6$Trainer.party[$Trainer.party.length] = pokemon else if Kernel.pbConfirmMessage(_INTL("Would you like to keep {1} in your party?",pokemon.name)) swap = true pokemon2 = pokemon Kernel.pbMessage(_INTL("Please select a Pokémon to swap from your party.")) pbChoosePokemon(1,2) pokemon =$Trainer.pokemonParty[pbGet(1)]
pbRemovePokemonAt(pbGet(1))
end
oldcurbox = $PokemonStorage.currentBox storedbox =$PokemonStorage.pbStoreCaught(pokemon)
curboxname = $PokemonStorage[oldcurbox].name boxname =$PokemonStorage[storedbox].name
creator = nil
creator = Kernel.pbGetStorageCreator if $PokemonGlobal.seenStorageCreator if storedbox!=oldcurbox if creator Kernel.pbMessage(_INTL("Box \"{1}\" on {2}'s PC was full.\1",curboxname,creator)) else Kernel.pbMessage(_INTL("Box \"{1}\" on someone's PC was full.\1",curboxname)) end Kernel.pbMessage(_INTL("{1} was transferred to box \"{2}.\"",pokemon.name,boxname)) else if creator Kernel.pbMessage(_INTL("{1} was transferred to {2}'s PC.\1",pokemon.name,creator)) else Kernel.pbMessage(_INTL("{1} was transferred to someone's PC.\1",pokemon.name)) end Kernel.pbMessage(_INTL("It was stored in box \"{1}.\"",boxname)) end if swap$Trainer.party[$Trainer.party.length] = pokemon2 Kernel.pbMessage(_INTL("\\me[Pkmn get]{2} has added to {1}'s party!",$Trainer.name,pokemon2.name))
end
end
end

#### Lord X-Giga-X

##### Sardonyx's Reaper
Member
As I stated on the Ruffled Squad server, this is a pretty useful script. I can also confirm this works on v16.2

However, there is a bit of a problem when it come to the first part of it. Trying it out myself, the Pokémon that is supposed to be sent to the PC instead seemed to have disappeared from the game altogether, while the newly caught Pokémon is cloned. I was able to fix it by changing this:
Code:
oldcurbox=@peer.pbCurrentBox()
storedbox=@peer.pbStorePokemon(self.pbPlayer,pokemon)
creator=@peer.pbGetStorageCreator()
return if storedbox<0
if pbDisplayConfirm(_INTL("Would you like to keep {1} in your party?",pokemon.name))
swap = true
pokemon2 = pokemon
pbChoosePokemon(1,2)
pokemon = $Trainer.pokemonParty[pbGet(1)] pbRemovePokemonAt(pbGet(1)) end to this: Code: if pbDisplayConfirm(_INTL("Would you like to keep {1} in your party?",pokemon.name)) swap = true pokemon2 = pokemon pbDisplayPaused(_INTL("Please select a Pokémon to swap from your party.")) pbChoosePokemon(1,2) pokemon =$Trainer.pokemonParty[pbGet(1)]
oldcurbox=@peer.pbCurrentBox()
storedbox=@peer.pbStorePokemon(self.pbPlayer,pokemon)
creator=@peer.pbGetStorageCreator()
return if storedbox<0
pbRemovePokemonAt(pbGet(1))
else
oldcurbox=@peer.pbCurrentBox()
storedbox=@peer.pbStorePokemon(self.pbPlayer,pokemon)
creator=@peer.pbGetStorageCreator()
return if storedbox<0
end

That hiccup aside, this is a good script that everyone can definitely get some use out of.

#### Morningdew

##### Novice
Member
Awesome script, Jonas. Added the fix Giga suggested and it works amazingly!

#### SuzuiXIi

##### Novice
Member
Sorry but...Where do we go at the beginning? PScreen, PSummary...? I'm quite bad at scripting so before doing anything I want to ask XDDD

#### Jonas930

##### Is anyonre there?
Member
Jonas930 updated New Replace Party Pokemon Script with a new update entry:

New Replace Party Pokemon Script (Plug-and-Play)

THIS IS FOR CLEAR ESSENTIALS V17.2. DIDN'T TEST ON OLDER VERSION OR WITH EBS.
NOW IT IS CONFIRM FOR WORKING ON ALL VERSION (AFTER VERSION 16, ALSO WITH EBS) ESSENTIALS.

This is the SIMPLE script that can make player keep the caught/gained Pokemon in player's party like Gen 7.

Installation:
Now it is become a simplest Plug-and-Play script which not really need any...

Read the rest of this update entry...

#### Wiispeed03

##### Trainer
Member
OK, so this script works great when your team has 6 Pokemon, but if you actually have room left in your party, the "would you like to keep __" message will still show, and you won't be able to just add it normally.

#### Jonas930

##### Is anyonre there?
Member
OK, so this script works great when your team has 6 Pokemon, but if you actually have room left in your party, the "would you like to keep __" message will still show, and you won't be able to just add it normally.
Sorry for the bug. But it should be fixed in the script now.

#### GameHero95

##### Dante the Infernape Profile Picture
Member
Hi, I'm here in this website and I wanted to make my own Pokemon fan games as well, but how can I download this script in RPG Maker XP?

#### JaceDeane

##### Novice
Member
I did an edit to the script that makes it more in-line with what Sun and Moon use.
Though it's not very elegant.
The in-battle side isn't aligned properly, so that needs to be fixed.
The idea was to get all the "pbStorePokemon" mentions to call to one script with the same messages and interface.
Here it is though:
Code:
#New Author: JaceDeane
#Original Author: Jonas930
#Contributions from: Marin and Lord X-Giga-X
#"New Replace Party Pokemon Script"

module PokeBattle_BattleCommon
def pbStorePokemon(pokemon)
if pbDisplayConfirm(_INTL("Would you like to give a nickname to {1}?",pokemon.name))
species=PBSpecies.getName(pokemon.species)
nickname=@scene.pbNameEntry(_INTL("{1}'s nickname?",species),pokemon)
pokemon.name=nickname if nickname!=""
end
end
pbStorePokemonSM(pokemon)
end
end

def pbStorePokemon(pokemon)
pbStorePokemonSM(pokemon)
end

def pbStorePokemonSM(pokemon)
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["pokemon"] = PokemonSprite.new(@viewport)
@sprites["pokemon"].setOffset(PictureOrigin::Center)
@sprites["pokemon"].x = Graphics.width/2 ; @sprites["pokemon"].y = (Graphics.height-96)/2
@sprites["pokemon"].setPokemonBitmap(pokemon)
#
if pbBoxesFull?
Kernel.pbMessage(_INTL("There's no more room for Pokémon!\1"))
Kernel.pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
return
end
pokemon.pbRecordFirstMoves #OUTSIDE BATTLE ONLY
if $Trainer.party.length<6$Trainer.party[$Trainer.party.length] = pokemon else swap = false pokemon2 = nil commands=[] cmdParty=-1 cmdBox=-1 #if @catchtransfer==0 #Auto NEED TO FIGURE OUT HOW TO IMPLIMENT #cmdSummary=-1 #cmdParty=-1 commands[cmdParty=commands.length]=_INTL("Add to party") commands[cmdBox=commands.length]=_INTL("Send to a Box") #commands[cmdSummary=commands.length]=_INTL("Summary") #VIEW ONLY - CAN CANCEL) #commands[cmdParty=commands.length]=_INTL("Party Summary") #VIEW ONLY - CAN CANCEL) cmd=Kernel.pbMessage(_INTL("Where do you want to send {1} to?",pokemon.name), commands) loop do if cmdParty>=0 && cmd==cmdParty #Add to party pokemon2 = pokemon Kernel.pbMessage(_INTL("Please select a Pokémon to swap from your party.")) pbChoosePokemon(1,2) cancel = pbGet(1) if cancel >= 0 swap = true pokemon2 =$Trainer.pokemonParty[pbGet(1)]
pbRemovePokemonAt(pbGet(1))
break
end
elsif cmdBox>=0 && cmd==cmdBox #Send to a Box
break
end
cmd=Kernel.pbMessage(
_INTL("Where do you want to send {1} to?",pokemon.name),commands)
end
if swap==true
$Trainer.party[$Trainer.party.length] = pokemon
storedbox = $PokemonStorage.pbStoreCaught(pokemon2) Kernel.pbMessage(_INTL("{1} will be added to your party, and {2} will be sent to a Box.",pokemon.name,pokemon2.name)) else storedbox =$PokemonStorage.pbStoreCaught(pokemon)
Kernel.pbMessage(_INTL("{1} has been sent to a Box!",pokemon.name))
end
end
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end

#### Marin

I did an edit to the script that makes it more in-line with what Sun and Moon use.
Though it's not very elegant.
The in-battle side isn't aligned properly, so that needs to be fixed.
The idea was to get all the "pbStorePokemon" mentions to call to one script with the same messages and interface.
Here it is though:
Code:
#New Author: JaceDeane
#Original Author: Jonas930
#Contributions from: Marin and Lord X-Giga-X
#"New Replace Party Pokemon Script"

module PokeBattle_BattleCommon
def pbStorePokemon(pokemon)
if pbDisplayConfirm(_INTL("Would you like to give a nickname to {1}?",pokemon.name))
species=PBSpecies.getName(pokemon.species)
nickname=@scene.pbNameEntry(_INTL("{1}'s nickname?",species),pokemon)
pokemon.name=nickname if nickname!=""
end
end
pbStorePokemonSM(pokemon)
end
end

def pbStorePokemon(pokemon)
pbStorePokemonSM(pokemon)
end

def pbStorePokemonSM(pokemon)
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["pokemon"] = PokemonSprite.new(@viewport)
@sprites["pokemon"].setOffset(PictureOrigin::Center)
@sprites["pokemon"].x = Graphics.width/2 ; @sprites["pokemon"].y = (Graphics.height-96)/2
@sprites["pokemon"].setPokemonBitmap(pokemon)
#
if pbBoxesFull?
Kernel.pbMessage(_INTL("There's no more room for Pokémon!\1"))
Kernel.pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
return
end
pokemon.pbRecordFirstMoves #OUTSIDE BATTLE ONLY
if $Trainer.party.length<6$Trainer.party[$Trainer.party.length] = pokemon else swap = false pokemon2 = nil commands=[] cmdParty=-1 cmdBox=-1 #if @catchtransfer==0 #Auto NEED TO FIGURE OUT HOW TO IMPLIMENT #cmdSummary=-1 #cmdParty=-1 commands[cmdParty=commands.length]=_INTL("Add to party") commands[cmdBox=commands.length]=_INTL("Send to a Box") #commands[cmdSummary=commands.length]=_INTL("Summary") #VIEW ONLY - CAN CANCEL) #commands[cmdParty=commands.length]=_INTL("Party Summary") #VIEW ONLY - CAN CANCEL) cmd=Kernel.pbMessage(_INTL("Where do you want to send {1} to?",pokemon.name), commands) loop do if cmdParty>=0 && cmd==cmdParty #Add to party pokemon2 = pokemon Kernel.pbMessage(_INTL("Please select a Pokémon to swap from your party.")) pbChoosePokemon(1,2) cancel = pbGet(1) if cancel >= 0 swap = true pokemon2 =$Trainer.pokemonParty[pbGet(1)]
pbRemovePokemonAt(pbGet(1))
break
end
elsif cmdBox>=0 && cmd==cmdBox #Send to a Box
break
end
cmd=Kernel.pbMessage(
_INTL("Where do you want to send {1} to?",pokemon.name),commands)
end
if swap==true
$Trainer.party[$Trainer.party.length] = pokemon
storedbox = $PokemonStorage.pbStoreCaught(pokemon2) Kernel.pbMessage(_INTL("{1} will be added to your party, and {2} will be sent to a Box.",pokemon.name,pokemon2.name)) else storedbox =$PokemonStorage.pbStoreCaught(pokemon)
Kernel.pbMessage(_INTL("{1} has been sent to a Box!",pokemon.name))
end
end
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
i didn't contribute to this tho

#### JaceDeane

##### Novice
Member
Ohh I just assumed since you helped make it plug and play, didn’t you?
Ah well, I mean I can edit you out? Haha

#### Jonas930

##### Is anyonre there?
Member
I did an edit to the script that makes it more in-line with what Sun and Moon use.
Though it's not very elegant.
The in-battle side isn't aligned properly, so that needs to be fixed.
The idea was to get all the "pbStorePokemon" mentions to call to one script with the same messages and interface.
Here it is though:
Code:
#New Author: JaceDeane
#Original Author: Jonas930
#Contributions from: Marin and Lord X-Giga-X
#"New Replace Party Pokemon Script"

module PokeBattle_BattleCommon
def pbStorePokemon(pokemon)
if pbDisplayConfirm(_INTL("Would you like to give a nickname to {1}?",pokemon.name))
species=PBSpecies.getName(pokemon.species)
nickname=@scene.pbNameEntry(_INTL("{1}'s nickname?",species),pokemon)
pokemon.name=nickname if nickname!=""
end
end
pbStorePokemonSM(pokemon)
end
end

def pbStorePokemon(pokemon)
pbStorePokemonSM(pokemon)
end

def pbStorePokemonSM(pokemon)
@sprites={}
@viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
@viewport.z=99999
@sprites["pokemon"] = PokemonSprite.new(@viewport)
@sprites["pokemon"].setOffset(PictureOrigin::Center)
@sprites["pokemon"].x = Graphics.width/2 ; @sprites["pokemon"].y = (Graphics.height-96)/2
@sprites["pokemon"].setPokemonBitmap(pokemon)
#
if pbBoxesFull?
Kernel.pbMessage(_INTL("There's no more room for Pokémon!\1"))
Kernel.pbMessage(_INTL("The Pokémon Boxes are full and can't accept any more!"))
return
end
pokemon.pbRecordFirstMoves #OUTSIDE BATTLE ONLY
if $Trainer.party.length<6$Trainer.party[$Trainer.party.length] = pokemon else swap = false pokemon2 = nil commands=[] cmdParty=-1 cmdBox=-1 #if @catchtransfer==0 #Auto NEED TO FIGURE OUT HOW TO IMPLIMENT #cmdSummary=-1 #cmdParty=-1 commands[cmdParty=commands.length]=_INTL("Add to party") commands[cmdBox=commands.length]=_INTL("Send to a Box") #commands[cmdSummary=commands.length]=_INTL("Summary") #VIEW ONLY - CAN CANCEL) #commands[cmdParty=commands.length]=_INTL("Party Summary") #VIEW ONLY - CAN CANCEL) cmd=Kernel.pbMessage(_INTL("Where do you want to send {1} to?",pokemon.name), commands) loop do if cmdParty>=0 && cmd==cmdParty #Add to party pokemon2 = pokemon Kernel.pbMessage(_INTL("Please select a Pokémon to swap from your party.")) pbChoosePokemon(1,2) cancel = pbGet(1) if cancel >= 0 swap = true pokemon2 =$Trainer.pokemonParty[pbGet(1)]
pbRemovePokemonAt(pbGet(1))
break
end
elsif cmdBox>=0 && cmd==cmdBox #Send to a Box
break
end
cmd=Kernel.pbMessage(
_INTL("Where do you want to send {1} to?",pokemon.name),commands)
end
if swap==true
$Trainer.party[$Trainer.party.length] = pokemon
storedbox = $PokemonStorage.pbStoreCaught(pokemon2) Kernel.pbMessage(_INTL("{1} will be added to your party, and {2} will be sent to a Box.",pokemon.name,pokemon2.name)) else storedbox =$PokemonStorage.pbStoreCaught(pokemon)
Kernel.pbMessage(_INTL("{1} has been sent to a Box!",pokemon.name))
end
end
pbDisposeSpriteHash(@sprites)
@viewport.dispose
end
I didnt check your code very carefully. But do you know there are some differences between the code in pbStorePokemon in general and in poke battle?------------------------
Hi, I'm here in this website and I wanted to make my own Pokemon fan games as well, but how can I download this script in RPG Maker XP?
I had the tutorial that you need to do. Just follow the step, then you will be good.

Btw you are trying to add the script not trying to replace the game files.

#### JaceDeane

##### Novice
Member
Ah, yeah. That’d mostly be how the messages are displayed in battle I think.
i was planning on doing a check for the message type, but couldn’t figure it out haha
I didnt check your code very carefully. But do you know there are some differences between the code in pbStorePokemon in general and in poke battle?------------------------
I had the tutorial that you need to do. Just follow the step, then you will be good.

Btw you are trying to add the script not trying to replace the game files.
h

#### Aki

##### Ace trainer
Member
Hi, I'm having a weird issue when using this script. When the party is full it works pretty normally like it's meant to, but if the party isn't full when a pokemon is caught, it does a couple of weird things:
1. It displays the message as if the newly caught pokemon was sent to the PC and stored in a box
2. The pokemon then is added to the party like normal, but there is also a clone that really was stored in the PC

#### Wiispeed03

##### Trainer
Member
Hi, I'm having a weird issue when using this script. When the party is full it works pretty normally like it's meant to, but if the party isn't full when a pokemon is caught, it does a couple of weird things:
1. It displays the message as if the newly caught pokemon was sent to the PC and stored in a box
2. The pokemon then is added to the party like normal, but there is also a clone that really was stored in the PC
Yeah, I had the same problem. I seemed to fix the problem by adding return under these lines that occur twice in the script:

Code:
if $Trainer.party.length<6$Trainer.party[$Trainer.party.length] = pokemon I haven't had any problems since then, but my scripting knowledge is not very high so this might not be the proper way to fix it lol. Hope this helps. #### Aki ##### Ace trainer Member Yeah, I had the same problem. I seemed to fix the problem by adding return under these lines that occur twice in the script: Code: if$Trainer.party.length<6
$Trainer.party[$Trainer.party.length] = pokemon
I haven't had any problems since then, but my scripting knowledge is not very high so this might not be the proper way to fix it lol.

Hope this helps.

Thank you! That seems to be just what the script needed. n_n

#### Jos_Louis

##### Developer of Pokemon Soulstones
Member
Hi there,

Not sure if this script is still being actively maintained or not, but I identified a bug. I am on v17.2 and it seems that if you have a full party with an egg in it, and are given a gift Pokemon, when you try to swap the existing egg with the newly obtained Pokemon to your PC, the game crashes. I should note that I tested it out and it seems that this only seems to happen with gift Pokemon and not when you catch wild Pokemon and swap an existing egg out.

Any idea how to fix this? I should note that DDROWZEE is a custom Pokemon in my Pokedex, so it's not a spelling error in the gift Pokemon's name.

Last edited: