Help Checking a pokemon's held item

lozenge

Novice
Member
Posts
11
#1
Is there any simple way to make an event that checks a pokemon's held item? I know from the wiki that you can check if a pokemon has a certain move, but I already tried replacing hasMove with hasItem and it didn't work.
 

NoodlesButt

Addicted to Jams
Member
#2
Here's an event that checks the item of the Pokémon in the first slot. I wasn't sure which Pokémon you wanted to check.

Ruby:
pbFirstAblePokemon(1)

pkmn=pbGetPokemon(1)
pbSet(2,PBItems.getName(pkmn.item))
 

lozenge

Novice
Member
Posts
11
#3
Here's an event that checks the item of the Pokémon in the first slot. I wasn't sure which Pokémon you wanted to check.
Thank you so much for the script! It works, but is there a way to check if the Pokemon is holding a specific item and a conditional branch based on that, like pbChooseItem? (storing the item number to a variable)
 

NoodlesButt

Addicted to Jams
Member
#4
Thank you so much for the script! It works, but is there a way to check if the Pokemon is holding a specific item and a conditional branch based on that, like pbChooseItem? (storing the item number to a variable)
pbSet will store pkmn.item (which is the id of the item) into variable 2
Ruby:
pkmn=pbGetPokemon(1)
pbSet(2,pkmn.item)
Then you just need a conditional branch checking if variable 2 (or whatever variable you stored the item in) is equal to the id of the item you want to check.

This example checks if variable 2 is equal to 6, the ID of honey in items.txt
 
Top