aboutsummaryrefslogtreecommitdiff
path: root/building_guide/quests.md
blob: 2c0cbacafbc14365330adf0261dd2456984338c8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
## Complete Quest Example: "Clear the Rats"

> **Filenames are IDs.** Every mob/object/room file below has no `id:` field — its filename is its ID (e.g. `quest_giver.yaml` → `quest_giver`). Nested `- id:` under a room's `objects:`/`mobs:` are references and stay.

### 1. Quest giver mob (`data/mobs/quest_giver.yaml`)
```yaml
name: "Elder"
unique: true
protected: true
idle_descriptions:
  - "mutters about the rat infestation"
talk:
    nodes:
        start:
            message: "\"Rats! Rats everywhere in the cellar. Clear them out and I'll reward you.\""
            options:
                - text: "\"I'll handle it.\""
                  goto: accept_quest
                  condition:
                      player_flag: rat_quest
                      not: true
                - text: "\"I killed the rats.\""
                  goto: turn_in
                  condition:
                      player_flag: rat_quest
                      value: started
                - text: "\"Goodbye.\""

        accept_quest:
            message: "\"Good lad. The cellar is west of here. Come back when they're dead.\""
            action:
                set_player_flags:
                    rat_quest: started
            options:
                - text: "\"On my way.\""

        turn_in:
            message: "\"You did it! The village owes you a debt. Here — take this.\""
            action:
                give_item: rusty_sword
                set_player_flags:
                    rat_quest: complete
                heal: 10
            options:
                - text: "\"Thanks!\""
```

Talk configs are inline on the mob under the `talk:` key. No separate behavior file needed.

### 2. Rat mobs (`data/mobs/rat.yaml`)
```yaml
name: "giant rat"
combat:
  kind: combat
  aggressive: true
  attack_types: [crush]
  respawn_ticks: 60
  stats:
    attack: 2
    strength: 1
    defense: 1
    hp: 3
    speed: 4
drops:
  remains: "rat bones"
```

### 3. Cellar room (`data/rooms/20.yaml`)
```yaml
name: "Cellar"
description: "A damp, dark cellar. The floor scuttles with movement."
exits:
  east: 1
mobs:
  - "rat"
  - "rat"
  - "rat"
  - "rat"
  - "rat"
```

### 4. Room 1 with quest giver (`data/rooms/1.yaml`)
```yaml
name: "Town Square"
description: "Cobblestone paths lead in all directions. The Elder stands near the fountain."
exits:
  west: 20
  north: 2
mobs:
  - "quest_giver"
objects:
  - id: lumby_fountain
```

---