Create a new Quest - AnduoGames/ThirdCrisisModding GitHub Wiki

Quests are called Missions in Third Crisis. Due to having re-written our Mission System, the currently used mission system in Third Crisis is called NewMission.

To enable saving and loading of missions, all missions and tasks need to have a template saved in a cache. This should be done in the OnModLoaded method.

// Create the Template Mission
var moddedMission = ScriptableObject.CreateInstance<NewMission>();
moddedMission.DisplayName = "Modded Mission Display Name";
moddedMission.Description = "Modded Mission Description";
moddedMission.name = "MY_UNIQUE_MODDED_MISSION_ID";

// Create the Template Task
var moddedTask1 = ScriptableObject.CreateInstance<NewTask>();
moddedTask1.DefaultDisplayName = "Modded Task Display Name";
moddedTask1.TargetCharacter = Character.Get("Jewel");
moddedTask1.name = "MY_UNIQUE_MODDED_TASK_ID_1";

// Add both Mission and Task to the cache
MissionContainer.AddMissionToLookup(moddedMission);
MissionContainer.AddTaskToLookup(moddedTask1);

Once this is done, you can start the cached mission and add your cached task to it:

var missionInstance = NewMission.StartMissionByID("MY_UNIQUE_MODDED_MISSION_ID");
var taskInstance = missionInstance.StartTask("MY_UNIQUE_MODDED_TASK_ID_1");

From here, you can set task completion at any point in the code:

taskInstance.Completion = TaskCompletion.Complete;

To get a Mission and/or Task that you started earlier, use

var mission = NewMission.GetMissionsByID("Your Unique Mission ID")[0];
var task = mission.GetTasksByID("Your unique Task ID")[0];

Note, that we do [0] here, assuming that there is only ever 1 of these mission and task.

⚠️ **GitHub.com Fallback** ⚠️