• 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.
  • Ever thought it'd be cool to have your art, writing, or challenge runs featured on PokéCommunity? Click here for info - we'd love to spotlight your work!
  • Dawn, Gloria, Juliana, or Summer - which Pokémon protagonist is your favorite? Let us know by voting in our poll!
  • 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] Friendship Ability :D

  • 4
    Posts
    4
    Years
    • Seen Jan 23, 2022
    Can someone help me make an ability based on the happiness stat. I need help making the script for essentials v19.1.

    I was thinking a multiplier, where it multiplies the base stats using * (1+happiness/255) so that it can only be multiplied to a max of 2.

    Please and thank you! Any advice is appreciated!
     
    Can someone help me make an ability based on the happiness stat. I need help making the script for essentials v19.1.

    I was thinking a multiplier, where it multiplies the base stats using * (1+happiness/255) so that it can only be multiplied to a max of 2.

    Please and thank you! Any advice is appreciated!

    Generally I don't help with v19.1 because I use only v18.1, but this time it's basically the same solution :)

    I highly suggest you don't change the base stats of the Pokémon, but the calculated stats, like Huge Power or Flower Gift. Changing the base stats requires editing the core of Pokémon Essentials, while it's more reliable to add content to it without modifying what exists.

    So let's say your ability is called "Power of Love". You have to define it in the database (the PBS files):

    Code:
    XXXX,POWEROFLOVE,Power of Love,"Gains strength from affinity with the trainer."

    where XXXX is the ID of the ability (should be unique in the file abilities.txt).

    Then you have to code its effect. Make a new script in the script editor (Tools > Script Editor) and paste this:

    Code:
    # This code boosts the Attack of Special Attack (depending on the move used) based on happiness.
    BattleHandlers::DamageCalcUserAbility.add(:POWEROFLOVE,
      proc { |ability,user,target,move,mults,baseDmg,type|
        mults[:attack_multiplier] *= (1 + (user.happiness / 255)).floor
      }
    )
    
    # This code boosts the Defense of Special Defense (depending on the move used) based on happiness.
    BattleHandlers::DamageCalcTargetAbility.add(:POWEROFLOVE,
      proc { |ability,user,target,move,mults,baseDmg,type|
        mults[:defense_multiplier] *= (1 + (user.happiness / 255)).floor
      }
    )
     
    Back
    Top