Adding objectives
This page describes how to add a new objective that can then be added to a game mode.
Last updated
This page describes how to add a new objective that can then be added to a game mode.
Last updated
To add a new gameobject you have to first create a new script in Assets > Scripts > SS3D > Systems > Gamemodes > Objectives.
You may copy another objective that is already done to make your life easier, but the rules an objective has to follow are:
It has to be a child of the GamemodeObjective class.
It has to call the Succeed method to be completeable.
It has to have a CreateAssetMenu property above the class.
It has to be in the SS3D.Systems.Gamemodes.Objectives namespace.
Let's say you wanted to create an objective to picking up a BikeHorn
First you would create a new script that inherits GamemodeObjective, let's call it PickupBikehornObjective.
You would then have to set up the CreateAssetMenu property since the GamemodeObjective class is an ScriptableObject. you should also put it under the SS3D.Systems.Gamemodes.Objectives namespace.
You would then end up with this:
We now add the pickedUpItemId and pickedUpPlayerCkey private properties so we can hook them to the ItemPickedUpEvent and check if the picked up item was a bikehorn.
We now have to add an event listener to the ItemPickedUpEvent, we do that in the AddEventListeners method, we will then hook it to a HandleItemPickedUpEvent method.
We usually call the FinalizeObjective to conclude an objective, but you could call either Succeed or Fail from any method, but following our practices we will do the check inside FinalizeObjective anyway.
Now you just have to create the ScriptableObject, for that we go to the Assets > Content > Data > Gamemode > Objectives folder, right-click and go Create > Gamemode > Objectives > GetBikeHorn.
Now you just have to set up the properties for the objective as follows:
Title: What is the title of the objective that will appear in the UI.
Collaboration Type: if the objective is assigned to a single individual, multiple or if it's a competitve objective, meaning a single players can complete it.
Alignment Requirement: If Traitors, Crew members, or both can get this objective.
Min Assignees: Minimun number of players that will be assigned this objective.
Max Assignees: Maximum number of players that can be assigned this objective.
Done, now you have succesfully added a new objective to the game!