Donut Team is a labor of love, built and maintained by a small group of passionate developers. We invest our own time and resources to offer our tools, mods, and web services completely free of charge.

We don't run ads, and we will never sell your data - period.

If you've enjoyed anything we've created, please consider supporting our work with a one-time or monthly donation via our Ko-fi page . Every contribution helps us continue building great experiences for the community.

Dismiss
  • Modding Tools
  • Lucas' Simpsons Hit & Run Mod Launcher
  • Hacks
  • Mod Requirable Hacks
  • Additional Script Functionality
  • Console Commands
  • MFK Commands
  • Mission Initialisation
  • Stages
  • Checkpoints

IfCurrentCheckpoint

Available since Version 1.25.

This conditional command returns whether or not the current stage is being resumed from a checkpoint.

Scope

This command should be called between calls to AddStage and CloseStage in a mission's initialisation script.

Additionally, this must be called after CHECKPOINT_HERE in the stage.

Syntax

MFK
Lua
IfCurrentCheckpoint() 
{
	
}
Game.IfCurrentCheckpoint()

Game.EndIf()

Examples

MFK
Lua
AddStage();
	SetStageTime(40);

	AddObjective("dummy");
	CloseObjective();
CloseStage();

AddStage();
	CHECKPOINT_HERE();
	
	!IfCurrentCheckpoint()
	{
		// Don't add any time when reaching this stage from the previous one.
		// Due to Radical programming AddStageTime() in an odd way, -1 adds no time and 0 adds one second.
		AddStageTime(-1);
	}
	
	IfCurrentCheckpoint()
	{
		// Set the time to 20 seconds when resuming from a checkpoint.
		SetStageTime(20);
	}

	AddObjective("dummy");
	CloseObjective();

	AddCondition("timeout")
	CloseCondition();
CloseStage();
Game.AddStage()
	Game.SetStageTime(40)

	Game.AddObjective("dummy")
	Game.CloseObjective()
Game.CloseStage()

Game.AddStage()
	Game.CHECKPOINT_HERE()
	
	Game.Not()
	Game.IfCurrentCheckpoint() -- Alternatively, you can omit the line with Game.Not() and use Game.Not_IfCurrentCheckpoint() here instead.
		-- Don't add any time when reaching this stage from the previous one.
		-- Due to Radical programming AddStageTime() in an odd way, -1 adds no time and 0 adds one second.
		Game.AddStageTime(-1)
	Game.EndIf()
	
	Game.IfCurrentCheckpoint()
	{
		-- Set the time to 20 seconds when resuming from a checkpoint.
		Game.SetStageTime(20)
	}

	Game.AddObjective("dummy")
	Game.CloseObjective()

	Game.AddCondition("timeout")
	Game.CloseCondition()
Game.CloseStage()

Notes

Due to the nature of how console scripts work in the game, all conditional commands are evaluated at the time the script is executed. This unfortunately limits the utility of many of these types of commands, but we believe they still have some use cases even with this limitation.