• Just a reminder that providing specifics on, sharing links to, or naming websites where ROMs can be accessed is against the rules. If your post has any of this information it will be removed.
  • There is an important update regarding account security and 2FA. Please click here for more information.
  • We're giving away 2 free copies of Pokémon Legends: Z-A! If you're interested in entering, click here for information! Entries close 9 October!
  • Forum moderator applications are currently open! Interested in applying? Click here for information!
  • 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
    7
    Years
    • 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:
    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.
     
    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.
     
    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
     
    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