Advertiser Content
Seen July 30th, 2019
Posted July 24th, 2019
28 posts
3.8 Years
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.

WolfPP

Discord: Wolf#1235

Male
Brazil
Seen 2 Hours Ago
Posted 3 Hours Ago
906 posts
1.3 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
Seen 6 Days Ago
Posted July 6th, 2019
61 posts
3 Years
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:

################################################################################
# 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])
      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
    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
Seen July 30th, 2019
Posted July 24th, 2019
28 posts
3.8 Years
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.
Advertiser Content