Auto-translated
the function that triggers when a level is gained can be changed like this, because GetGameVar doesn't return exactly what you want:
function HeroLevelSaveF()
SetGameVar("LevR", ceil(GetHeroLevel('Raelag')); --Increases the hero level variable by 1
print("We set LevR to Set Game Var");
end
also, fireball is not a targeted spell, but an area-of-effect spell, so it needs to be cast differently:
for i, creature in GetDefenderCreatures() do
local x, y = pos(creature)
startThread(UnitCastAreaSpell, GetAttackerHero(), 5, x, y);
print("Casting fireball");
end