Auto-translated
I'm completely out of ideas, I don't understand anything anymore.
In MapScript, I have the following:
geroy = "Raelag";
SetGameVar("Raelag", geroy);
print("The main character has been named");
SetHeroCombatScript('Raelag', "/Maps/SingleMissions/Koto_Map_New/CombatScript.xdb#xpointer(/Script)");
print("Combat script launched");
Here, everything seems to be in order, and the console confirms it.
In CombatScript, I have the following:
geroy = GetGameVar("Raelag");
if GetHeroName(GetAttackerHero()) == geroy then
print("if the main character is the aggressor");
SetUnitManaPoints(GetAttackerHero(), 200);
print("mana given");
sleep(1)
UnitCastAimedSpell(GetAttackerHero(), 4);
print("casting");
end;
if GetHeroName(GetDefenderHero()) == geroy then
print("if the main character is the defender");
SetUnitManaPoints(GetDefenderHero(), 200);
print("mana given");
sleep(1)
UnitCastAimedSpell(GetDefenderHero(), 4);
print("casting");
end;
And in tactical mode, the following error appears:
Value was NIL when getting global with name 'SetHeroCombatScript'.
Attempt to call a nil value.
Where is the null value when I seem to have written that geroy = "Raelag"?
Help, kind people, please tell me what I need to write here?
Do I need to make if GetHeroName a function? Yes, it seems like MapScriptsEditor complains about that.
Added 5 minutes ago
Or is this, after all, a problem with the game not recognizing the combat script at the specified address?
Added 2 minutes ago
P.S., yes, I know that commas are missing after sleep here. But they are not missing in the script, and it doesn't even get to sleep.