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

Methods for finding party pkmn

132
Posts
9
Years
  • I'm trying to customize an egg, but I get a crash produced by the method $Trainer.lastParty.
    Spoiler:

    The crash report:
    Spoiler:

    I recall other methods, like $Trainer.party[0], giving me grief, but I'm not sure why. I'd appreciate any help.
     
    824
    Posts
    8
    Years
  • you need to have all those scripts in a single script

    This.

    Instead of what you've got there, try this:
    make a new function in the scripts, not an event, with this code:
    Code:
    def shayminEgg?
      if Kernel.pbGenerateEgg(:SHAYMIN)
        egg=$Trainer.lastParty
        egg.level=25
        egg.calcStats
        return true
      else
        return false
      end
    end

    Now, just just "shayminEgg?" as the code in your conditional branch, and the only thing to happen inside the "true" branch is setting the self switch A to on.
     

    Maruno

    Lead Dev of Pokémon Essentials
    5,286
    Posts
    16
    Years
    • Seen May 3, 2024
    Note that the lastParty method was added in Essentials v15. If you're using an older version of Essentials, you won't have it and it won't work. Use egg=$Trainer.party.last instead.

    you need to have all those scripts in a single script
    Actually, you don't. So long as there's nothing between them (like a comment), you can have multiple separate script commands and they'll all behave as one when run.
     
    Back
    Top