From ZDoom Wiki
Jump to: navigation, search

81:ACS_Suspend (script, map)

  • script: Script to suspend
  • map: Map which contains the script


Suspends execution of a script until an ACS_Execute or ACS_LockedExecute special starts it. If the specified script is not currently running, then it will be immediately suspended the next time it is run.


The following rather long example displays the use of ACS_Suspend to hold a script for a short time. The first piece of code tells the player a bomb has been activated and displays that it will detonate after a set amount of time.

script 1 ENTER
	Thing_ChangeTID(0, 999);

script 17 (int time)
	Print(s:"A bomb has been triggered!");

	while (time > 0)
		HudMessageBold(i:time--, s:" seconds remain!";
			HUDMSG_PLAIN, 1, CR_RED, 0.5, 0.95, 1.0);
	Thing_Damage(999, 300, 0);

The first script sets every player's TID to 999. For the second block, the first two lines introduce the scenario for the player. The while loop runs the countdown. Finally, after the countdown, a Thing_Damage is executed which damages every player 300 points and thus hopefully killing them, to represent the bomb going off.

The following script uses ACS_Suspend:

script 50 (int hold)
	ACS_Suspend(17, 0);
	Print(s:"You bought yourself ", i:hold,
		s:" seconds!");
	ACS_Execute(17, 0, 0, 0, 0);

This holds the countdown script for the specified amount of time. It uses ACS_Suspend to stop it, waits for the amount of time, and then uses ACS_Execute to resume the script. The reason this works is because ACS_Suspend and ACS_Execute always remember where in the script it has been suspended.

If you wanted to stop the script completely, you would use ACS_Terminate.

Script functions
ACS_Execute ACS_NamedExecute
ACS_ExecuteWait ACS_NamedExecuteWait
ACS_ExecuteAlways ACS_NamedExecuteAlways
ACS_ExecuteWithResult ACS_NamedExecuteWithResult
ACS_LockedExecute ACS_NamedLockedExecute
ACS_LockedExecuteDoor ACS_NamedLockedExecuteDoor
ACS_Suspend ACS_NamedSuspend
ACS_Terminate ACS_NamedTerminate
ScriptWait NamedScriptWait
FS_Execute UsePuzzleItem

External links