In an earlier tutorial, we created an Objective with multiple States, to represent a quest that the Player can undertake.
In this tutorial, we'll make use of sub-Objectives, so that our Objective states can themselves be made up of multiple tasks.
Previously, we created an Objective named "Slay the dragon", which includes a State to go to the dragon's lair:
Now, let's suppose that we want to involve information-gathering: and task the Player with asking around town for clues about the lair's location. The Player can ask Tom, Dick and Harry - in any order - and only once they've spoken to all three, will this new Objecive State be complete.
Back in the Objective's properties in the Inventory Manager, create a new State named "Gather intel", and position it in-between "Get a sword" and "Go to the dragon's lair":
This new State will involve speaking to Tom, Dick and Harry - NPCs in the game. We'll need to create these as individual Objectives. Each needn't have any additional States beside the default - just create three new Objectives and name them as follows:
In order to classify these as sub-Objectives, we'll need to place them in a dedicated Category. To do this, click on the Manager's Categories tab, and create two new Categories named Main and Gather intel sub-Objectives. Check Available to Objectives? for both:
Back in the Objectives tab, select each of the three "Talk to" Objectives, and set their Category fields to Gather intel sub-Objectives:
Any other Objectives - "Slay the dragon" included - will be automatically assigned to the "Main" category.
We can now map these sub-Objectives to our "main" Objective's "Gather intel" state. Navigate to this state, and set its Sub-Objectives category to this new Category as well:
Notice that more options now appear underneath, allowing us to set some automatic state-switching behaviour:
When the Player enters the "Gather intel" State - which we can do with the Objective: Set state Action - we'll want our three "Talk to" sub-Objectives to become active. We can do this by checking Auto-start sub-Objectives when enter?.
With the All sub-obs complete field, we can select which state our main Objective should switch to once the Player has spoken to each of the three characters:
If instead only need the Player to speak to just one NPC, we can use the Any sub-obs complete field.