Checking a pokemon's held item

lozenge

Novice
Member
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

Member
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
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

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