• Do not use Discord to host any images you post, these links expire quickly! You can learn how to add images to your posts here.
  • Eevee Expo's webhost has been having technical issues since Nov. 20th and you might be unable to connect to our site. Staff are also facing issues connecting, so please send a DM to Cat on-site or through Discord directly for faster service!

Custom ability not working

Charinjago

Rookie
Member
Joined
Feb 9, 2025
Posts
3
Hi, I am trying to make an ability that makes the user resistant to any move and hit super-effectively any foe. I tried copying and tweaking Thick Fat (for the DamageCalcFromTarget handler) and Water Bubble (for the DamageCalcFromUser handler) but it doesn't work and I can't understand why. I defined it in the PBS (I know because the game recognizes it), so I think I either wrote something wrong in the scripts (Battle_AbilityEffects section, don't know if it's wrong), or forgot to define something somewhere.



DamageCalcFromUser handler:

Ruby:
Expand Collapse Copy
Battle::AbilityEffects::DamageCalcFromUser.add(:DIVINITY,

  proc { |ability, user, target, move, mults, power, type|

   mults[:attack_multiplier] *=2

  }

}

DamageCalcFromTarget handler:

Ruby:
Expand Collapse Copy
Battle::AbilityEffects::DamageCalcFromTarget.add(:DIVINITY,

  proc { |ability, user, target, move, mults, power, type|

   mults[:power_multiplier] /=0.75

  }

}

Could someone help please?
 

wrigty12

Tester-Coder Hybrid
Member
Joined
Jul 24, 2022
Posts
577
Hi, I am trying to make an ability that makes the user resistant to any move and hit super-effectively any foe. I tried copying and tweaking Thick Fat (for the DamageCalcFromTarget handler) and Water Bubble (for the DamageCalcFromUser handler) but it doesn't work and I can't understand why. I defined it in the PBS (I know because the game recognizes it), so I think I either wrote something wrong in the scripts (Battle_AbilityEffects section, don't know if it's wrong), or forgot to define something somewhere.



DamageCalcFromUser handler:

Ruby:
Expand Collapse Copy
Battle::AbilityEffects::DamageCalcFromUser.add(:DIVINITY,

  proc { |ability, user, target, move, mults, power, type|

   mults[:attack_multiplier] *=2

  }

}

DamageCalcFromTarget handler:

Ruby:
Expand Collapse Copy
Battle::AbilityEffects::DamageCalcFromTarget.add(:DIVINITY,

  proc { |ability, user, target, move, mults, power, type|

   mults[:power_multiplier] /=0.75

  }

}

Could someone help please?
Those edit the damage output, but it won't change the effectiveness (you won't see "not very effective" or "super effective"). For that, you'll need to add something to the pbCalcTypeMod function.

Use CTRL + SHIFT + F to search for "def pbCalcTypeMod(moveType, user, target)" and open the one in the "Move_UsageCalculations" script. Before the lines
Code:
Expand Collapse Copy
    # Get effectivenesses
    if moveType == :SHADOW

add
Code:
Expand Collapse Copy
return Effectiveness::NOT_VERY_EFFECTIVE_MULTIPLIER if target.hasActiveAbility?(:DIVINITY)
return Effectiveness::SUPER_EFFECTIVE_MULTIPLIER if user.hasActiveAbility?(:DIVINITY)
return Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER if target.hasActiveAbility?(:DIVINITY) && user.hasActiveAbility?(:DIVINITY)

It's untested, but it probably works.
 

Charinjago

Rookie
Member
Joined
Feb 9, 2025
Posts
3
Thanks but I solved it: I deleted what I wrote in Battle_AbilityEffects and split it into 2 scripts. I tweaked Tera Shell for the resistance and Mind's Eye for the super-effectiveness (I'm using the gen 9 pack) like this:



Plugins\Generation 9 Pack Scripts\[004] Abilities\[002] DLC Abilities.rb

#===================================================================================
# Divinity
#===================================================================================
Battle::AbilityEffects::ModifyTypeEffectiveness.add(:DIVINITY,

proc { |ability, user, target, move, battle, effectiveness|

next if !move.damagingMove?

next if user.hasMoldBreaker?

next if effectiveness < Effectiveness::NORMAL_EFFECTIVE_MULTIPLIER

next Effectiveness::NOT_VERY_EFFECTIVE_MULTIPLIER

}

)

Plugins\Generation 9 Pack Scripts\[001] Battle\[001] Battle.rb (under "class Battle::Move"; credit to Swdfm for this code)
#-----------------------------------------------------------------------------
# Divinity
#-----------------------------------------------------------------------------

alias swdfm_pbCalcTypeModSingle pbCalcTypeModSingle
def pbCalcTypeModSingle(moveType, defType, user, target)
ret = swdfm_pbCalcTypeModSingle(moveType, defType, user, target)
if user.hasActiveAbility?(:DIVINITY)
ret = Effectiveness::SUPER_EFFECTIVE_MULTIPLIER
end
return ret
end
 
Back
Top