trigger_script

Modified

12-Jul-2023

This powerful entity allows you to put scripts made with AngelScript language on your map. Before Sven Co-op 5.0 you already were able to create almost anything with existed entities- this entity pushes imagination barrier even further allowing you to open an existing script and use functions. For more information on how to build trigger_script functions, visit the SC AngelScript documentation.

Keyvalues


OnDestroy Function ondestroyfn : Name of the function to use from already parsed .as script files when entity is destroyed (killed) in any way. If the function belongs to namespace, you must use prefix with the namespace name (e.g. mynamespace::MyFunction) for the keyvalue.

Name targetname : Set name of trigger_script so other entities can trigger it to run script.

Target target : Name of entity to trigger (fire). Which function relates to it depends on the respective entity. Most will just trigger their target, while others will perform actions on their target or use it as a reference for other activities. Often, multiple entities by the same name may be targeted. Most entities need no target, but having one is essential for most logic entities and basic trigger-systems.

Delay Before Trigger delay : Delay before trigger entity specified in "Target".

Kill Target killtarget : Same as target, except that this supposedly causes the specified entity/entities to be removed from the game. Not all entities which have a target to trigger will also handle killtarget. You may want to use a trigger_relay to make sure it is working.

Script to load m_iszScriptFile : The name of the script to load in "scripts\maps" directory, e.g. "mymap/my_script1". This can be left empty if the function already exists from scripts specified via map_script in cfg.

Function to execute on trigger m_iszScriptFunctionName : Function (declared in the opened script file) to call when trigger_script is triggered. If the function belongs to namespace, you must use prefix with the namespace name (e.g. mynamespace::MyFunction) for the keyvalue.

Time between thinks m_flThinkDelta : If "Mode" is set to 'Think', this is a time delay between script calls.

Mode m_iMode : Script call mode.

  • 1 : Trigger : Allows to execute script once.
  • 2 : Think : Executes script every X seconds (specified in "Time between thinks").

Flags


  • 1 : Start on : Script is activated on start.

A think mode trigger_script obeys usetype: triggering with "Off" will stop the trigger_script entity running, similarly "Toggle" will allow to switch between running and not running.