- 79
- Posts
- 9
- Years
- Seen Jan 12, 2024
Hello, I'm trying to create an ability that removes 25% of the damage taken from "light based moves" and reflects the removed damage back onto the attacker. For example, if a light move would normally deal 100 damage, the ability would reduce it to 75 damage, and the 25 damage that was removed would hurt the attacker.
What I have so far, is:
in Pokebattle_Move:
farther down in pbCalcDamage:
Then in Pokebattle_Battler, under "if damage>0"
(since the ability is multiplying the damage by 75%, dividing the damage by 3 brings it to the 25% that I want)
The problem is that I'm receiving this error:
Which is strange, because I copied and altered from other abilities in the same section, so I'm not sure why "*" would cause an error. At first I thought it was coming from an interaction between the ability's Pokebattle_Move script and Pokebattle_Battler script, but removing the battler script still has the same error. Any help would be greatly appreciated!
What I have so far, is:
in Pokebattle_Move:
Code:
[SPOILER] def isLightMove?
return true if ( isConst?(@id,PBMoves,:SIGNALBEAM) ||
isConst?(@id,PBMoves,:SOLARBEAM) ||
isConst?(@id,PBMoves,:JUDGEMENT) ||
isConst?(@id,PBMoves,:TECHNOBLAST)
isConst?(@id,PBMoves,:LUSTERPURGE) ||
isConst?(@id,PBMoves,:POWERGEM) ||
isConst?(@id,PBMoves,:DOOMDESIRE) ||
isConst?(@id,PBMoves,:FLASHCANNON) ||
isConst?(@id,PBMoves,:DAZZLINGGLEAM) ||
isConst?(@id,PBMoves,:LIGHTOFRUIN) ||
isConst?(@id,PBMoves,:ORIGINPULSE) ||
isConst?(@id,PBMoves,:PHOTONGEYSER) ||
isConst?(@id,PBMoves,:SOLARBLADE) ||
isConst?(@id,PBMoves,:MIRRORSHOT) ||
isConst?(@id,PBMoves,:TAILGLOW) ||
isConst?(@id,PBMoves,:FLASH) ||
isConst?(@id,PBMoves,:MOONLIGHT) ||
isConst?(@id,PBMoves,:LIGHTSCREEN) ||
isConst?(@id,PBMoves,:REFLECT) ||
isConst?(@id,PBMoves,:AURORABEAM) ||
isConst?(@id,PBMoves,:HYPERBEAM) ||
isConst?(@id,PBMoves,:MOONGEISTBEAM) ||
isConst?(@id,PBMoves,:SPOTLIGHT))
end[/SPOILER]
farther down in pbCalcDamage:
Code:
if opponent.hasWorkingAbility(:MIRRORSHIELD) && isLightMove?
finaldamagemult=(finaldamagemult*0.75).round
end
Then in Pokebattle_Battler, under "if damage>0"
Code:
if target.hasWorkingAbility(:MIRRORSHIELD) && move.isLightMove?
user.pbReduceHP((turneffects[PBEffects::TotalDamage])/3)
@battle.pbDisplay(_INTL("{1} is hurt by #{target.pbThis}'s Mirror Shield!",user.pbThis))
end
(since the ability is multiplying the damage by 75%, dividing the damage by 3 brings it to the 25% that I want)
The problem is that I'm receiving this error:
Spoiler:
[Pokémon Essentials version 17.2]
Exception: NoMethodError
Message: undefined method `*' for nil:NilClass
PokeBattle_Move:706:in `pbCalcDamage'
PokeBattle_Move:1522:in `pbEffect'
PokeBattle_MoveEffects:1855:in `pbEffect'
PokeBattle_Battler:3463:in `pbProcessMoveAgainstTarget'
PokeBattle_Battler:3418:in `each'
PokeBattle_Battler:3418:in `pbProcessMoveAgainstTarget'
PokeBattle_Battler:4025:in `pbUseMove'
PokeBattle_Battler:4005:in `loop'
PokeBattle_Battler:4028:in `pbUseMove'
PokeBattle_Battler:4234:in `pbProcessTurn'
Exception: NoMethodError
Message: undefined method `*' for nil:NilClass
PokeBattle_Move:706:in `pbCalcDamage'
PokeBattle_Move:1522:in `pbEffect'
PokeBattle_MoveEffects:1855:in `pbEffect'
PokeBattle_Battler:3463:in `pbProcessMoveAgainstTarget'
PokeBattle_Battler:3418:in `each'
PokeBattle_Battler:3418:in `pbProcessMoveAgainstTarget'
PokeBattle_Battler:4025:in `pbUseMove'
PokeBattle_Battler:4005:in `loop'
PokeBattle_Battler:4028:in `pbUseMove'
PokeBattle_Battler:4234:in `pbProcessTurn'
Which is strange, because I copied and altered from other abilities in the same section, so I'm not sure why "*" would cause an error. At first I thought it was coming from an interaction between the ability's Pokebattle_Move script and Pokebattle_Battler script, but removing the battler script still has the same error. Any help would be greatly appreciated!