# Objectives & Rewards

# Objectives & Rewards

Every quest consists of one or more **objectives** (what the player must do) and one or more **rewards** (what the player receives on completion). The Mod Editor provides dedicated sub-editors for both.

## Objectives

### Adding an Objective

In the quest editor, scroll to the **Objectives** section and click **"+ Add Objective"**. A new objective row appears with default values (`kills` type, count of 1).

### Objective Fields

Each objective has three main fields:

| Field | Description |
|-------|-------------|
| **Type** | What kind of action the player must perform (dropdown) |
| **Target** | Which entity, block, item, or location to interact with |
| **Count** | How many times the action must be performed |

### Objective Types

The editor supports 15 objective types:

| Type | Target | Description |
|------|--------|-------------|
| `kills` | Entity ID | Kill specific entities |
| `blocks_mined` | Block ID | Mine specific blocks |
| `blocks_chopped` | Block ID | Chop specific blocks (trees) |
| `blocks_dug` | Block ID | Dig specific blocks |
| `blocks_placed` | Block ID | Place specific blocks |
| `blocks_harvested` | Block ID | Harvest specific blocks (crops) |
| `flowers_picked` | Block ID | Pick specific flowers |
| `items_collected` | Item ID | Collect specific items |
| `items_crafted` | Item ID | Craft specific items |
| `interact_npc` | Citizen ID | Interact with a specific NPC |
| `zone_discovered` | Zone name | Discover a specific zone |
| `distance_traveled` | _(automatic)_ | Travel a total distance |
| `playtime_minutes` | _(automatic)_ | Play for a number of minutes |
| `damage_dealt` | _(automatic)_ | Deal a total amount of damage |
| `damage_taken` | _(automatic)_ | Take a total amount of damage |

:::info Hidden Targets
The last four types (`distance_traveled`, `playtime_minutes`, `damage_dealt`, `damage_taken`) do not have a target field. The target is automatically set to `any` and the input is hidden.
:::

### Autocomplete

For types that target entities, blocks, or items, the editor provides **autocomplete suggestions** powered by the reference data. As you type, matching IDs appear in a dropdown.

The autocomplete context changes based on the objective type:

- **kills** -- suggests entity IDs (e.g., `Entity_Trork_Base`)
- **blocks_mined**, **blocks_chopped**, etc. -- suggests block IDs (e.g., `Ore_Iron`)
- **items_collected**, **items_crafted** -- suggests item IDs (e.g., `Ingredient_Stick`)

:::tip Multi-Target Objectives
You can specify multiple targets by separating them with commas. For example, entering `Entity_Trork_Base, Entity_Trork_Archer` will create an objective that counts kills of either entity type.
:::

### Target Validation

When reference data is loaded, the editor validates each target against the known ID lists. Invalid targets are flagged with a red **"Invalid"** badge. This helps catch typos before you export.

Targets are considered valid if they:
- Match a known entity, block, or item ID
- Contain a wildcard (`*`)
- Start with `@` (property-based target like `@consumable`)
- Are set to `any`

### Consume Items Option

When the objective type is `items_collected`, an additional **"Consume items on completion"** checkbox appears. When enabled, the collected items are removed from the player's inventory upon quest completion.

### Removing an Objective

Click the trash icon on any objective row to remove it. The remaining objectives reorder automatically.

## Rewards

### Adding a Reward

Scroll to the **Rewards** section and click **"+ Add Reward"**. A new reward row appears with default values (`item` type).

### Reward Types

The editor supports 8 reward types, each with its own set of fields:

| Type | Fields | Description |
|------|--------|-------------|
| `item` | Item ID + Amount | Give the player items |
| `quest_tokens` | Amount | Award quest tokens (currency) |
| `currency` | Currency type + Amount | Award currency (gold, silver, bronze) |
| `mmo_xp` | Skill + XP amount | Award MMO skill experience |
| `lootbag` | Lootbag ID | Give the player a lootbag |
| `title` | Title ID | Unlock a title for the player |
| `achievement` | Achievement ID | Grant an achievement |
| `command` | Command string + Executor | Run a server command |

### Reward Details by Type

- **Item** -- Item ID field (with autocomplete) + Amount. Example: `Potion_Healing` x3.
- **Quest Tokens** -- A simple numeric amount of quest tokens.
- **Currency** -- Currency dropdown (`gold`, `silver`, `bronze`, `quest_tokens`) + Amount.
- **MMO XP** -- Skill dropdown (`mining`, `woodcutting`, `farming`, `fishing`, `combat`, `crafting`, `cooking`, `alchemy`) + XP amount.
- **Lootbag** -- Lootbag ID (must match a defined lootbag).
- **Title** -- Title ID to unlock.
- **Achievement** -- Achievement ID to grant.
- **Command** -- Command string (use `{player}` placeholder) + Executor (`console` or `player`).

### Removing a Reward

Click the trash icon on any reward row to remove it.

## Read-Only Mode

When viewing a **base quest** (from server defaults), both objectives and rewards are displayed in read-only mode. You can see all values but cannot edit them. To make changes, click **"Clone to Custom"** in the quest header to create an editable copy.

## Best Practices

:::tip Designing Good Quests
- **Start simple** -- One objective and one reward is enough for daily quests
- **Scale rewards to difficulty** -- Use the [Tier Generator](./tier-generator) to create balanced variants automatically
- **Use multi-target objectives** -- Instead of creating separate quests for each Trork type, use comma-separated targets
- **Validate before exporting** -- Check the Validation page for cross-reference errors (e.g., referencing items or entities that do not exist)
:::

## Next Steps

- [Tier Generator](./tier-generator) -- Automatically create difficulty variants from a base quest