• 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.

[Custom Feature Question] Happiness = Accuracy

32
Posts
8
Years
  • Age 34
  • Seen May 6, 2020
Messing around in Essentials, I ran into this feature in EBS.

For some reason, if I try to run from a trainer battle it says "Player called Treecko! Treecko! Its accuracy increased!"

Now, I wasn't expecting this, but I figured I could co-opt this feature to make happiness a bit more relevant (Since I have no idea how to port in any of the happiness related in-battle features from later gens that I would want in a perfect world. If that's even possible.)

What I would want is for the accuracy buff to only work if the happiness level is over a certain number. Better still would be if I could get two stages of accuracy when happiness is maxed out. But I don't know where this coding for the run button is defined at all.

Thanks in advance! I'm going to be asking... a lot of questions over the next few weeks/months.
 
Last edited:

WolfPP

Spriter/ Pixel Artist
1,309
Posts
5
Years
You will use '.happyness'. In case, inside battle check what definion to use, if is 'battler.happyness' or 'pokemon.happyness' (with '@' or not).
Also, to buff 2 stage if pokemon haves max happyness:
if pokemon.happyness==255
Put buff code here
Elsif pokemon.happyness>=100(the pokemon must to have 100 or more happyness to get the buff)
End
 
87
Posts
7
Years
  • Age 34
  • Seen Nov 22, 2023
WolfPP is correct, here is the whole code that you'll need to add.
Go to PokeBattle_Battle and search for "Call Battler".
Add in the red part:

Code:
################################################################################
# Call battler.
################################################################################
  def pbCall(index)
    owner=pbGetOwner(index)
    pbDisplay(_INTL("{1} called {2}!",owner.name,@battlers[index].name))
    pbDisplay(_INTL("{1}!",@battlers[index].name))
    PBDebug.log("[Call to Pokémon] #{owner.name} called to #{@battlers[index].pbThis(true)}")
    if @battlers[index].isShadow?
      if @battlers[index].inHyperMode?
        @battlers[index].pokemon.hypermode=false
        @battlers[index].pokemon.adjustHeart(-300)
        pbDisplay(_INTL("{1} came to its senses from the Trainer's call!",@battlers[index].pbThis))
      else
        pbDisplay(_INTL("But nothing happened!"))
      end
    elsif @battlers[index].status!=PBStatuses::SLEEP &&
          @battlers[index].pbCanIncreaseStatStage?(PBStats::ACCURACY,@battlers[index])
[COLOR="Red"]      if @battlers[index].happiness == 255
          @battlers[index].pbIncreaseStat(PBStats::ACCURACY,2,@battlers[index],true)
      elsif @battlers[index].happiness >= 100
          @battlers[index].pbIncreaseStat(PBStats::ACCURACY,1,@battlers[index],true)
        else
          pbDisplay(_INTL("But #{@battlers[index].pbThis(true)} didn't listen."))
      end[/COLOR]
    else
      pbDisplay(_INTL("But nothing happened!"))
    end
  end

Note that I overwrote the original line:
@battlers[index].pbIncreaseStat(PBStats::ACCURACY,1,@battlers[index],true)

Also, 100 is what I set the first happiness requirement to, change it to your liking.
elsif @battlers[index].happiness >= 100
 
Last edited:
32
Posts
8
Years
  • Age 34
  • Seen May 6, 2020
Thanks
It astounds me how well you guys understand this stuff. I'm picking it up though (if slowly), by reading the forum. The fact that you set the first limit to 100, for example, is intuitive now.
Not that I would dream of complaining about you being so thorough in your explanation.

I suppose I should ask my next happiness related questions (concerning how to add the gen 6/7 effects, such as enduring a hit at 1 hp, increased critical hit chance, and increased evasion) in a new thread?

I assume that would keep everything organized for people in the future with similar questions.
 
Last edited:
Back
Top