Links
Comment on page

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;
Unity
Unreal
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;
Unity
Unreal
1
int missionID = 0;
2
LootLockerSDKManager.StartMission(missionID, (response) =>
3
{
4
if (response.success)
5
{
6
Debug.Log("Mission successfully started!");
7
}
8
else
9
{
10
Debug.Log("Error, could not start mission:" + response.Error);
11
}
12
});

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.
Unity
Unreal
1
int missionID = 0;
2
string missionSignature = "eee411109a229046154bc9d75265a9ccb23a3a9c"; // Received when calling LootLockerSDKManager.StartMission()
3
string playerID = "1234";
4
LootLockerFinishingPayload payload = new LootLockerFinishingPayload();
5
payload.finish_time = "10";
6
LootLockerSDKManager.FinishMission(missionID, missionSignature, playerID, payload, (response) =>
7
{
8
if (response.success)
9
{
10
Debug.Log("Mission finished!");
11
}
12
else
13
{
14
Debug.Log("Error, could not finish mission:" + response.Error);
15
}
16
});

Get information about all available missions;

Unity
Unreal
1
LootLockerSDKManager.GetAllMissions((response) =>
2
{
3
if (response.success)
4
{
5
Debug.Log("Successfully received all missions:");
6
for (int i = 0; i < response.missions.Length; i++)
7
{c#
8
Debug.Log(response.missions[i].asset_id);
9
}
10
}
11
else
12
{
13
Debug.Log("Error, could not fetch missions:" + response.Error);
14
}
15
});
Get information about a single mission
Unity
Unreal
1
int missionID = 0;
2
LootLockerSDKManager.GetMission(missionID, (response) =>
3
{
4
if (response.success)
5
{
6
Debug.Log("Successfully received mission");
7
Debug.Log(response.mission.difficulty_name);
8
}
9
else
10
{
11
Debug.Log("Error, could not fetch mission:" + response.Error);
12
}
13
});