For the complete documentation index, see llms.txt. This page is also available as Markdown.

Tasks

You are reading the documentation for Bridge SDK v2. If you need the obsolete v1 documentation, see Documentation (v1).

Task system for daily, weekly, and permanent goals ("kill 20 enemies", "collect 100 coins"). The game declares task groups in the config, reports gameplay through addProgress(), and claims rewards once a task is complete.

Configuration

Declare task groups in the config under the tasks key. Each group has a type: daily / weekly groups reset every UTC day / week; permanent groups never reset. Every item in a group is active for the period.

{
    "tasks": [
        {
            "id": "daily",                 // stable storage key for the group
            "type": "daily",               // 'daily' | 'weekly' | 'permanent'
            "items": [
                {
                    "id": "kills",
                    "targets": [{ "id": "enemy_killed", "amount": 20 }],   // metric id + goal
                    "rewards": [{ "id": "gold", "amount": 500 }]
                },
                {
                    "id": "combo",
                    "targets": [                                            // completes only when ALL targets are met
                        { "id": "kill", "amount": 3 },
                        { "id": "coin", "amount": 100 }
                    ],
                    "rewards": [{ "id": "gem", "amount": 1 }, { "id": "gold", "amount": 50 }]
                }
            ]
        }
    ]
}

Groups with an unknown type or a missing id/items are ignored; missing config yields an empty task list.

Get Tasks

Returns every active task across all groups, with live progress.

Call the Tasks Get Tasks action, then handle the On Tasks Get Tasks Completed trigger. Read the result with the TasksCount, TaskId, TaskType, TaskTargetsCount, TaskTargetProgress, TaskTargetAmount, TaskRewardsCount, TaskRewardId, TaskRewardAmount expressions, the Is Task Completed / Is Task Claimed / Is Task Target Completed conditions, or take everything at once with TasksAsJSON.

Copy This Example

Call the Tasks Get Tasks action, then handle the On Tasks Get Tasks Completed condition. Read the result with the PlaygamaBridge::TasksCount(), PlaygamaBridge::TaskId(index), PlaygamaBridge::TaskType(index), PlaygamaBridge::TaskTargetProgress(index, targetIndex), PlaygamaBridge::TaskTargetAmount(index, targetIndex), PlaygamaBridge::TaskRewardId(index, rewardIndex), PlaygamaBridge::TaskRewardAmount(index, rewardIndex) expressions, the Is Task Completed / Is Task Claimed conditions, or take everything at once with PlaygamaBridge::TasksAsJSON().

Copy This Example

A Task looks like this:

Add Progress

Report a gameplay metric. Every active target watching that metric advances by amount (default 1), across all groups and types at once, clamped to the target's goal. An unwatched metric is a no-op.

Call the Tasks Add Progress action with the metric id and amount, then handle the On Tasks Add Progress Completed trigger.

Copy This Example

Call the Tasks Add Progress action with the metric id and amount, then handle the On Tasks Add Progress Completed condition.

Copy This Example

addProgress() resolves to void — read completion back via getTasks().

Claim Reward

Marks a completed task's rewards as claimed. Resolves to true on success, or false when the task is not currently active, not yet complete, or already claimed. It does not return the rewards — read them from the task's rewards via getTasks().

Call the Tasks Claim Reward action with the task id, then handle the On Tasks Claim Reward Completed trigger — Is Last Action Completed Successfully is true only when the reward was actually claimed. Read the rewards to grant with the TaskRewardId / TaskRewardAmount expressions after Tasks Get Tasks.

Copy This Example

Call the Tasks Claim Reward action with the task id, then handle the On Tasks Claim Reward Completed condition — Is Last Action Completed Successfully is true only when the reward was actually claimed. Read the rewards to grant with the PlaygamaBridge::TaskRewardId(...) / PlaygamaBridge::TaskRewardAmount(...) expressions after Tasks Get Tasks.

Copy This Example

Last updated