• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • 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.

Minokun

The Rival in Space
107
Posts
10
Years
    • Seen Sep 18, 2019
    Let's say an NPC want's the character to give them a Meowth DIRECTLY from their party. What script do I use to do that? Yes I know about:
    Code:
    pbRemovePokemonAt(index)
    However I don't want it to rely on the Index number, I want it to rely on the specific Pokémon that the event is asking for in the party.
     
    1,405
    Posts
    11
    Years
  • You can check each slot in the party for Meowth then delete it.



    I need something similar to this, but instead of deleting it, i want store the Pokemon somewhere else for a limited time(similar to Battle Frontier)
     
    1,224
    Posts
    10
    Years
  • Edit: Can't read this late.

    Just say something like
    Code:
    for i in $Trainer.party
    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
     
    Last edited:

    Minokun

    The Rival in Space
    107
    Posts
    10
    Years
    • Seen Sep 18, 2019
    I don't think that's possible, and if it is it's probably much more bothersome than just giving your player the pokemon directly and just use the text to say the NPC gave it
    Code:
    pbAddPokemon(pokemon,level=nil,seeform=true)
    If you plan on battling that NPC later or something ,just make another instance of him in your trainers.txt with a different suffix and without the Meowth.

    I don't want them to give you a Pokémon, I want you to give them a Pokémon.

    You can check each slot in the party for Meowth then delete it.



    I need something similar to this, but instead of deleting it, i want store the Pokemon somewhere else for a limited time(similar to Battle Frontier)

    Thanks! I'll try that method.
     

    Minokun

    The Rival in Space
    107
    Posts
    10
    Years
    • Seen Sep 18, 2019
    Edit: Can't read this late.

    Just say something like
    Code:
    for i in $Trainer.party
    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

    I got this error... Any thoughts?

    Code:
    ---------------------------
    Pokemon Rainbow
    ---------------------------
    Exception: RuntimeError
    
    Message: Script error within event 40, map 91 (Bestart Town):
    
    Exception: TypeError
    
    Message: (eval):2:in `[]'cannot convert PokeBattle_Pokemon into Integer
    
    ***Full script:
    
    for i in $Trainer.party
    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
    
    
    Interpreter:243:in `pbExecuteScript'
    
    (eval):2:in `pbExecuteScript'
    
    (eval):1:in `each'
    
    (eval):1:in `pbExecuteScript'
    
    Interpreter:1600:in `eval'
    
    Interpreter:243:in `pbExecuteScript'
    
    Interpreter:1600:in `command_355'
    
    Interpreter:494:in `execute_command'
    
    Interpreter:193:in `update'
    
    Interpreter:106:in `loop'
    
    
    
    Interpreter:276:in `pbExecuteScript'
    
    Interpreter:1600:in `command_355'
    
    Interpreter:494:in `execute_command'
    
    Interpreter:193:in `update'
    
    Interpreter:106:in `loop'
    
    Interpreter:198:in `update'
    
    Scene_Map:103:in `updateOldFL'
    
    Scene_Map:101:in `loop'
    
    Scene_Map:114:in `updateOldFL'
    
    Main:860:in `update'
    
    
    
    This exception was logged in 
    
    C:\Users\SharnJee\Saved Games/Pokemon Rainbow/errorlog.txt.
    
    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK   
    ---------------------------
     
    1,224
    Posts
    10
    Years
  • it's this line
    Code:
    if $Trainer.party[i].species==PBSpecies::MEOWTH
    change it to
    Code:
    if $Trainer.party[i].species==52
    I was trying to make it easier to edit, but apparently I don't remember how to do that. 52 is Meowth's dex number.
     

    Minokun

    The Rival in Space
    107
    Posts
    10
    Years
    • Seen Sep 18, 2019
    it's this line
    Code:
    if $Trainer.party[i].species==PBSpecies::MEOWTH
    change it to
    Code:
    if $Trainer.party[i].species==52
    I was trying to make it easier to edit, but apparently I don't remember how to do that. 52 is Meowth's dex number.

    No you were right... The wiki has it like that and I got another error when I changed it... So I tried A Different, longer route and got another error.

    Code:
    ---------------------------
    Pokemon Rainbow
    ---------------------------
    Exception: RuntimeError
    
    Message: Script error within event 40, map 91 (Bestart Town):
    
    Exception: NoMethodError
    
    Message: (eval):1:in `pbExecuteScript'undefined method `species' for nil:NilClass
    
    ***Full script:
    
    $Trainer.pokemonParty[3].species==PBSpecies::MEOWTH
    
    Interpreter:243:in `pbExecuteScript'
    
    Interpreter:788:in `eval'
    
    Interpreter:243:in `pbExecuteScript'
    
    Interpreter:788:in `command_111'
    
    Interpreter:320:in `execute_command'
    
    Interpreter:193:in `update'
    
    Interpreter:106:in `loop'
    
    Interpreter:198:in `update'
    
    Scene_Map:103:in `updateOldFL'
    
    Scene_Map:101:in `loop'
    
    
    
    Interpreter:276:in `pbExecuteScript'
    
    Interpreter:788:in `command_111'
    
    Interpreter:320:in `execute_command'
    
    Interpreter:193:in `update'
    
    Interpreter:106:in `loop'
    
    Interpreter:198:in `update'
    
    Scene_Map:103:in `updateOldFL'
    
    Scene_Map:101:in `loop'
    
    Scene_Map:114:in `updateOldFL'
    
    Main:860:in `update'
    
    
    
    This exception was logged in 
    
    C:\Users\SharnJee\Saved Games/Pokemon Rainbow/errorlog.txt.
    
    Press Ctrl+C to copy this message to the clipboard.
    ---------------------------
    OK   
    ---------------------------
     
    1,224
    Posts
    10
    Years
  • 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
     

    Minokun

    The Rival in Space
    107
    Posts
    10
    Years
    • Seen Sep 18, 2019
    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

    Alriiiiiiiiiiiiiiiiiiiight!! Thanks man it worked!!!!
     
    1,405
    Posts
    11
    Years
  • Hey mej71 would you know how to temporarily remove(like the Battle Frontier) every pokemon from the party except a specific species?

    And how to add them back after that.
     
    1,224
    Posts
    10
    Years
  • Hey mej71 would you know how to temporarily remove(like the Battle Frontier) every pokemon from the party except a specific species?

    And how to add them back after that.

    Would you be okay with temporarily storing it in the PC?
    Code:
    pkmn=$Trainer.party[2]  #I just did this, do whatever method you want for choosing the pokemon. 
    clonedpkmn=pkmn.clone
                clonedpkmn.iv=pkmn.iv.clone
                clonedpkmn.ev=pkmn.ev.clone
                pbStorePokemon(clonedpkmn)
    $Trainer.party[2]=nil
    $Trainer.party.compact!

    and to get them back just get them out of the pc. You could probably make a script to do it, or let the player do it manually.

    Not tested
     
    1,405
    Posts
    11
    Years
  • Would you be okay with temporarily storing it in the PC?
    Code:
    pkmn=$Trainer.party[2]  #I just did this, do whatever method you want for choosing the pokemon. 
    clonedpkmn=pkmn.clone
                clonedpkmn.iv=pkmn.iv.clone
                clonedpkmn.ev=pkmn.ev.clone
                pbStorePokemon(clonedpkmn)
    $Trainer.party[2]=nil
    $Trainer.party.compact!

    and to get them back just get them out of the pc. You could probably make a script to do it, or let the player do it manually.

    Not tested

    Where do i put this? I tried the script section of event commands but it gives an error

    Spoiler:


    and i'm fine with storing them into PC.
     
    1,748
    Posts
    14
    Years
  • Hey mej71 would you know how to temporarily remove(like the Battle Frontier) every pokemon from the party except a specific species?

    And how to add them back after that.

    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.
     
    Last edited:
    Back
    Top