Triggers: Difference between revisions
No edit summary |
JYWLuca8269 (talk | contribs) m (Updated look.) |
||
(9 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:<span style="position: absolute; clip: rect(1px 1px 1px 1px); clip: rect(1px, 1px, 1px, 1px);">{{FULLPAGENAME}}</span>}} | |||
{{HeaderTemplate | |||
|welcome=Triggers | |||
}} | |||
'''Triggers''' are what control anything you want to happen while the scenario is being played, from spawning starting base to calling waves of attacking enemies or giving players objectives. There are several types of triggers which activate off of different events. | |||
{{SectionTemplate | |||
|h=h3 | |||
|title=Active vs Inactive | |||
|content=}} | |||
Triggers are "active" by default, meaning they will fire whenever their condition is met. They can be set to Inactive manually in the script. | |||
Triggers set themselves to Inactive when they fire. This means that if you want something to be repeatable, you need to reactivate it somewhere in the script. | |||
{{SectionTemplate | |||
|h=h3 | |||
|title=Repeating Triggers | |||
|content=}} | |||
Using <ActivateTrigger="triggername"/> to tell a trigger to activate itself will make it repeatable (if you want something to happen every time the player builds a Dreadnought, for example, or waves of enemies to spawn and attack every 15 seconds). | |||
{{SectionTemplate | |||
|h=h3 | |||
|title=Conditional Triggers | |||
|content=}} | |||
Using the OtherTrigger and NotOtherTrigger arguments is a way to gate your scenario's logic. For purposes of those arguments, a trigger 'counts' '''if it has been activated at least once''' during the game. However, you can't stack multiple Conditional Triggers. To word it another way, OtherTrigger="Triggername" means only run the Trigger if this Trigger has happened, while NotOtherTrigger means only run the Trigger if this other Trigger hasn't happened. | |||
There is currently no way to "un-activate" a trigger, as far as OtherTrigger and NotOtherTrigger are concerned. | |||
Here's what that may look like: | |||
<Trigger Name="tNE_Spawn1" Type="Var" Var="vNE_Spawn" Operator="==" Value="1" NotOtherTrigger="tNE_SpawnSuppress" > | |||
<SpawnUnit Name="uNE_Leader1" Template="PHC_2_Zeus" Player="5" Position="-9344,-8064" /><Trigger Name="tNE_Spawn1" Type="Var" Var="vNE_Spawn" Operator="==" Value="1" NotOtherTrigger="tNE_SpawnSuppress" > | |||
<SpawnUnit Name="uNE_Leader1" Template="PHC_2_Zeus" Player="5" Position="-9344,-8064" /> | |||
<Trigger> | |||
In this case, the NotOtherTrigger means do not run the unit spawn trigger if the SpawnSuppression Trigger has been activated, (a certain region has been captured.) Another example is NotOtherTrigger="Difficulty4" means don't run the trigger if the player is playing on Expert. | |||
{{SectionTemplate | |||
|h=h3 | |||
|title=Common Trigger Arguments | |||
|content=}} | |||
All triggers share some attributes in common: | |||
*'''Name''' - Name of the trigger. Required. | *'''Name''' - Name of the trigger. Required. | ||
*'''Type''' - What type of trigger it is. See below. Required. | *'''Type''' - What type of trigger it is. See below. Required. | ||
Line 8: | Line 52: | ||
*'''NotOtherTrigger''' - Inverse of OtherTrigger. If the other trigger has fired this trigger won’t fire. Us this to create branching options in your scenario. | *'''NotOtherTrigger''' - Inverse of OtherTrigger. If the other trigger has fired this trigger won’t fire. Us this to create branching options in your scenario. | ||
{{SectionTemplate | |||
|h=h3 | |||
|title=Trigger Types | |||
|content=}} | |||
These are the types of triggers you can use in a script, and any specific arguments they support. | These are the types of triggers you can use in a script, and any specific arguments they support. | ||
===[[Area_Trigger| | |||
{{SectionTemplate | |||
|h=h4 | |||
|title=Area | |||
|content=}} | |||
The [[Area_Trigger|area trigger]] fires when the human player moves a unit into the area. | |||
*'''Center''' - Map coordinates of the center of the area. Required. | *'''Center''' - Map coordinates of the center of the area. Required. | ||
Line 19: | Line 70: | ||
*'''Template''' - Template name of the unit that can trigger this. If you want it to fire if any unit enters the area, do not specify a Template argument. | *'''Template''' - Template name of the unit that can trigger this. If you want it to fire if any unit enters the area, do not specify a Template argument. | ||
===[[Build_Trigger| | |||
{{SectionTemplate | |||
|h=h4 | |||
|title=Build | |||
|content=}} | |||
The [[Build_Trigger|build trigger]] fires when a human player builds structures or units. | |||
*'''Target''' - The template of the building that will fire this trigger | *'''Target''' - The template of the building that will fire this trigger | ||
Line 26: | Line 81: | ||
*'''Count''' - How many of the target template must be built to fire the trigger (default 1) | *'''Count''' - How many of the target template must be built to fire the trigger (default 1) | ||
===[[Destruction_Trigger| | |||
{{SectionTemplate | |||
|h=h4 | |||
|title=Destruction | |||
|content=}} | |||
The [[Destruction_Trigger|destruction trigger]] fires when something specific dies. | |||
*'''IsBuilding''' - If this is a building (if not it refers to a unit). | *'''IsBuilding''' - If this is a building (if not it refers to a unit). | ||
*'''Target''' - Name of the script-spawned unit or building. | *'''Target''' - Name of the script-spawned unit or building. | ||
===[[Difficulty_Trigger| | |||
{{SectionTemplate | |||
|h=h4 | |||
|title=Difficulty | |||
|content=}} | |||
The [[Difficulty_Trigger|difficulty trigger]] fires at the beginning of a scenario if the given difficulty was chosen | |||
*'''Difficulty''' - The given difficulty (0 for Much Easier, up to 4 for Much Harder) | *'''Difficulty''' - The given difficulty (0 for Much Easier, up to 4 for Much Harder) | ||
===[[NamedCreate_Trigger|NamedCreate]] | {{SectionTemplate | ||
|h=h4 | |||
|title=NamedCreate | |||
|content=}} | |||
The [[NamedCreate_Trigger|NamedCreate trigger]] fires when a specific unit or building is spawned via a script. | |||
*'''Target''' - Name of the script-spawned unit or building. | *'''Target''' - Name of the script-spawned unit or building. | ||
*'''IsBuilding''' - If this is a building (if not it refers to a unit). | *'''IsBuilding''' - If this is a building (if not it refers to a unit). | ||
===[[Research_Trigger| | |||
{{SectionTemplate | |||
|h=h4 | |||
|title=Research | |||
|content=}} | |||
The [[Research_Trigger|research trigger]] fires when a player researches a Quantum Upgrade | |||
*'''Player''' - The player doing the research | *'''Player''' - The player doing the research | ||
*'''Target''' - The name of the tech | *'''Target''' - The name of the tech | ||
===[[Timer_Trigger| | |||
{{SectionTemplate | |||
|h=h4 | |||
|title=Timer | |||
|content=}} | |||
The [[Timer_Trigger|timer trigger]] fires after a delay. | |||
*'''Time -''' Time in seconds after this gets triggered that it takes place. | *'''Time -''' Time in seconds after this gets triggered that it takes place. | ||
===[[Var_Trigger| | |||
{{SectionTemplate | |||
|h=h4 | |||
|title=Var | |||
|content=}} | |||
The [[Var_Trigger|var trigger]] fires if a variable meets given criteria | |||
*'''Var''' - The name of the variable to check | *'''Var''' - The name of the variable to check | ||
*'''Operator''' - What logical operator to use when evaluating the variable (equal to, less than, etc) '''[ == | >= | <= | > | < | != ]''' | *'''Operator''' - What logical operator to use when evaluating the variable (equal to, less than, etc) '''[ == | >= | <= | > | < | != ]''' | ||
*'''Value''' - The (integer) value to compare the variable against | *'''Value''' - The (integer) value to compare the variable against | ||
*''Example: <Trigger Name="tWeasleyDead" Type="Var" Var="vWeasleyDead" Operator="==" Value="1" > - this fires when the "vWeasleyDead" variable is equal to 1'' | *''Example: <Trigger Name="tWeasleyDead" Type="Var" Var="vWeasleyDead" Operator="==" Value="1" > - this fires when the "vWeasleyDead" variable is equal to 1'' | ||
===[[ZoneCapture_Trigger|ZoneCapture]] | This is useful if you want to make capturing 4 regions or killing 4 AI players do something, but only when all of them have been done at the same time. However, you have to be careful in the case of capturing all 4 regions that it doesn't get messed up by if the AI captures the region back. This is where conditional triggers are essential. | ||
{{SectionTemplate | |||
|h=h4 | |||
|title=ZoneCapture | |||
|content=}} | |||
The [[ZoneCapture_Trigger|ZoneCapture trigger]] fires when a region is captured. | |||
*'''Owner''' - Player who must capture this region to fire the trigger. | *'''Owner''' - Player who must capture this region to fire the trigger. | ||
*'''Position''' - Map coordinates of the generator/Nexus. | *'''Position''' - Map coordinates of the generator/Nexus. | ||
[[Category:Modding]] |
Latest revision as of 15:33, 24 November 2020
Active vs InactiveTriggers are "active" by default, meaning they will fire whenever their condition is met. They can be set to Inactive manually in the script. Triggers set themselves to Inactive when they fire. This means that if you want something to be repeatable, you need to reactivate it somewhere in the script.
Repeating TriggersUsing <ActivateTrigger="triggername"/> to tell a trigger to activate itself will make it repeatable (if you want something to happen every time the player builds a Dreadnought, for example, or waves of enemies to spawn and attack every 15 seconds).
Conditional TriggersUsing the OtherTrigger and NotOtherTrigger arguments is a way to gate your scenario's logic. For purposes of those arguments, a trigger 'counts' if it has been activated at least once during the game. However, you can't stack multiple Conditional Triggers. To word it another way, OtherTrigger="Triggername" means only run the Trigger if this Trigger has happened, while NotOtherTrigger means only run the Trigger if this other Trigger hasn't happened. There is currently no way to "un-activate" a trigger, as far as OtherTrigger and NotOtherTrigger are concerned. Here's what that may look like: <Trigger Name="tNE_Spawn1" Type="Var" Var="vNE_Spawn" Operator="==" Value="1" NotOtherTrigger="tNE_SpawnSuppress" > <SpawnUnit Name="uNE_Leader1" Template="PHC_2_Zeus" Player="5" Position="-9344,-8064" /><Trigger Name="tNE_Spawn1" Type="Var" Var="vNE_Spawn" Operator="==" Value="1" NotOtherTrigger="tNE_SpawnSuppress" > <SpawnUnit Name="uNE_Leader1" Template="PHC_2_Zeus" Player="5" Position="-9344,-8064" /> <Trigger> In this case, the NotOtherTrigger means do not run the unit spawn trigger if the SpawnSuppression Trigger has been activated, (a certain region has been captured.) Another example is NotOtherTrigger="Difficulty4" means don't run the trigger if the player is playing on Expert.
Common Trigger ArgumentsAll triggers share some attributes in common:
Trigger TypesThese are the types of triggers you can use in a script, and any specific arguments they support.
AreaThe area trigger fires when the human player moves a unit into the area.
BuildThe build trigger fires when a human player builds structures or units.
DestructionThe destruction trigger fires when something specific dies.
DifficultyThe difficulty trigger fires at the beginning of a scenario if the given difficulty was chosen
NamedCreateThe NamedCreate trigger fires when a specific unit or building is spawned via a script.
ResearchThe research trigger fires when a player researches a Quantum Upgrade
TimerThe timer trigger fires after a delay.
VarThe var trigger fires if a variable meets given criteria
This is useful if you want to make capturing 4 regions or killing 4 AI players do something, but only when all of them have been done at the same time. However, you have to be careful in the case of capturing all 4 regions that it doesn't get messed up by if the AI captures the region back. This is where conditional triggers are essential.
ZoneCaptureThe ZoneCapture trigger fires when a region is captured.
|