• 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] Checking Item in pbItemRestoreHP

220
Posts
13
Years
  • Seen Nov 29, 2021
So this item boosts healing by 20%. Thing is, I don't know how I would check if it's holding an item.
Here's what I've gotten so far:

Code:
def pbItemRestoreHP(pokemon,restorehp)
  restorehp=1.2*restorehp #This needs an if statement to check item
  newhp=pokemon.hp+restorehp
  newhp=pokemon.totalhp if newhp>pokemon.totalhp
  hpgain=newhp-pokemon.hp
  pokemon.hp=newhp
  return hpgain
end
 
1,680
Posts
8
Years
  • Age 24
  • Seen today
To check the item the pokemon is holding, it's:
Code:
isConst?(pokemon.item,PBItems,:ITEMNAME)
 
220
Posts
13
Years
  • Seen Nov 29, 2021
Thanks!
I'd tried
Code:
pokemon.isConst?(@item,PBItems,:ITEMNAME)
But obviously that didn't work. Feel kinda dumb now for not thinking about sending it to the function.
 
Back
Top