Working with missions in-game

When you have created one or several missions, you can use these functions to use them in your game.

More information about missions can be found here; Game Systems, Missions

Start a mission

You get the missionID needed to start the mission by calling;

LootLockerSDKManager.GetAllMissions(Action <LootLockerGetAllMissionsResponse> onComplete)

Or you can find it in the LootLocker web console

When you have the ID of the mission you want to start, you can use this function;

int missionID = 0;
LootLockerSDKManager.StartMission(missionID, (response) =>
{
    if (response.success)
    {
        Debug.Log("Mission successfully started!");
    }
    else
    {
        Debug.Log("Error, could not start mission:" + response.Error);
    }
});

Finish a mission

To finish a mission, you must first start a mission, and then send the missionSignature as a parameter when ending the mission.

int missionID = 0;
string missionSignature = "eee411109a229046154bc9d75265a9ccb23a3a9c"; // Received when calling LootLockerSDKManager.StartMission()
string playerID = "1234";
LootLockerFinishingPayload payload = new LootLockerFinishingPayload();
payload.finish_time = "10";
LootLockerSDKManager.FinishMission(missionID, missionSignature, playerID, payload, (response) =>
{
    if (response.success)
    {
        Debug.Log("Mission finished!");
    }
    else
    {
        Debug.Log("Error, could not finish mission:" + response.Error);
    }
});

Get information about all available missions;

LootLockerSDKManager.GetAllMissions((response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully received all missions:");
        for (int i = 0; i < response.missions.Length; i++)
        {c#
            Debug.Log(response.missions[i].asset_id);
        }
    }
    else
    {
        Debug.Log("Error, could not fetch missions:" + response.Error);
    }
});

Get information about a single mission

int missionID = 0;
LootLockerSDKManager.GetMission(missionID, (response) =>
{
    if (response.success)
    {
        Debug.Log("Successfully received mission");
        Debug.Log(response.mission.difficulty_name);
    }
    else
    {
        Debug.Log("Error, could not fetch mission:" + response.Error);
    }
});

Last updated