#Not Important
All hail the wishmaker
- 905
- Posts
- 5
- Years
- He/Him
- Hoenn
- Seen Jul 22, 2023
So, I made a new gimmick for my game called 'spirit powers' , I have it all running apart from the actual gimmick.
You click 'z' when in a battle and the conditions are right.
BUT
I keep getting a syntax error on line 285 (
if you would like to see how I set it all out (I have made the line giving me problems bold) here it is:
[/CODE]
I didn't end the PokeBattle_Battle class because I have some more rewrites below it
Thanks in advance!Thanks in advance!
You click 'z' when in a battle and the conditions are right.
BUT
I keep getting a syntax error on line 285 (
opp1.pbReduceHP((opp1.totalhp/2).floor
)if you would like to see how I set it all out (I have made the line giving me problems bold) here it is:
Spoiler:
Code:
[CODE]class PokeBattle_Battle
def pbSpiritEffects(index)
user=@battlers[index]
ally=user.pbPartner
# User is player's left slot
if user==@battlers[0]
opp1=user.pbOpposing2
opp2=user.pbOpposing1
# User is player's right slot
elsif user==@battlers[2]
opp1=user.pbOpposing1
opp2=user.pbOpposing2
# User is opponent's right slot
elsif user==@battlers[1]
opp1=@battlers[2]
opp2=@battlers[0]
# User is opponent's left slot
elsif user==@battlers[3]
opp1=@battlers[0]
opp2=@battlers[2]
end
allyExists = (ally && !ally.isFainted?)
opp1Exists = (opp1 && !opp1.isFainted?)
opp2Exists = (opp2 && !opp2.isFainted?)
#===========================================================================
# Booming thunder
#
# Halves opponent's hp + paralyse + disables sound moves
if user.type1==PBTypes::ELECTRIC
# User is player's left slot
if user==@battlers[0]
opp1=user.pbOpposing2
opp2=user.pbOpposing1
# User is player's right slot
elsif user==@battlers[2]
opp1=user.pbOpposing1
opp2=user.pbOpposing2
# User is opponent's right slot
elsif user==@battlers[1]
opp1=@battlers[2]
opp2=@battlers[0]
# User is opponent's left slot
elsif user==@battlers[3]
opp1=@battlers[0]
opp2=@battlers[2]
end
allyExists = (ally && !ally.isFainted?)
opp1Exists = (opp1 && !opp1.isFainted?)
opp2Exists = (opp2 && !opp2.isFainted?) #Alll of this was just an error that doesn't do anything
pbDisplay(_INTL("{1} used Booming thunder!",user.pbThis)
[B] opp1.pbReduceHP = ((opp1.totalhp/2).floor)
[/B] opp1.pbParalyze
opp2.pbReduceHP((opp2.totalhp/2).floor) if opp2Exists
opp2.pbParalyze if opp2Exists
for i in opp1.moves
if i.isSoundBased?
opp1.effects[PBEffects::Disable]=rand(3)
opp1.effects[PBEffects::DisableMove]=i
end
end
if opp2Exists
for i in opp2.moves
if i.isSoundBased?
opp2.effects[PBEffects::Disable]=rand(3)
opp2.effects[PBEffects::DisableMove]=i
end
end
end
if allyExists
for i in ally.moves
if i.isSoundBased?
ally.effects[PBEffects::Disable]=rand(3)
ally.effects[PBEffects::DisableMove]=i
end
end
end
for i in user.moves
if i.isSoundBased?
user.effects[PBEffects::Disable]=rand(3)
user.effects[PBEffects::DisableMove]=i
end
end
#===========================================================================
# Sweeping flood
#
# Does EXACTLY 50 damage to opponent + removes the fire type and adds the
# Water type, if there is a status condition on the user, it is removed
elsif user.type1==PBTypes::WATER
pbDisplay(_INTL("{1} used Sweeping flood!",user.pbThis)
opp1.pbReduceHP(50)
opp2.pbReduceHP(50)
if opp1.type1 == PBTypes::FIRE
opp1.type1 = PBTypes::WATER
end
if opp1.type2 == PBTypes::FIRE
opp1.type2 = PBTypes::WATER
end
if opp2 != nil
if opp2.type1 == PBTypes::FIRE
opp2.type1 = PBTypes::WATER
end
if opp2.type2 == PBTypes::FIRE
opp2.type2 = PBTypes::WATER
end
end
userstatus=(user.status>0 || user.effects[PBEffects::Confusion]>0)
#===========================================================================
# Endless flame
#
# Burns Opponents, does 1/3rd of opponent(1)'s HP, does 40 damage to
# opponent 2, all grass types are KO'ed
elsif user.type1==PBTypes::FIRE
pbDisplay(_INTL("{1} used Endless flame!",user.pbThis)
if opp1Exists && ((opp1.type1 == PBTypes::GRASS) || (opp1.type2 == PBTypes::GRASS)
opp1.pbReduceHP(opp1.hp)
end
if opp2Exists && ((opp2.type1 == PBTypes::GRASS) || (opp2.type2 == PBTypes::GRASS)
opp2.pbReduceHP(opp2.hp)
end
opp1.pbBurn
opp2.pbBurn if opp2Exists
opp1.pbReduceHP((opp1.hp/3).floor)
opp2.pbReduceHP(40) if opp2Exists
#===========================================================================
# Overgrowing Vines
#
# Seeds all battlers apart from user, puts all opponents to sleep
elsif user.type1==PBTypes::GRASS
pbDisplay(_INTL("{1} used Overgrowing vines!",user.pbThis)
opp1.pbSleep
opp2.pbSleep if opp2 != nil
opp1.effects[PBEffects::LeechSeed]=attacker.index
opp2.effects[PBEffects::LeechSeed]=attacker.index if opp2 != nil
ally.effects[PBEffects::LeechSeed]=attacker.index if ally != nil
#===========================================================================
# Punishment
#
# Does damage equal to the users level to opponents
elsif user.type1==PBTypes::NORMAL
pbDisplay(_INTL("{1} used Punishment!",user.pbThis)
opp1.pbReduceHP(user.level)
opp2.pbReduceHP(user.level) if opp2 != nil
#===========================================================================
# Poisoning Wave
#
# Poisons all opponents, does damage equal to the users defence to opponents
# All normal and ghost types have their hp halved
elsif user.type1==PBTypes::POISON
pbDisplay(_INTL("{1} used Poisoning wave!",user.pbThis)
opp1.pbPoison
opp2.pbPoison if opp2 != nil
opp1.pbReduceHP((opp1.hp/2).floor) if (opp1.type1 == (PBTypes::NORMAL || PBTypes::GHOST))
opp1.pbReduceHP((opp1.hp/2).floor) if (opp1.type2 == (PBTypes::NORMAL || PBTypes::GHOST))
if opp2 != nil
opp2.pbReduceHP((opp2.hp/2).floor) if (opp2.type1 == (PBTypes::NORMAL || PBTypes::GHOST))
opp2.pbReduceHP((opp2.hp/2).floor) if (opp2.type2 == (PBTypes::NORMAL || PBTypes::GHOST))
end
opp1.pbReduceHP((opp1.defence).floor)
opp2.pbReduceHP((opp2.defence).floor) if opp2 != nil
#===========================================================================
# Nightfall
#
# Dark types are healed by 1/3 of health, other battlers are all damaged and
# opponents loose speed
elsif user.type1==PBTypes::DARK
pbDisplay(_INTL("{1} used Nightfall!",user.pbThis)
user.pbReduceHP(-(user.hp + (user.hp/3)))
if opp1.type1==PBTypes::DARK
opp1.hp=(opp1.hp + (opp1.hp/3)
end
if opp2 != nil
if opp2.type1==PBTypes::DARK
opp2.hp=(opp2.hp + (opp2.hp/3))
end
end
if ally != nil
if ally.type1==PBTypes::DARK
ally.hp=(ally.hp + (ally.hp/3)
end
end
opp1.pbReduceHP(50)
opp2.pbReduceHP(50) if opp2 != nil
ally.pbReduceHP(50)
if opp1.pbCanReduceStatStage?(PBStats::SPEED,opp1,true)
opp1.pbReduceStat(PBStats::SPEED,2,opp1,false)
end
if opp2.pbCanReduceStatStage?(PBStats::SPEED,opp2,true) && opp2 != nil
opp2.pbReduceStat(PBStats::SPEED,2,opp2,false)
end
#===========================================================================
# Enchantment
#
# Opponents are damaged and the damage that is done to them is healed by the
# user
elsif user.type1==PBTypes::FAIRY
pbDisplay(_INTL("{1} used Enchantment!",user.pbThis)
opp1.pbReduceHP(((opp1.hp/2) + (opp1.defence/2)).floor)
opp2.pbReduceHP(((opp2.hp/2) + (opp2.defence/2)).floor) if opp2 != nil
user.pbReduceHP(-((opp1.hp/2) + (opp1.defence/2)) + ((opp2.hp/2) + (opp2.defence/2))).floor)
#===========================================================================
# Sky Dive
#
# Does 50 damage to opponents, 100 if they are airborne
elsif user.type1==PBTypes::FLYING
pbDisplay(_INTL("{1} used Sky Dive!",user.pbThis)
if opp1.isAirborne?
opp1.pbReduceHP(100)
else
opp1.pbReduceHP(50)
end
if opp2 != nil
if opp2.isAirborne?
opp2.pbReduceHP(100)
else
opp2.pbReduceHP(50)
end
end
#===========================================================================
# Icy Rend
#
# Freezes all opponents and water types become ice type
elsif user.type1==PBTypes::ICE
pbDisplay(_INTL("{1} used Icy Rend!",user.pbThis)
opp1.pbFreeze
opp2.pbFreeze
if opp1.type1==PBTypes::WATER
opp1.type1 = PBTypes::ICE
end
if opp2 != nil
if opp2.type1==PBTypes::WATER
opp2.type1 = PBTypes::ICE
end
end
if opp1.type2==PBTypes::WATER
opp1.type1 = PBTypes::ICE
end
if opp2 != nil
if opp2.type2==PBTypes::WATER
opp2.type1 = PBTypes::ICE
end
end
#===========================================================================
# Sand Hurricane
#
# Sandstorm goes up, electric types loose the electric type, does more damage
# for each groung type on the field
elsif user.type1==PBTypes::GROUND
pbDisplay(_INTL("{1} used Sand Hurricane!",user.pbThis)
dmgmult = 1 #1 because the user is ground
if opp1.type1 == PBTypes::GROUND
dmgmult += 1
end
if opp1.type2 == PBTypes::GROUND
dmgmult += 1
end
if opp2 != nil
if opp2.type1 == PBTypes::GROUND
dmgmult += 1
end
if opp2.type2 == PBTypes::GROUND
dmgmult += 1
end
end
if ally != nil
if ally.type1 == PBTypes::GROUND
dmgmult += 1
end
if ally.type2 == PBTypes::GROUND
dmgmult += 1
end
end
opp1.pbReduceHP((40*dmgmult).floor)
opp2.pbReduceHP((40*dmgmult).floor) if opp2 != nil
@battle.pbWeather=PBWeather::SANDSTORM
#===========================================================================
# Repeating Punch
#
# If the ally is fighting, the opp1 is damaged twice
elsif user.type1==PBTypes::FIGHTING
pbDisplay(_INTL("{1} used Repeating punch!",user.pbThis)
if (ally.type1 == PBTypes::FIGHTING) || (ally.type2 == PBTypes::FIGHTING)
opp1.pbReduceHP((opp1.defence).floor)
opp2.pbReduceHP((opp1.defence).floor) if opp2 != nil
end
opp1.pbReduceHP((opp1.defence).floor)
opp2.pbReduceHP((opp1.defence).floor) if opp2 != nil
#===========================================================================
# Metamorph
#
# The user doubles in HP and status conditions are removed
elsif user.type1==PBTypes::BUG
pbDisplay(_INTL("{1} used Metamorph!",user.pbThis)
user.pbReduceHP(-(user.hp))
userstatus=(user.status>0 || user.effects[PBEffects::Confusion]>0)
#===========================================================================
# Reinforce
#
# Defence is maxed out, + 60 HP
elsif user.type1==PBTypes::STEEL
pbDisplay(_INTL("{1} used Reinforce!",user.pbThis)
if user.pbCanIncreaseStatStage?(PBStats::SPEED,user,true)
user.pbIncreaseStat(PBStats::SPEED,6,user,false)
end
user.pbReduceHP(-60)
#===========================================================================
# Fade Out
#
# Does damage, then swaps out
elsif user.type1==PBTypes::GHOST
pbDisplay(_INTL("{1} used Fade Out!",user.pbThis)
opp1.pbReduceHP(50)
opp2.pbReduceHP(50) if opp2 != nil
user.pbUseSelfSwitchOut(index)
#===========================================================================
# dIsToRt
#
# tHE uSER gETS tHE gHOST tYPE [sWAPPED fOR pSYCHIC tYPE] aND tHE oPPONENT gETS tHE nORMAL tYPE
elsif user.type1==PBTypes::PSYCHIC
pbDisplay(_INTL("{1} used Distort!",user.pbThis)
opp1.type1=PBTypes::NORMAL
opp2.type1=PBTypes::NORMAL if opp2 != nil
user.type1=PBTypes::GHOST
#===========================================================================
# Bury
#
# The opponents are disabled + damaged
elsif user.type1==PBtypes::ROCK
pbDisplay(_INTL("{1} used Bury!",user.pbThis)
opp1.effects[PBEffects::Disable]=3
opp1.effects[PBEffects::DisableMove]=opp1.lastMoveUsed.id
opp2.effects[PBEffects::Disable]=3 if opp2 != nil
opp2.effects[PBEffects::DisableMove]=opp2.lastMoveUsed.id if opp2 != nil
opp1.pbReduceHP((opp1.effects[PBEffects::Disable])*40)
#===========================================================================
# Draconic Dive
#
# 80 damage to each opponent for each type the user has and confuses self
elsif user.type1==PBTypes::DRAGON
pbDisplay(_INTL("{1} used Draconic Dive!",user.pbThis)
if user.type2 != nil
opp1.pbReduceHP(160)
else
opp1.pbReduceHP(80)
end
if opp2 != nil
if user.type2 != nil
opp1.pbReduceHP(160)
else
opp1.pbReduceHP(80)
end
end
#===========================================================================
# Else
#
else
pbDisplay(_INTL("The type {1} is not supported, please add it in the spirit powers script",user.type1)
pbDisplayBrief(_INTL("Exiting the script (this will not end the battle)..."))
end
end
I didn't end the PokeBattle_Battle class because I have some more rewrites below it
Thanks in advance!Thanks in advance!