There are three actions for the outcome: Victory, Defeat and Draw. They end that player's game, so when you use them matters.
| Victory() | Declares the player a winner and takes them out of the game. |
|---|---|
| Defeat() | Declares the player defeated. |
| Draw() | Ends it in a draw for everyone. |
In many maps it is better to mark someone eliminated than to end their game outright - they can watch the rest, and you can rank them.
Trigger { -- 탈락 처리: 유닛을 치우고 표시만 남긴다
players = {Force1},
conditions = {
Command(CurrentPlayer, Exactly, 0, "Men");
Deaths(CurrentPlayer, Exactly, 0, "Eliminated");
Deaths(CurrentPlayer, AtLeast, 1, "Joined");
},
actions = {
SetDeaths(CurrentPlayer, SetTo, 1, "Eliminated");
SetDeaths(P8, Add, 1, "EliminatedCount");
CenterView("Arena");
DisplayText("\x13\x06탈락했습니다");
PreserveTrigger();
},
}To end when one player is left, compare the eliminated count against the PlayerCount from the earlier lesson.
Trigger {
players = {Force1},
conditions = {
Deaths(CurrentPlayer, Exactly, 0, "Eliminated");
Deaths(CurrentPlayer, AtLeast, 1, "Joined");
Deaths(P8, AtLeast, 1, "AllButOneOut");
},
actions = {
DisplayText("\x13\x03승리!");
Victory();
},
}Do not attach PreserveTrigger to Victory or Defeat. There is no reason to run them again for a player whose game has ended, and leaving them preserved invites odd behaviour.
In a co-operative map, one player reaching the goal should grant Victory to everyone: list Force1 in players and test a shared counter.
