We’re now moving onto the second framework – the Dynamic Task Framework. We’ll just be doing a simple series of tasks, where completing a task generates a second task which then generates a final task. You can also end the mission using tasks (so the mission ends when the task is complete), however we’ll be using a mission trigger for this later.
The first thing we need to add is the task manager. This is the entity that contains all of the scripting for showing your tasks. We’re then going to add other tasks as other entities that are children of the task manager, which will then manage them all for us. You’ll want to place it in your Init layer, so set that as the active layer now.
To find the task manager, navigate to NightOpsDynamicTaskFamework>Prefabs>NO_DTF and find “TaskManager.et” (you may notice I added a second AI group patrolling the perimeter of Godfrey’s Cottage):
ADDING A MULTI TASK
Now we’re going to edit our first task. We’re going to have a total of four tasks – one multi task and three single tasks. A multi task is essentially a task with “children” tasks, that will be complete when all of its children are completed.
In the same location as the task manager you’ll see “MultiTask.et” – drag this onto the task manager in the hierarchy to make it a child of the task manager:
If you’ve done it right the multi task should appear under the task manager, which should now have a little drop down arrow:
The task manager also by default enables a 3D marker where the task is. If you don’t want this or want to edit the colour, go to NO_SCR_TaskMarkerComponent in the Object Properties:
There are two main parts to the Multi Task. The first is the NO_SCR_EditorTask – the base entity at the top of the object properties. This part will be the same for multi or single tasks. There’s then the NO_SCR_MultiTaskTriggerComponent which is specific to a multi task. First, let’s go through the base entity’s properties.
The first section is TaskManager, this will tell the task manager which faction the task is for, whether or not to assign it immediately when the game starts, and if you want the 3D marker to follow a particular object.
For this task I’ve set that to “US” and assign on start:
The second section is Successor, which tells the task whether or not to activate new tasks if this task succeeds or failed. Tasks listed in “Create Task Names Success” will be created when the task if complete, and “Create Task Names Fail” for when the task is failed. Leave this for now, but we will be coming back to it later.
The Game Over section, as the name suggests, lets you end the mission when the task is complete. We’ll not be using this method in this tutorial, but it is a nice and easy way of ending the mission, and you can set different endings if the task succeeds or fails.
The final section we’re concerned with is boringly called Unsorted, but this is where you can set the name and description of the task, as well as the icon.
At this basic level we should only be concerned with the fields highlighted, and everything else remains the same. We’ll go through what icons are available later.
There’s then also the NO_SCR_MultiTaskTriggerComponent. You can add the names of tasks you want to include in the task names, or you can make them children of the multi task. Allow failed tasks means that, if this box is checked, the multi task will complete if all the tasks are complete whether they succeeded or failed. If it is unticked, all of the child tasks will need to have succeeded for the multi task to complete.
I’ve called my task “Secure Godfrey’s Cottage”, but I want this multi task split into two smaller tasks – one to clear it and one to defend it. As this is a multi part task, I’m going to rename the Multi Task “1. Secure Godfrey’s Cottage” and the two sub-tasks as “1A. Clear Godfrey’s Cottage.” and “1B. Defend Godfrey’s Cottage.”
AREA FACTION CONTROL TASKS
The first single task we’re going to want to make is an AreaFactionControlTask. This is a prefab task that already has a faction control trigger that allows you to easily make a task where the objective is to clear or control a certain area. This is found in the same location as the MultiTask, NightOpsDynamicTaskFramework>Prefabs>NO_DTF.
As we need this in a set location we can’t make it a child straight away, so drag it onto the map where you want this task to take place. Drag the prefab onto the map, where you want to task to take place:
You’ll then need to make this new task a child of the MultiTask, by dragging it in the hierarchy over the MultiTask_1:
We get the same options for this task as for the multi task, other than the multi task component. Remember to change the faction as it defaults to USSR, and change the name and description:
You’ll also notice that this task comes with a child entiy already. This child entity is the faction control trigger, that tells the task when it is complete. Tasks will automatically complete when their child trigger is activated. We need to set this trigger up to tell it how to end the task:
The first setting is the Owner Faction Key. This is the “Key”, in this mission either US, FIA or USSR, and is what the trigger consideres “friendly”, which is important in the next section.
The second section is the Faction Control Trigger. You can set different faction ratio limits, so the trigger activates if more than 75% of the characters in the trigger are of the “friendly” faction set in the previous section. Setting it to 0.75 would mean that if there were 4 characters in the trigger and 3 were friendly, the trigger would activate.
Under TaskManager you can change what state the task goes to when the trigger activates, such as “Finished” or “Failed”:
Finally under unsorted you can see the trigger options, it’s currently set to a 10m Sphere. If you check the “draw shape” box you can see this on the map – however if this is checked players will be able to see it too! I’ve checked it in this image so you can see what it looks like:
I’ve set my trigger to match the size of the Defend waypoint for the AI – so they can’t accidentally walk out and complete the mission for you! Now, when the cottage is clear, the task will be finished.
Now, at this point if you test the mission you might get some errors, or the tasks might not add. If this happens, check that you’ve followed all of the steps and try restarting the entire workbench.
For Phase 2, we want a new task to start when the clear the cottage task ends. To do this we need to make a new task and give it a name. I’ll be using another AreaFactionControl task, but making the trigger area much larger to encapsulate new enemies attacking the cottage as well as the cottage itself.
Make this task a child of the multi task as well, give it a name and description and set the correct faction. Then in the top right where it says (no name), change the entity names to task2:
Go back to the first task (task2 may move above it depending on your sort settings in the hierarchy) and click on the + next to Create Task Names Success:
Type the name of the new task, “task2” into the field that appears and check the “Assign First Task” field. The assign first task field means that the task on line 0 (the first task) won’t just be created but assigned.
Now when the first task is completed the second task will be created and assigned. When both of these tasks are complete, the multitask will become complete as well. Of course, as there are no more AI, the second task will complete immediately!
I’m going to add a third task outside of the mutli task to move to an extract point, and it to be activated on the multitask completing:
There’s more to the tasks framework, however this should be enough for the time being!