SetGameVar("LevR", 1);
print("We set LevR to be a Set Game Variable");
LevR = GetHeroLevel('Raelag');
You are setting the in-game variable "LevR" to 1, so you have no reason to complain – you are not changing it anywhere else.
And the next line, LevR = GetHeroLevel("Raelag"), simply assigns the hero's level (the first one) to a completely different variable.
It should be done like this:
function HeroLevelSave()
SetGameVar("LevR", GetGameVar("LevR")+1)--We increase the variable with the hero's level by 1
end
SetGameVar("LevR", 1)
Trigger(HERO_LEVELUP_TRIGGER, "Raelag")
In the Combat script, it's also a little different:
function Start()
Level_R = GetGameVar("LevR") + 0;
print("Level_R is set as a level identifier for Raelag in combat and depends on LevR through Set and Get Game Var");
if GetHeroName(GetAttackerHero()) == 'Raelag' then
print("if the player's hero is the attacker");
local mana = GetUnitManaPoints(GetAttackerHero());
SetUnitManaPoints(GetAttackerHero(), 200);
repeat sleep(1) until GetUnitManaPoints(GetAttackerHero())==200;
if Level_R < 20 then
print("If the level is less than 20, then");
for i, creature in GetDefenderCreatures() do
startThread(UnitCastAimedSpell, GetAttackerHero(), 4, creature);
print("cast Stone Skin");
end;
SetUnitManaPoints(GetAttackerHero(), mana);
print("restore mana");
else
print("If the level is 20 or more, then");
for i, creature in GetDefenderCreatures() do
startThread(UnitCastAimedSpell, GetAttackerHero(), 5, creature);
print("cast Magic Bolt");
end;
SetUnitManaPoints(GetAttackerHero(), mana);
print("restore mana");
end
end
end;You were missing some "end" statements; I've added the necessary number. Also, your script (if it's as shown above) will only work if *we* attack, not if *we* are attacked.
You were missing one "end".
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________