Male
Seen 5 Days Ago
Posted November 23rd, 2019
25 posts
3.7 Years
Thanks so much for your help. However when I try to use the updated one (with the x's changed to variable 37) I get the follow error:

---------------------------
Exception: RuntimeError

Message: Script error within event 13, map 112 (Sprite testing facility):

Exception: NoMethodError

Message: Section197:17:in `restoreteam'undefined method `totalhp=' for #<PokeBattle_Pokemon:0x11b7e588>
-----------------------

I've tried switching around the order in which the values are restored but it's always the first stat after level that causes an error.

this is my full code:
-----------
def saveteam
$game_variables[37] = []
for i in $Trainer.party
$game_variables[37].push(i.clone)
i.level = 50 # Set this to whatever preset level you want
i.calcStats
end
end

def restoreteam
for i in 0...$game_variables[37].length
poke = $Trainer.party[i]
clonepoke = $game_variables[37][i]
# Need to set all these variables because the calcStats from before the battle changed them
poke.level = clonepoke.level
poke.hp = clonepoke.hp
poke.attack = clonepoke.attack
poke.defense = clonepoke.defense
poke.speed = clonepoke.speed
poke.spatk = clonepoke.spatk
poke.spdef = clonepoke.spdef
poke.totalhp = clonepoke.totalhp
end
$game_variables[37] = 0
end
--------------