ACS_LockedExecute

From ZDoom Wiki
(Redirected from ACS LockedExecuteDoor)
Jump to navigation Jump to search

83:ACS_LockedExecute (script, map, s_arg1, s_arg2, lock)
85:ACS_LockedExecuteDoor (script, map, s_arg1, s_arg2, lock)


  • script: Script to execute
  • map: Map which contains the script
  • s_arg1: First argument passed to the script
  • s_arg2: Second argument passed to the script
  • lock: Required key, if any (see key types)

Usage

Executes the specified script if the player has the right key. A map value of zero indicates that the script is on the current map. If the script is on a different map, then the execution of the script will be delayed until the player enters the map that contains it. Only one copy of a script can be running at a time when started with this special.

If the specified script was previously executed but then suspended, then execution will begin at the point immediately after where it was suspended instead of starting over again at the beginning.

The difference between these two specials is the message they print when the player does not have the necessary key(s). ACS_LockedExecute prints the “remote” message (“You need ... to activate this object” in Doom) and ACS_LockedExecuteDoor prints the “door” message (“You need ... to open this door” in Doom).

Examples

As the only thing which can be locked normally is a door, using Door_LockedRaise, this script type allows any object or event to be locked with a key. Using the script on its own is no different from checking the player's inventory in a way such as this:

script 1 (void)
{
	if (CheckInventory("RedCard") || CheckInventory("RedSkull"))
	{
		Print(s:"You use the red key.");
		// More code here
	}
	else
		Print(s:"You need the red key.");
}

The advantage to this command is that it can check by key types rather than by key names. For example, a script which activates an elevator could be called with ACS_LockedExecute to lock it in a simple and elegant way.

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