GS2-Mission

Mission/Achievement Functions

It is a mechanism for rewarding players based on their accumulated actions in the game. This feature is used to implement features commonly referred to as Achievements, Trophies, and Missions.

Mission Counter

An entity to count the number of times based on a player’s actions. A counter is provided to count the number of times a player has completed a quest, enhanced a character, or drawn a gacha, etc. in the game.

Scope can be set for the counter. The following values can be set for the scope.

Scope TypeScope Content
Not resettingTotal since the start of game play
Reset at X time every dayNumber of executed in same day
Reset at X time every week on X day of the weekNumber of times executed in this week
Reset at X time on X day of every monthNumber of times executed in this month

Counter values are managed by each scope and the values of each scope can be used for mission accomplishment conditions.

Mission Task

This is the master data that defines the goal to be presented to the player.

It defines the “mission counter,” the “scope,” the “target value,” and the “reward” for achieving the goal. For example, the following settings can be configured

Mission CounterScope TypeTarget ValueReward
Number of times you completed the questResets at X time every day of the week10Item A
Number of times you complete a questResets at X time every X days of the week50Item B
Number of times you have enhanced your characterReset at X time every day5Item C

Mission Group

An entity that unites multiple mission tasks. A mission group can have a reset cycle for the reward receipt flag.

Mission CounterScope TypeTarget ValueReward
Number of times you completed the questReset at X time every day10Item A
Number of times you have enhanced your characterReset at X time every day5Item C

By associating these mission tasks with a single mission group and setting “Reset at X time every day” for the reset cycle of the reward receipt flag for the mission group as well When a mission task is accomplished every day, the user will be able to receive the reward every day.

Example of implementation

Raise Mission Counter

Raising the mission counter cannot be handled by the SDK for the game engine.

Please implement it in a way such as raising the counter as a reward for clearing GS2-Quest or as a lottery reward for GS2-Lottery.

Obtain information on mission task accomplishment status and reward receipt

    var item = await gs2.Mission.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Complete(
        missionGroupName: "mission-group-0001"
    ).ModelAsync();
    const auto Domain = Gs2->Mission->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->Complete(
        "mission-group-0001" // missionGroupName
    );
    const auto item = Domain.Model();

Receive rewards for mission accomplishment

    var result = await gs2.Mission.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Complete(
        missionGroupName: "mission-group-0001"
    ).ReceiveRewardsAsync(
        missionTaskName: "mission-task-0001"
    );
    const auto Domain = Gs2->Mission->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->Complete(
        "mission-group-0001" // missionGroupName
    );
    const auto Future = Domain->ReceiveRewards(
        "mission-task-0001"
    );
    Future->StartSynchronousTask();
    if (Future->GetTask().IsError()) return false;

Get the value of the mission counter

    var item = await gs2.Mission.Namespace(
        namespaceName: "namespace-0001"
    ).Me(
        gameSession: GameSession
    ).Counter(
        counterName: "quest_complete"
    ).ModelAsync();
    const auto Domain = Gs2->Mission->Namespace(
        "namespace-0001" // namespaceName
    )->Me(
        AccessToken
    )->Counter(
        "quest_complete" // counterName
    );
    const auto item = Domain.Model();

Get the mission’s target value

    var items = await gs2.Mission.Namespace(
        namespaceName: "namespace-0001"
    ).MissionGroupModel(
        missionGroupName: "mission-group-0001"
    ).MissionTaskModelsAsync(
    ).ToListAsync();
    const auto Domain = Gs2->Mission->Namespace(
        "namespace-0001" // namespaceName
    )->MissionGroupModel(
        "mission-group-0001" // missionGroupName
    );
    const auto It = Domain->MissionTaskModels(
    );
    TArray<Gs2::UE5::Mission::Model::FEzMissionTaskModelPtr> Result;
    for (auto Item : *It)
    {
        if (Item.IsError())
        {
            return false;
        }
        Result.Add(Item.Current());
    }

Detailed Reference