The problem is this: I want the "uderzhatG" quest to activate after capturing the "gorodSvyat" town. Also, if this town belongs to Player 2, then the quest should fail, and the player should lose the mission. Also, after the hero "Nemor" is defeated, the quest should be completed. But after I add the functions below to my code, everything breaks, and it doesn't trigger (although the initial settings are applied). What's the problem?function uderzhat ()
SetObjectiveState("uderzhatG", OBJECTIVE_ACTIVE);
Trigger(OBJECT_CAPTURE_TRIGGER, "gorodSvyat", nil );
end;
Trigger(OBJECT_CAPTURE_TRIGGER, "gorodSvyat", "uderzhat" );
function CheckSvyat ()
while (1) do
sleep(2);
if GetObjectOwner("gorodSvyat")==PLAYER_2 then
sleep (2)
SetObjectiveState("uderzhatG", OBJECTIVE_FAILED);
sleep (15)
Loose ();
break
end;
end;
end;
startThread (CheckSvyat)
function UderzhatComplete ()
SetObjectiveState("uderzhatG", OBJECTIVE_COMPLETED);
Trigger (PLAYER_REMOVE_HERO_TRIGGER, "Nemor", nil)
end
Trigger (PLAYER_REMOVE_HERO_TRIGGER, "Nemor", "UderzhatComplete")
I might be wrong, but perhaps you could try this trigger: Trigger(OBJECT_CAPTURE_TRIGGER, "gorodSvyat", "CheckSvyat" );