Help Making a EV Boosting Item that Boosts multiple stats

MarcStuts08

Rookie
Member
Posts
8
#1
So I'm working on a cooking script for my game, and some of the more advanced items are going to boost multiple stats (Like Attack and Speed EVs get Boosted).

I've got the items all setup for the individual stats, but I'm having trouble getting item scripts made up that would boost multiple stats, what would I have to put in this script line to make it so (for example) both Attack AND Speed are getting their EVs boosted?

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

I imagine what I need to change is somewhere in the "PBStats::" line, but I'm not sure what symbol is used to combine multiple stats together, any advice?
 

Poq

Trainer
Member
Posts
58
#2
Why not try something simple like
Ruby:
if pbRaiseEffortValuesCandy(pokemon,PBStats::ATTACK)==0
    scene.pbDisplay(_INTL("It won't have any effect."))
    next false
elsif pbRaiseEffortValuesCandy(pokemon,PBStats::SPEED)==0
    scene.pbDisplay(_INTL("It won't have any effect."))
    next false
else
    scene.pbDisplay(_INTL("{1}'s stats increased.",pokemon.name))
    pokemon.changeHappiness("vitamin")
    next true
end
 
Posts
13
#3
Why not try something simple like
Ruby:
if pbRaiseEffortValuesCandy(pokemon,PBStats::ATTACK)==0
    scene.pbDisplay(_INTL("It won't have any effect."))
    next false
elsif pbRaiseEffortValuesCandy(pokemon,PBStats::SPEED)==0
    scene.pbDisplay(_INTL("It won't have any effect."))
    next false
else
    scene.pbDisplay(_INTL("{1}'s stats increased.",pokemon.name))
    pokemon.changeHappiness("vitamin")
    next true
end
Borrowing the formatting, I was also thinking of something like the following, if you
  1. Want your item to raise Effort Points as long as at least one of Attack or Speed isn't maxed out, and
  2. Don't need the game to tell you exactly which stat(s) the item raised:
Ruby:
statsRaised = [pbRaiseEffortValuesCandy(pokemon,PBStats::ATTACK)>0,pbRaiseEffortValuesCandy(pokemon,PBStats::SPEED)>0].any?
if statsRaised
    scene.pbDisplay(_INTL("{1}'s stats increased.",pokemon.name))
    pokemon.changeHappiness("vitamin")
else
    scene.pbDisplay(_INTL("It won't have any effect."))
end
next statsRaised
 
Last edited:

kmb

dabbling in game design
Member
Posts
61
#4
Isn't there an in-game item that kind of already does something like that? Look at the code for the item "Elixir." That might give you a good idea of how to raise multiple stats?
 
Top