Trigger ( eng. Trigger - trigger) - in computer games, a mechanism that checks the presence of any objects of the game world in a given space or the distance from these objects to a special point. When the conditions are fulfilled (for example, the object is in the trigger zone and this object is the player), a certain event or chain of events ( script ) is triggered. For example (in the case of a player), an enemy attacks him, a bomb explodes, he falls through the ground, etc.
Triggers are also called sections of game scripts that, when certain conditions are met, run given commands (that is, these are analogues of if ).
For example, in The Elder Scrolls III: Morrowind , part of the script may look (simplified) as follows (comments are separated by a “;”):
If ( GetDistance , Player <= 256 ) ; condition
Activate ; the action to take if the condition is met
Endif
This means that if a player approaches (“GetDistance, Player”) some object to which the script is “tied” to a distance less than or equal to 256 units (“<= 256”) from either side, then this object is activated (then is, an action is attributed to the object - a door or a closet, for example, opens).
Views
Trigger Zone
A zone in the playing space that checks for the presence or absence of a player, enemy or any other object in it. In 3D games, it usually takes the form of an object invisible to the player: a parallelepiped , a sphere , a plane , etc.