From ZDoom Wiki
Jump to navigation Jump to search

bool ACS_NamedExecuteAlways (string script, int map, int s_arg1, int s_arg2, int s_arg3)
ACS_NamedExecuteAlways (string script, int map, int s_arg1, int s_arg2, int s_arg3)


Variant of ACS_ExecuteAlways for named scripts.

There is both an ACS and a DECORATE version of this function. Both behave identically.

However, it is not available as an action special: to call named scripts from a a line or thing special, you have to use the non-named variant (ACS_ExecuteAlways) in UDMF, with the arg0str custom argument set to the name of the script — this will override the first parameter.


  • script: Name of the 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
  • s_arg3: Third argument passed to the script

Return value

Returns true if the script could be executed successfully, false otherwise. Deferred scripts are always considered successful.


This example gives a one-time full heal to a player when nearly dead, if the player picked a special item. The item runs the script, while the script monitors players status and activates when players health is reduced to 1.

Decorate Item:

Actor AvoidDeath : CustomInventory
  Inventory.MaxAmount 0
    TNT1 A 0 ACS_NamedExecuteAlways("AvoidDeathScript", 0)

ACS Script:

script "AvoidDeathScript" (void)
  SetPlayerProperty(0, 1, PROP_BUDDHA);  // Sets buddha mode for player
  while(1) // Permanent Loop
    if(GetActorProperty(0, APROP_HEALTH) <= 1) // Checks if the player is wounded enough to heal
      SetPlayerProperty(0, 0, PROP_BUDDHA); // Remove the buddha mode
      GiveInventory("Health", 100);        // and heal the player
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