• 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.

[Scripting Question] Delete specific pokemon from party

35
Posts
8
Years
    • Seen Jun 3, 2023
    Hello! Pls How to make it, if I want delete specific pokemon from my party? "For example some NPC Trainer wants Rattata, so I give him rattata if it's member of my party." I know about pbRemovePokemonAt(index) but I want remove specific pokemon. Thank you!!
     
    226
    Posts
    8
    Years
    • Seen Jul 19, 2023
    The answer is in the wiki. It should look like this. Just copy/paste from 0 to 5.

    @>Conditional Branch: Script: $Trainer.pokemonParty[0].species==PBSpecies::RATTATA
    @>pbRemovePokemonAt(0)
    : Else
    : Branch End
     
    296
    Posts
    9
    Years
  • The answer is in the wiki. It should look like this. Just copy/paste from 0 to 5.
    There is a more simple way.
    Raki07, you can put a script event command into your NPC with this code:
    Code:
    for i in 0...$Trainer.party.length
    if $Trainer.party[i].species==PBSpecies::RATTATA
    $Trainer.party[i]=nil
    $Trainer.party.compact
    break
    end
    end
     
    15
    Posts
    7
    Years
    • Seen Aug 19, 2017
    Give a conditional branch saying

    @>Conditional Branch: Script: $Trainer.pokemonParty[0].species==PBSpecies::RATTATA
    @>
    : Else
    : Branch End

    Then add a new script into the conditional branch the script is--

    @>pbRemovePokemonAt(0)

    The final result will be like this

    @>Conditional Branch: Script: $Trainer.pokemonParty[0].species==PBSpecies::RATTATA
    @>pbRemovePokemonAt(0)
    : Else
    : Branch End


    Give credit if you want to.
     
    35
    Posts
    8
    Years
    • Seen Jun 3, 2023
    Give a conditional branch saying

    @>Conditional Branch: Script: $Trainer.pokemonParty[0].species==PBSpecies::RATTATA
    @>
    : Else
    : Branch End

    Then add a new script into the conditional branch the script is--

    @>pbRemovePokemonAt(0)

    The final result will be like this

    @>Conditional Branch: Script: $Trainer.pokemonParty[0].species==PBSpecies::RATTATA
    @>pbRemovePokemonAt(0)
    : Else
    : Branch End


    Give credit if you want to.


    Working only if is Rattata on first place. Is it possible make script if rattata is at another place in party (it doesn matter what it is) ?
     
    Last edited:
    35
    Posts
    8
    Years
    • Seen Jun 3, 2023
    There is a more simple way.
    Raki07, you can put a script event command into your NPC with this code:
    Code:
    for i in 0...$Trainer.party.length
    if $Trainer.party[i].species==PBSpecies::RATTATA
    $Trainer.party[i]=nil
    $Trainer.party.compact
    break
    end
    end

    I don't know what is bad but:

    Exception: RuntimeError
    Message: Script error within event 5, map 55 (Viridian Forest House):
    Exception: NoMethodError
    Message: (eval):3:in `pbExecuteScript'undefined method `species' for [0]:Array
    ***Full script:
    for i in 0...$Trainer.party.length
    if $Trainer.party
    .species==PBSpecies::RATTATA
    $Trainer.party=nil
    $Trainer.party.compact
    break
    end
    end

    Interpreter:243: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:198:in `update'

    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 `update'
    Scene_Map:101:in `loop'
    Scene_Map:114:in `update'
    Scene_Map:68:in `main'
     
    220
    Posts
    13
    Years
    • Seen Nov 29, 2021
    Forgive me, but wouldn't it be simpler to hijack the trade scripts, so that the player chooses a pokemon, then that's checked to see if it's a Ratatta, and if it is, delete it?

    From the OP it sounds like a trade, sans actually receiving a pokemon.
     
    35
    Posts
    8
    Years
    • Seen Jun 3, 2023
    Forgive me, but wouldn't it be simpler to hijack the trade scripts, so that the player chooses a pokemon, then that's checked to see if it's a Ratatta, and if it is, delete it?

    From the OP it sounds like a trade, sans actually receiving a pokemon.

    Well, good idea! It can be like you say.

    Anyone know how to do it?
     
    Last edited by a moderator:
    15
    Posts
    7
    Years
    • Seen Aug 19, 2017
    Working only if is Rattata on first place. Is it possible make script if rattata is at another place in party (it doesn matter what it is) ?

    Just make a bunch of this conditional branch saying from (0) to (5) just keep changing the (0) until you reach 5
     
    35
    Posts
    8
    Years
    • Seen Jun 3, 2023
    Just make a bunch of this conditional branch saying from (0) to (5) just keep changing the (0) until you reach 5

    Well, this is possible when I have 6 pokemons in party.
    If I have only 5, conditional branch makes error:

    0BD5.png


    6u6x.png
     
    Last edited:
    35
    Posts
    7
    Years
    • Seen Nov 1, 2018
    you reply 1yr later lol anyway i'll share you one script in the game i'm making.

    Spoiler:

    paste it somewhere above main.

    to use just write in event script section [S-HIGHLIGHT]removePkmn(:BULBASAUR)[/S-HIGHLIGHT] or whatever pokemon you want and you can use it many times as you want.
     
    Last edited:
    35
    Posts
    8
    Years
    • Seen Jun 3, 2023
    you reply 1yr later lol anyway i'll share you one script in the game i'm making.

    Spoiler:

    paste it somewhere above main.

    to use just write in event script section [S-HIGHLIGHT]removePkmn(:BULBASAUR)[/S-HIGHLIGHT] or whatever pokemon you want and you can use it many times as you want.


    Hello!
    Yeap! I forgot i! :laugh-squinted: Yesterday I found this same question on another forum and I would done it :smile:

    Your script doesn't work me. Script doesn't make any error, but do nothing.
    Script:
    Spoiler:

    CB:
    Spoiler:


    BUT

    This script:

    Spoiler:

    with call:
    Spoiler:

    by Leilou

    Working!!

    So lets work with this because it needs little bit edit.
    This script delete all specific pokemons in party that you have 2 or more.
    I need delete only one.
    Also If you have only one pokemon do nothing. It will be good show in Kernel.pbMessage something like "You have only one pokemon!"

    At end this post I would say: Thank you all people, who post here any solution. I really appreciate it
     
    Last edited:
    35
    Posts
    8
    Years
    • Seen Jun 3, 2023
    !SOLVED!

    This script is finally what I want.
    100% working.


    Spoiler:


    Thank you all!
    Script made by Leilou
     
    35
    Posts
    7
    Years
    • Seen Nov 1, 2018
    ahh sorry I made a shortcut in scriptcall it should be removePkmn(PBSpecies::BULBASAUR)
    but anyway good that something work on you!
     
    Back
    Top