SetGameVar("Raelag", geroy);
In battle, the hero's name can be easily and simply found using the GetHeroName function, so it can be simplified, and a hook for the start of the battle needs to be added.
function Start()
if GetHeroName(GetAttackerHero()) == 'Raelag' then
print("if the main hero is the attacker");
local mana = GetUntiManaPoints(GetAttackerHero()) --Otherwise, we will leave 200 mana for the player for no reason!
SetUnitManaPoints(GetAttackerHero(), 200);
repeat sleep(1) until GetUntiManaPoints(GetAttackerHero())==200 --Sleep until the mana is added
UnitCastAimedSpell(GetAttackerHero(), 4);
SetUnitManaPoints(GetAttackerHero(), mana); --Return the mana to the amount it was!
print("casting");
elseif GetHeroName(GetDefenderHero()) == 'Raelag' then
print("if the main hero is the attacker");
local mana = GetUntiManaPoints(GetDefenderHero()) --Otherwise, we will leave 200 mana for the player for no reason!
SetUnitManaPoints(GetDefenderHero(), 200);
repeat sleep(1) until GetUntiManaPoints(GetDefenderHero())==200 --Sleep until the mana is added
UnitCastAimedSpell(GetDefenderHero(), 4);
SetUnitManaPoints(GetDefenderHero(), mana); --Return the mana to the amount it was!
print("casting");
end;
endThe script error is very strange, as if your MapScript is also running in battle: there is no such function in tactical mode, and therefore an error occurs. Can you attach both script files? Upload them to Google/Yandex Drive.
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________