Skip to content
User Avatar
#3528
Auto-translated
Martha

SetGameVar("Raelag", geroy);
What kind of magic is this?! It's enough to write main_hero = 'Raelag'. SetGameVar is used to transfer variables from script to script and through campaign missions.
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;
end

The 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.

С уважением, }{0TT@6bI4
_________________
Группа картостроителей
Там ответы на вопросы, руководства, гайды и прочее
Discord-сервер "Герои 5: S.T.A.L.K.E.R"
Сервер по модификации "Герои 5: S.T.A.L.K.E.R"
_________________

Statistics

Welcome our newest member: leyu