• 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] Another PKMN-Storing Question

132
Posts
9
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:
    H0E8Goy.png

    Thanks!
     
    Last edited by a moderator:

    Ego13

    hollow_ego
    311
    Posts
    6
    Years
  • 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
     
    1,224
    Posts
    10
    Years
  • 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