• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Our weekly protagonist poll is now up! Vote for your favorite Conquest protagonist in the poll by clicking here.
  • 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] Another PKMN-Storing Question

  • 132
    Posts
    10
    Years
    This is a script for storing a pokémon as a variable and then deleting it:
    Code:
    for i in 0...$Trainer.party.length
      if isConst?($Trainer.party[i].species,PBSpecies,:PIKACHU)
        $game_variables[42]=$Trainer.party[i]
        pbRemovePokemonAt(i)
        break
      end
    end
    My question is, how do I change this to search for the 1st pokémon in the party, 2nd pokémon, 3rd, etc? Instead of searching for specifically pikachu, how can I incorporate $Trainer.party[0], for example? Seems like finding the pokémon's index isn't the best way to go about it, but I've tried other seemingly fail-proof methods that resulted in:
    [PokeCommunity.com] Another PKMN-Storing Question

    Thanks!
     
    Last edited by a moderator:
    You mean like this?
    Code:
    for i in 0...$Trainer.party.length 
    if $Trainer.party[i]==$Trainer.party[0] #checks for the first Pokemon 
    $game_variables[42]=$Trainer.party[i] pbRemovePokemonAt(i) break end end

    Not sure if I understood you right, that you want to store the first/second/third Pokemon in a variable
     
    Ego's script is unnecessary, you just need the two lines, but I made it into a method so you don't have to hardcode it everytime you want to call it.
    Code:
    def pbRemoveAndStoreFromIndex(index)
        return if $Trainer.party.size<=index
        $game_variables[42]=$Trainer.party[index]
        pbRemovePokemonAt(index)
    end
    Just call the method with whatever index
     
    Back
    Top