ActivateTrigger

From Ashes of the Singularity - Official Wiki
Jump to navigation Jump to search

The ActivateTrigger command activates a trigger, making it active and able to fire when its conditions are met.

Also can be used to activate the trigger it is called from, making a repeating trigger.

Arguments

  • Target - This is the name of another trigger that will be set from Inactive to Active.

Common Usage

  • Creating sequences of triggers that fire one after another, sometimes with delays or other conditions.
  • Creating repeating triggers, like spawning waves of enemies that attack the player.

Example 1

 <Trigger Name="EnemyWaveStart" Type="Timer" Timer="30" Inactive="0" >
   <ActivateTrigger Target="EnemyWave01" />
 </Trigger>

Thirty seconds into the game, this activates the repeating EnemyWave triggers, below:

 <Trigger Name="EnemyWave01" Type="Timer" Timer="10" Inactive="1" NotOtherTrigger="FactorySwitch">
   <SpawnUnit Name="Enemy01_Leader" Template="PHC_T1_Light" Player="1" Position="300,-700" />
   <SpawnUnit Name="Enemy01_Minion01" Parent="Enemy01_Leader" Template="PHC_T1_Light" Player="1" Position="310,-700" />
   <SpawnUnit Name="Enemy01_Minion01" Parent="Enemy01_Leader" Template="PHC_T1_Light" Player="1" Position="330,-700" />
   <SpawnUnit Name="Enemy01_Minion01" Parent="Enemy01_Leader" Template="PHC_T1_Light" Player="1" Position="340,-700" />
   <SpawnUnit Name="Enemy01_Minion01" Parent="Enemy01_Leader" Template="PHC_T1_MRM" Player="1" Position="320,-700" />
   <SpawnUnit Name="Enemy01_Minion01" Parent="Enemy01_Leader" Template="PHC_T1_MRM" Player="1" Position="320,-710" />
   <SpawnUnit Name="Enemy01_Minion01" Parent="Enemy01_Leader" Template="PHC_T1_MRM" Player="1" Position="300,-710" />
   <SpawnUnit Name="Enemy01_Minion01" Parent="Enemy01_Leader" Template="PHC_T1_MRM" Player="1" Position="300,-720" />
   <AttackAttackMove Name="Enemy01_Leader" Position="0,-4900" />
   <CaptureNearestNext Name="Enemy01_Leader" Repeat="true"/>
   <AttackAttackMove Name="Enemy01_Leader" Position="-9100,-8500" />
   <ActivateTrigger Target="EnemyWave02" />
 </Trigger>

After 10 seconds, this spawns a bunch of units in an army and sends them at the player, capturing regions along the way.

It also activates EnemyWave02, which in turn reactivates EnemyWave01. The net result is that every 10 seconds, armies spawn in alternating places and attack the player.

Example 2

 <Trigger Name="InitialSetup" Type="Timer" Timer="0" Inactive="1" >
   <GrantTech Player="2" Tech="HPs" />
   <GrantTech Player="2" Tech="HPs" />
   <GrantTech Player="2" Tech="Weapons" />
   <GrantTech Player="2" Tech="Weapons" />
   <GrantTech Player="2" Tech="BuildingHPs" />
   <GrantTech Player="2" Tech="BuildingHPs" />
   <GrantTech Player="2" Tech="BuildingHPs" />
   <GrantTech Player="2" Tech="BuildingHPs" />
   <GrantTech Player="2" Tech="BuildingHPs" />
   <GrantTech Player="2" Tech="BuildingHPs" />Fckmw0fckmw

   <SpawnBuilding Name="Base_Archive_02" Template="SS_QuantumArchive" Player="0" Position="-9900,-8536" />
   <SpawnBuilding Name="Base_Blossom_01" Template="SS_BlossomLauncher" Player="0" Position="-8800,-8736" />
   <SpawnBuilding Name="Base_Blossom_02" Template="SS_BlossomLauncher" Player="0" Position="-9600,-8786" />
   <SpawnBuilding Name="Base_Blossom_03" Template="SS_BlossomLauncher" Player="0" Position="-9700,-8286" />
   [...]
   <ActivateTrigger Target="BeginMission" />
 </Trigger>

This gives Player 2 some free techs and spawns the initial buildings across the map, then fires the next trigger:

 <Trigger Name="BeginMission" Type="Timer" Timer="0" Inactive="1" >
   <Dialog>
     <Entry Icon="Haalee" Text="TurtleWars_Intro_1" />
     <Entry Icon="Haalee" Text="TurtleWars_Intro_2" />
     <Entry Icon="Haalee" Text="TurtleWars_Intro_3" />
     <Entry Icon="Haalee" Text="TurtleWars_Intro_4" />
   </Dialog>
   <Objective Name="Initial_Obj" String="TurtleWars_Initial_Obj" SetCheck="false" />
   <Objective Name="Generator_Obj" String="TurtleWars_Generator_Obj" SetCheck="false" />
   <AreaIndicator Name="Fac_Ind" Position="0,0" Size="250" Color="Red" Duration="-1" />
   [...]
 </Trigger>

This trigger plays the dialog and sets up the player's objectives. While not strictly necessary to split up the triggers in this way, it is helpful to ensure that things happen in a certain order - and keep yourself sane and organized while creating and balancing large script files.