- 10
- Posts
- 3
- Years
- Seen Jun 13, 2022
I don't do scripting, most of this is copy-pasted and things I inferred from similar scripts. I wanted to make an ability that made you immune to all types of attacks (a 'god' ability) and I tried to use levitate as a base. The thing with Levitate though, is that It works on a different logic than regular ability scripts. So i tried to make a custom "airborne" log and came up with this for Battler_usemoves_Success:
(and i also added this to Pokebattle_Battler beforehand of course)
But when I ran the script, it worked fine but it kept on giving me an error message over the name "Water"?
Exception: NameError
Message: uninitialized constant PokeBattle_Battler::WATER
Backtrace:
157:Battler_UseMove_SuccessChecks:443:in `pbSuccessCheckAgainstTarget'
155:Battler_UseMove:395:in `block in pbUseMove'
155:Battler_UseMove:392:in `each'
155:Battler_UseMove:392:in `pbUseMove'
155:Battler_UseMove:60:in `block in pbProcessTurn'
012:PBDebug:6:in `logonerr'
155:Battler_UseMove:59:in `pbProcessTurn'
180:Battle_Phase_Attack:126:in `block (2 levels) in pbAttackPhaseMoves'
180:Battle_Phase_Attack:122:in `each'
180:Battle_Phase_Attack:122:in `block in pbAttackPhaseMoves'
I don't know what I'm doing wrong. I don't know enough about coding to figure out the problem and I'm really tired rn to try and find it. And I don't want it to be affected by Moldbreaker. Also, would it be better if it were like Lightning Rod and most of the other abilities in the script? If so, how would I get it so it does not get any stat boosts and it only makes the pokemon is immune?
Code:
if move.damagingMove? && move.calcType == :ELECTRIC or WATER or NORMAL or FIRE or GRASS or ICE or FIGHTING or POISON or GROUND or FLYING or PSYCHIC or BUG or ROCK or GHOST or DARK or DRAGON or STEEL or FAIRY &&
target.godveil?
if PokeBattle_SceneConstants::USE_ABILITY_SPLASH
@battle.pbDisplay(_INTL("{1} avoided the attack!",target.pbThis))
else
@battle.pbDisplay(_INTL("{1} avoided the attack with {2}!",target.pbThis,target.abilityName))
end
@battle.pbHideAbilitySplash(target)
return false
end
Code:
def godveil?
return true if hasActiveAbility?(:GODVEIL)
return false
end
Exception: NameError
Message: uninitialized constant PokeBattle_Battler::WATER
Backtrace:
157:Battler_UseMove_SuccessChecks:443:in `pbSuccessCheckAgainstTarget'
155:Battler_UseMove:395:in `block in pbUseMove'
155:Battler_UseMove:392:in `each'
155:Battler_UseMove:392:in `pbUseMove'
155:Battler_UseMove:60:in `block in pbProcessTurn'
012:PBDebug:6:in `logonerr'
155:Battler_UseMove:59:in `pbProcessTurn'
180:Battle_Phase_Attack:126:in `block (2 levels) in pbAttackPhaseMoves'
180:Battle_Phase_Attack:122:in `each'
180:Battle_Phase_Attack:122:in `block in pbAttackPhaseMoves'
I don't know what I'm doing wrong. I don't know enough about coding to figure out the problem and I'm really tired rn to try and find it. And I don't want it to be affected by Moldbreaker. Also, would it be better if it were like Lightning Rod and most of the other abilities in the script? If so, how would I get it so it does not get any stat boosts and it only makes the pokemon is immune?