Auto-translated
Hello. Please help me with a script. The task is: if a unit is lost in the army, it results in a defeat. But after a *certain point*, the unit needs to be lost. How can I make it so that the scripted loss of the unit is not penalized with a defeat, but if the loss occurs before *this point*, then the defeat is counted? Below is the code that tracks the unit in the hero's army, and if it's not there, the map is lost.
function lostDragon() -- Checks for the loss of the dragon
while 1 do
sleep (10);
if GetHeroCreatures("Ohtarig", 83) == 0 and dragon == 1 then
SetObjectiveState("q5", OBJECTIVE_FAILED);
sleep (10);
Loose();
break
end;
end;
end;
startThread(lostDragon)