- [[crpl:crplreference|CRPL reference]] <- [[crpl:crplreference#utility_commands|Utility Commands]]
===== FailMission=====
^Arguments^Result^Notation^
| | |'' -- ''|
=== Description ===
Be careful when using this function in the editor - FailMission can only trigger once. If you fail the mission in the editor and then save your map, FailMission will never trigger again, and it will be impossible to fail the mission anymore in that save file.
Fails the current mission and displays the Failed Mission dialog to the player.
To prevent the issue with the use of FailMission in the editor explained above, make sure to never use it in the editor. You can use a custom function like this to ensure it'll only be called outside of the editor:
:SafeFailMission
IsEditMode if
ShowTraceLog
"FAIL" Trace
else
FailMission
endif
=== Examples ===
Fail the mission when the game clock reaches exactly one minute (30 frames times 60 seconds). Custom function used from the example above.
GetGameTimeFrames 30 60 mul eq if
@SafeFailMission
PauseGame
endif