Activator

Last modified by KDearnley on 2023/07/31 14:06

Understanding how Activators work is necessary for creating complex logic. Simply stated, the Activator is the player or AI that causes a logic chain to fire. For example, if entering a volume triggers a barrel to explode, then the player or AI that enters that volume is the Activator.



The following examples are included in the example map named "Activators" with map ID AJEG5J42.

Using the Activator

You can perform actions on the Activator such as modifying the Activator’s health or damage, giving the player an item or weapon or giving a player score. If the Activator is a player, you can give her an item or weapon.

PatternsActivator.PNG


In some cases the activator can be chosen in the logic chain. For example, when an AI or player is injured you can specify whether the Activator is the attacker or the victim.

PatternsActivatorAttacker.PNG


Not all logic chains have an Activator. If a logic chain fires on map start or when a variable is changed, there is no valid Activator. This is because the Activator must either be a player or an AI. Even if a variable is in a logic chain that begins with an Activator, the output from a variable does not pass an Activator. The following logic chain will not alter any player resource because there is no activator to identify which player gets the resource.

PatternsActivatorNoActivatorBug2.PNG


Some logic chains require an Activator. For example, resource and score need an activator because unlike other variables, resource and score are specifically associated with a player or team. Players possess a resource and a score value. However, a number or integer is just an independent variable that is not associated with any particular player. So without an Activator, the logic chain cannot identify what player receives the resource or score value. The following logic chain will not alter any player resource because there is no player activator.

PatternsActivatorNoActivatorBug.PNG


The activator can be stored in a Cached Activator variable in order to get it later. Using a Cached Activator, you can inject a specific Activator into a logic chain at any time.

PatternsActivatorCache.PNG



You can Get the activator stored in a Cached Activator at any time and use it to continue a logic chain. This allows you to specify or change the activator in any logic chain.

PatternsActivatorUseCache.PNG

Tags: Basics