• 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.
  • Our friends from the Johto Times are hosting a favorite Pokémon poll - and we'd love for you to participate! Click here for information on how to vote for your favorites!
  • Serena, Kris, Dawn, Red - which Pokémon protagonist is your favorite? Let us know by voting in our grand final favorite protagonist poll!
  • PokéCommunity supports the Stop Killing Games movement. If you're a resident of the UK or EU, consider signing one of the petitions to stop publishers from destroying games. Click here for more information!
  • 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] Check Level and Species in an Event for a Reward?

  • 30
    Posts
    12
    Years
    • Seen Apr 9, 2023
    Long story short, I am looking to make an event that offers a reward for a trainer who has leveled a Smeargle to level 100.

    I have a way to see if the trainer has the species at all, but am unaware of a way to check the level of this species, but admittedly I am a novice when it comes to this sort of thing.

    Does anyone know of a solution I can implement?
     
    There are 2 things you can do:
    1. Inside the conditional branch which you use to check for Smeargle, you use a for loop to check if the Smeargle is Lv100
      Code:
      for i in $Trainer.party.length
      if isConst?($Trainer.party[i].species,PBSpecies,:SMEARGLE) && $Trainer.party[i].level==100
      Kernel.pbRecieveItem(:PRIZE)
      end
      end
    2. You can use pbChoosePokemon and use the index you get from that and check in a Conditional Branch
      Code:
      isConst?($Trainer.party[pbGet(5)].species,PBSpecies,:SMEARGLE) && $Trainer.party[pbGet(5)].level==100
      And then do whatever
     
    Last edited:
    I appreciate the reply, but I am having trouble following your suggestion!
    The first suggestion, I can't follow at all. I am unsure what a "for loop" is and wouldn't know where to begin.

    The second suggestion, I THOUGHT I understood, but I tried to implement it and it never returns True on the conditional, even when I select a level 100 Smeargle.

    Either way I appreciate your help, and if you could break things down at a more basic level, it would be even more appreciated!
    Sorry for my inexperience :/
     
    Where abouts? That makes sense, but I tried adding it where I expected and I just get errors.
     
    I appreciate the reply, but I am having trouble following your suggestion!
    The first suggestion, I can't follow at all. I am unsure what a "for loop" is and wouldn't know where to begin.
    Add a new Script Command in your event with the code I mentioned. What it does is it checks every single Pokemon in your party, and if it finds that there is a Smeargle in your party, and its level 100 then it executes the pbRecieveItem command. You can replace the pbRecieveItem with whatever you want.

    The second suggestion, I THOUGHT I understood, but I tried to implement it and it never returns True on the conditional, even when I select a level 100 Smeargle.
    I assume you know how to use pbChoosePokemon. If you don't then basically it takes 1 arguement, which is a game variable that store what Pokemon you chose. Eg: pbChoosePokemon (5) will store what Pokemon you chose in variable no. 5 of your game.

    i think there's a ".level" missing, like that its comparing the entire variable holding the pokemon at whatever index variable 5 is holding to 100
    Oh I didn't catch that lol. I'll fix it right now.

    Blackhammer, try the new code.
     
    I got it! Thanks so much for the help.
    Second option worked like a charm and I was able to do exactly what I wanted to thanks to both of your help!
     
    Back
    Top