• 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] Item that Increases IVs

26
Posts
6
Years
  • Age 28
  • Seen Dec 19, 2018
Hi. So I want to make an item that works similar to EV vitamins but instead raises a selected IV to its max (31). I think Pokemon Reborn has something called the IV stone that works like that. I was told to just copy the EV Vitamin script and change it to IV but it doesn't really seem to be that simple lol. Here's the Vitamin script for reference.

Code:
ItemHandlers::UseOnPokemon.add(:CARBOS,proc{|item,pokemon,scene|
   if pbRaiseEffortValues(pokemon,PBStats::SPEED)==0
     scene.pbDisplay(_INTL("It won't have any effect."))
     next false
   else
     scene.pbDisplay(_INTL("{1}'s Speed increased.",pokemon.name))
     pokemon.changeHappiness("vitamin")
     next true
   end
})


Can anyone lend me a hand?
 
Last edited:
188
Posts
9
Years
  • Age 39
  • Seen Jan 21, 2024
You can try this code:
Code:
ItemHandlers::UseOnPokemon.add(:HPIVSTONE,proc{|item,pokemon,scene|
   if pokemon.iv[PBStats::HP]>=31
     scene.pbDisplay(_INTL("It won't have any effect."))
     next false
   else
     pokemon.iv[PBStats::HP]=31
     scene.pbRefresh
     scene.pbDisplay(_INTL("{1}'s HP increased.",pokemon.name))
     pokemon.changeHappiness("groom")
     next true
   end
})
This assumes you would have separate items for each stat like with the vitamins. A side effect of using items that alter IVs is Hidden Power may change its type.
 
26
Posts
6
Years
  • Age 28
  • Seen Dec 19, 2018
You can try this code:
Code:
ItemHandlers::UseOnPokemon.add(:HPIVSTONE,proc{|item,pokemon,scene|
   if pokemon.iv[PBStats::HP]>=31
     scene.pbDisplay(_INTL("It won't have any effect."))
     next false
   else
     pokemon.iv[PBStats::HP]=31
     scene.pbRefresh
     scene.pbDisplay(_INTL("{1}'s HP increased.",pokemon.name))
     pokemon.changeHappiness("groom")
     next true
   end
})
This assumes you would have separate items for each stat like with the vitamins. A side effect of using items that alter IVs is Hidden Power may change its type.

This works perfectly! Thanks my dude.
 

BeClawKing

Yeah just my Profile ^^
23
Posts
7
Years
You can try this code:
Code:
ItemHandlers::UseOnPokemon.add(:HPIVSTONE,proc{|item,pokemon,scene|
   if pokemon.iv[PBStats::HP]>=31
     scene.pbDisplay(_INTL("It won't have any effect."))
     next false
   else
     pokemon.iv[PBStats::HP]=31
     scene.pbRefresh
     scene.pbDisplay(_INTL("{1}'s HP increased.",pokemon.name))
     pokemon.changeHappiness("groom")
     next true
   end
})
This assumes you would have separate items for each stat like with the vitamins. A side effect of using items that alter IVs is Hidden Power may change its type.


Hello this item max the iv to 31? when yes how its possible to grow the iv two up when use it

sry for my bad english im german
 
188
Posts
9
Years
  • Age 39
  • Seen Jan 21, 2024
It is possible. Just change the line pokemon.iv[PBStats::HP]=31 to pokemon.iv[PBStats::HP]=(pokemon.iv[PBStats::HP]==30) ? 31 : pokemon.iv[PBStats::HP]+2.

This accounts for the HP IV's parity being even.
 
Last edited:
Back
Top