- 152
- Posts
- 11
- Years
- Seen May 11, 2015
So, I'm trying to add in effects for new moves, but I've run into some trouble.
Here's the code:
The move is supposed to raise the user's Defense and Sp. Defense, and restores 1/2 of the user's max HP. However, when I run, I'm told that that there's a syntax error at line 7589. Which is the second to last "end." So I tried a little more tweaking, into this:
And again, there's a syntax error, which is now on the last "end" (line 7585)
I honestly have no idea what I'm doing. Someone help me.
Here's the code:
Code:
class PokeBattle_Move_138 < PokeBattle_Move
def pbEffect(attacker,opponent)
if attacker.hp==attacker.totalhp
@battle.pbDisplay(_INTL("{1}'s HP is full!",attacker.pbThis))
return -1
end
if attacker.pbTooHigh?(PBStats::DEFENSE) &&
attacker.pbTooHigh?(PBStats::SPDEF)
@battle.pbDisplay(_INTL("{1}'s stats won't go higher!",attacker.pbThis))
return -1
end
@battle.pbAnimation(@id,attacker,nil)
hpgain=(attacker.totalhp/2).floor
attacker.pbRecoverHP(hpgain)
@battle.pbDisplay(_INTL("{1} regained health!",attacker.pbThis))
end
if !attacker.pbTooHigh?(PBStats::DEFENSE)
@battle.pbCommonAnimation("StatUp",attacker,nil)
attacker.pbIncreaseStatBasic(PBStats::DEFENSE,1)
@battle.pbDisplay(_INTL("{1}'s Defense rose!",attacker.pbThis))
end
if !attacker.pbTooHigh?(PBStats::SPDEF)
@battle.pbCommonAnimation("StatUp",attacker,nil)
attacker.pbIncreaseStatBasic(PBStats::SPDEF,1)
@battle.pbDisplay(_INTL("{1}'s Special Defense rose!",attacker.pbThis))
end
return 0
end
end
end
The move is supposed to raise the user's Defense and Sp. Defense, and restores 1/2 of the user's max HP. However, when I run, I'm told that that there's a syntax error at line 7589. Which is the second to last "end." So I tried a little more tweaking, into this:
Code:
class PokeBattle_Move_138 < PokeBattle_Move
def pbEffect(attacker,opponent)
if attacker.hp==attacker.totalhp ||
attacker.pbTooHigh?(PBStats::DEFENSE) &&
attacker.pbTooHigh?(PBStats::SPDEF)
@battle.pbDisplay(_INTL("But it failed!",attacker.pbThis))
return -1
end
@battle.pbAnimation(@id,attacker,nil)
hpgain=(attacker.totalhp/2).floor
attacker.pbRecoverHP(hpgain)
end
if !attacker.pbTooHigh?(PBStats::DEFENSE)
@battle.pbCommonAnimation("StatUp",attacker,nil)
attacker.pbIncreaseStatBasic(PBStats::DEFENSE,1)
@battle.pbDisplay(_INTL("{1}'s Defense rose!",attacker.pbThis))
end
if !attacker.pbTooHigh?(PBStats::SPDEF)
@battle.pbCommonAnimation("StatUp",attacker,nil)
attacker.pbIncreaseStatBasic(PBStats::SPDEF,1)
@battle.pbDisplay(_INTL("{1}'s Special Defense rose!",attacker.pbThis))
end
return -1
end
end
And again, there's a syntax error, which is now on the last "end" (line 7585)
I honestly have no idea what I'm doing. Someone help me.
Last edited: