Modding Tools > Lucas' Simpsons Hit & Run Mod Launcher > Hacks > Mod Requirable Hacks > Additional Script Functionality > MFK Commands > Stages > Checkpoints > IfCurrentCheckpoint

IfCurrentCheckpoint

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

Context

This command should be called between calls to AddStage and CloseStage.

Additionally, this must be called after CHECKPOINT_HERE.

Syntax

IfCurrentCheckpoint() 
{
	
}

Game.IfCurrentCheckpoint()

Game.EndIf()

Examples

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

Conditional commands and the { } syntax for conditional blocks are both unused functionality that Radical provides, it was not created from the ground up by us.

Version History

1.25

Added this command.

Donut Team © 2023 · v4.0