• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Scottie, Todd, Serena, Kris - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

How to delete Specific Pokémon from Party.

I know you didn't ask for my help, but here's a small function:

Code:
WhiteListedPokemon = [PBSpecies::MAGIKARP] # change the pokemon here obviously.
VariableID = 54 # change this to the variable ID you want to store the pokemon in

def pbDeleteAndSavePartyPokemon
  $game_variables[VariableID] = [] if (!$game_variables[VariableID].is_a?(Array))

  for i in 0...$Trainer.party.length
    pokemon = $Trainer.party[i]
    if (!WhiteListedPokemon.include?(pokemon.species))
        $game_variables[VariableID].push(pokemon)
        pbRemovePokemonAt(i)
    end

  end

end

def pbRestoreAllDeletedPokemon
  return if (!$game_variables[VariableID].is_a?(Array))

  for pokemon in $game_variables[VariableID]
    pbAddPokemonSilent(pokemon)
  end

  $game_variables[VariableID] = []
end

This wasn't tested, but should work exactly how you want it. (Change the WhiteListedPokemon and VariableID variables to whatever suits you.)


to delete the pokemon, just call "pbDeleteAndSavePartyPokemon" and to restore "pbRestoreAllDeletedPokemon"

If you encounter errors, let me know.

Edit: As for the problem with the other script, you forgot to store it into the PC.
I get this error when the game starts

Spoiler:


As for mej71's script, i figured out it actually stored the clones into my party, and not the PC.
 
As for mej71's script, i figured out it actually stored the clones into my party, and not the PC.

I was thinking that it might have done that, but the way you put it initially led me to believe that it didn't work at all.


Try adding this instead of the other store script.
Code:
$PokemonStorage.pbStoreCaught(clonedpkmn)
 
I was thinking that it might have done that, but the way you put it initially led me to believe that it didn't work at all.


Try adding this instead of the other store script.
Code:
$PokemonStorage.pbStoreCaught(clonedpkmn)


That works thanks. Though if Umbreon posts a fix to his script i'm gonna use that instead because it's more convenient.
 
It's saying "PBSpecies" is undefined. Did you insert the script below the compiler script?

My bad, placing it under Compiler solves that error.

But now i get a new one
Spoiler:
 
Give me a bit, sorry I'm using my phone and its hard to debug like this. XD (I'll post when I fixed it on my computer)

Edit: add this directly under the for line: "break if i >= $Trainer.party.length"
 
Give me a bit, sorry I'm using my phone and its hard to debug like this. XD (I'll post when I fixed it on my computer)

Edit: add this directly under the for line: "break if i >= $Trainer.party.length"

Works now, only deletes and saves 2 pokemon at a time, but i can simply use it multiple times and it will still bring them all back.

Thanks!
 
Here's the fixed up and less sloppy version:

Code:
WhiteListedPokemon = [PBSpecies::MAGIKARP] # change the pokemon here obviously.
VariableID = 54 # change this to the variable ID you want to store the pokemon in

def pbDeleteAndSavePartyPokemon
  $game_variables[VariableID] = [] if (!$game_variables[VariableID].is_a?(Array))
  for i in 0...$Trainer.party.length
    if (!WhiteListedPokemon.include?($Trainer.party[i].species))
        $game_variables[VariableID].push(pokemon)
        $Trainer.party[i] = nil
    end
  end
  $Trainer.party.compact!
end

def pbRestoreAllDeletedPokemon
  return if (!$game_variables[VariableID].is_a?(Array))

  for pokemon in $game_variables[VariableID]
    pbAddPokemonSilent(pokemon)
  end

  $game_variables[VariableID] = []
end

All you really need is the first function, but I added it all just for copy-paste simplicity.
 
Here's the fixed up and less sloppy version:

Code:
WhiteListedPokemon = [PBSpecies::MAGIKARP] # change the pokemon here obviously.
VariableID = 54 # change this to the variable ID you want to store the pokemon in

def pbDeleteAndSavePartyPokemon
  $game_variables[VariableID] = [] if (!$game_variables[VariableID].is_a?(Array))
  for i in 0...$Trainer.party.length
    if (!WhiteListedPokemon.include?($Trainer.party[i].species))
        $game_variables[VariableID].push(pokemon)
        $Trainer.party[i] = nil
    end
  end
  $Trainer.party.compact!
end

def pbRestoreAllDeletedPokemon
  return if (!$game_variables[VariableID].is_a?(Array))

  for pokemon in $game_variables[VariableID]
    pbAddPokemonSilent(pokemon)
  end

  $game_variables[VariableID] = []
end

All you really need is the first function, but I added it all just for copy-paste simplicity.

got an error at first but i added pokemon = $Trainer.party after for i in 0...$Trainer.party.length and it now works perfectly.

Thanks a lot
 
Whoops, I forgot to change the variable pokemon to $Trainer.party, here's the fixed version for anyone else.

Code:
WhiteListedPokemon = [PBSpecies::MAGIKARP] # change the pokemon here obviously.
VariableID = 54 # change this to the variable ID you want to store the pokemon in

def pbDeleteAndSavePartyPokemon
  $game_variables[VariableID] = [] if (!$game_variables[VariableID].is_a?(Array))
  for i in 0...$Trainer.party.length
    if (!WhiteListedPokemon.include?($Trainer.party[i].species))
        $game_variables[VariableID].push($Trainer.party[i])
        $Trainer.party[i] = nil
    end
  end
  $Trainer.party.compact!
end

def pbRestoreAllDeletedPokemon
  return if (!$game_variables[VariableID].is_a?(Array))

  for pokemon in $game_variables[VariableID]
    pbAddPokemonSilent(pokemon)
  end

  $game_variables[VariableID] = []
end
 
That doesn't do anything.

My original thing was almost correct, I just derped
Code:
for i in 0..$Trainer.party.length-1
if $Trainer.party[i].species==PBSpecies::MEOWTH
Kernel.pbMessage(_INTL("{1} was removed from your party!",$Trainer.party[i].name))
$Trainer.party[i]=nil
$Trainer.party.compact!
break
end
end

here's another possibility. put this in poke utilities:

def pbdelete(variableNumber,species)
for i in 0...$Trainer.party.length
species=getID(PBSpecies,species)
p=$Trainer.party
if p && p.species==species
pbSet(variableNumber,i)
return $Trainer.party
end
end
pbSet(variableNumber,-1)
return nil
end

then an event just needs two lines of script:
pbdelete(1,:PIKACHU)
pbRemovePokemonAt(pbGet(1))

if you don't have a pikachu with you, this won't do anything. so a conditional branch with pbHasSpecies? would be useful. if you have many of them, it will delete the first one it finds in your party.
 
Back
Top