In this tutorial you will learn how to combine task modules and triggers to make your missions look more polished and understandable.
You will need to know some basics of syncing objects together. Syncing basically means that you're binding the objects together and you're making it possible for some scripts to detect that sync. You can Sync objects by right clicking on SOURCE
object and then left clicking on CONNECTED
object, a blue line will appear between them to symbolise their connection).
You will also be shown some scripting commands that will have to be used for some more complex tasks.
The create task module is used to create tasks. The module has different settings that you need to set up for it to work. We'll go over each of them below.
Owner setting is used to set an owner of the task. There are multiple choices here:
Task ID is a unique ID used by the code to distinguish tasks from each other. You need to type a unique name for each task, for example task_1
, or something that describes the task more clearly task_destroy
.
Parent Task ID is used to set task as a child of another task, this can be used to organize tasks. You need to put a Task ID
of an already existing task. For example in the image above, the parent task would be Deactivate mines
or Eliminate air patrol
and the tasks inside this main task would contain the Task ID
of the parent in the Parent Task ID
field.
You cannot have 2 or more tasks with the same
Task ID
, if you do the last placed task will override the others.
Title is used as a title for the task. Make sure it is short and to the point, for example Destroy Cache
instead of the Destroy the enemy weapons cache
.
Description is used to explain the task more clearly. You can type in <br>
in the description field to break the row (using ENTER
will not work). You can also have interactive links that can zoom in on an important location by typing <marker name='marker_0'>this is a marker</marker>
.
Marker is useless, ignore this field.
Destination can be used to set the position of the task. It can be:
State is used to show the current state of the task. It is best left as CREATED
and leave the task assignment to players.
Task type is used to have a cool icon display for each task.
For tasks to change their state, you will need to use a trigger as a condition of change. We'll go over some common task types and their possible settings for the triggers. Some scripting knowledge will come in handy here.
A simple timer that will activate a trigger no matter what after X seconds. Trigger settings:
true
(true
will activate the trigger no matter what)XX
midXX
maxXX
Read the condition as: "If true (which it is), then activate trigger."
A simple clear out enemies in area task. Trigger settings:
this
(this
command is used to represent the trigger settings as a condition, removing this
will mean that trigger won't activate, unless some other condition is present)You must have at least 1 enemy unit inside the area, so the trigger doesn't automatically activate when you start the mission. Hide 1 unit in the area and disable it's simulation so it doesn't leave the area.
Read the condition as: "If this (trigger activation settings), then activate trigger."
A simple defend an area task. Trigger settings:
this
(this
command is used to represent the trigger settings as a condition, removing this
will mean that trigger won't activate, unless some other condition is present)You must have at least 1 friendly unit inside the area, so the trigger doesn't automatically activate when you start the mission. Hide 1 unit in the area and disable it's simulation so it doesn't leave the area.
Read the condition as: "If this (trigger activation settings), then activate trigger."
A simple kill/destroy the target task. Trigger settings:
not alive ENEMY_OFFICER
(the not
command reverses the command after it; the alive
command checks if the unit is alive; ENEMY_OFFICER
is the Variable Name
of a unit or vehicle you want to have killed.)Read the condition as: "If not alive Enemy Officer, then activate trigger."
A simple capture an enemy task. Trigger settings:
captive ENEMY_OFFICER
(the captive
command checks if the unit is captured; ENEMY_OFFICER
is the Variable Name
of a unit you want to have captured.)Read the condition as: "If captive Enemy Officer, then activate trigger."
A simple rescue a friend task. Trigger settings:
not captive FRIENDLY_OFFICER
(the not
command reverses the command after it; the captive
command checks if the unit is captured; FRIENDLY_OFFICER
is the Variable Name
of a unit you want to have rescued.)Make sure the unit you want to have rescued is set as Surrendered or Handcuffed in ACE Options (Double click on Unit > Object: ACE Options)
Read the condition as: "If not captive Friendly Officer, then activate trigger."
A simple avoid detection task. Trigger settings:
enemy side
to have a condition where trigger activates when friendly side X gets detected by enemy side Y)this
(this
command is used to represent the trigger settings as a condition, removing this
will mean that trigger won't activate, unless some other condition is present)Read the condition as: "If this (trigger activation settings), then activate trigger."
Make sure to always have the triggers set to Server Only. While not necessary, it is better if only the server checks for trigger activation, instead of every player.
Now that you have your task and trigger, it is time to connect them to work together. To properly connect them though, you need a Set Task State module.
Set task state module is used to set the state of the task (CREATED/ASSIGNED/SUCCEEDED/FAILED/CANCELED) when something happens (trigger gets activated).
Simply place down the Set Task State module somewhere in between the Create Task and Trigger and open the module settings. In the settings you can select what you want to have as the task outcome after trigger is activated.
To make the connection you need to:
Create Task
module with Set Task State
module.Set Task State
module with Trigger
.Yes, that's all you have to do, now you have a working task, but wait there's more!
You can have multiple outcomes for a task, to do that you need to:
Set Task State
modules (one with SUCCEEDED and the other with FAILED states)Triggers
(one with SUCCESS condition and the other with FAIL condition)Create Task
module with the SUCCESS Set Task State
module.Set Task State
module with the SUCCESS Trigger
.Create Task
module with the FAIL Set Task State
module.Set Task State
module with the FAIL Trigger
.You can have multiple conditions for a task, to do that you need to:
Set Task State
module.Triggers
(with different conditions)Create Task
module with the Set Task State
module.Set Task State
module with the 1ST Trigger
.Set Task State
module with the 2ND Trigger
.You can have a task sequence (one task after the other), to do that you need to:
Create Task
, Set Task State
& Trigger
for the initial task.Create Task
module and set it up as a new task.Create Task
with the Trigger
of the previous task.Keep in mind that you can combine these connection types for all kinds of complicated tasks.