• 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] Check Level and Species in an Event for a Reward?

  • 30
    Posts
    11
    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?
     
  • 658
    Posts
    7
    Years
    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:
  • 30
    Posts
    11
    Years
    • Seen Apr 9, 2023
    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 :/
     
  • 71
    Posts
    6
    Years
    • Seen May 24, 2024
    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
     
  • 30
    Posts
    11
    Years
    • Seen Apr 9, 2023
    Where abouts? That makes sense, but I tried adding it where I expected and I just get errors.
     
  • 658
    Posts
    7
    Years
    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.
     
  • 30
    Posts
    11
    Years
    • Seen Apr 9, 2023
    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