Auto-translated
The problem is as follows: 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. Additionally, the quest should be completed after the "Nemor" hero is defeated. However, after I add the functions below to my code, everything breaks, and the quest 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")