Date: 2016/08/13 11:38:20 UTC-07:00
Type: Denizen Script
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
TutorialBlacksmith:
type: assignment
interact scripts: ## This whole part of the script is only there so we can assign the following to the NPC.
- 10 TutorialBlacksmithQuest
## You only need to make sure the script has a unique name.
TutorialBlacksmithQuest:
type: interact
steps:
1: ## This is where the script begins, the 1: could be interpreted as stage 1.
click trigger: ## For almost all the NPCs we use the click trigger (right click) but the proximity trigger also exists (within range of the NPC).
script:
- ^zap step:2 ## This sets the NPC to stage 2 (for the player who is interacting with it and not globally).
- narrate "<&a><&l>Blacksmith: <&f>Hello there." ## Basic dialogue and as you see all color codes have to be surrounded by <>
- wait 2 ## The wait command is always in seconds if you don't specify something else.
- narrate "<&a><&l>Blacksmith: <&f>Go get 3 iron ore and I can make you a sword."
- wait 2
- zap step:3 ## At the end he will be set to stage 3.
2:
click trigger:
script: ## This is stage 2, it's always the same and we always zap to this stage before chatting.
- narrate "You can't do that right now." ## We do this so if the player right clicks the NPC a second time then he won't trigger everyone again.
- wait 5 ## Don't forget that at the end you always have to zap to another stage, either back to the same or to the next.
3:
click trigger:
script:
- zap step:2
- if <player.inventory.contains[iron_ore].qty[3]> { ## Simple IF..THEN..ELSE..
- ^take iron_ore qty:3 ## This is the command to take items from the player, note the ^ that means it happens instantly. Without that there will be a 0.5s delay.
- narrate "<&a><&l>Blacksmith: <&f>Perfect this will do, just a moment"
- wait 2
- narrate "<&o>The Blacksmith starts hammering on his anvil."
- wait 2
- narrate "<&a><&l>Blacksmith: <&f>There you go! A nice and sharp sword."
- give i@SteelSword ## This is the give command, it's a custom item which we'll look at alter.
- flag player TutorialBlacksmith:1 ## We flag the player with a specific flag to remember that he finished this Quest.
- wait 3
- zap step:4 ## And we go to the last stage "the final stage", for this NPC.
} else {
- zap step:2
- narrate "<&a><&l>Blacksmith: <&f>Sorry I need 3 iron ore before I can make a sword."
- wait 4
- zap step:3 ## We zap back to step 3 as he has not cleared it yet.
}
4:
click trigger:
script:
- zap step:2
- random { ## This random command is very useful to make NPCs a little more interesting.
- narrate "<&a><&l>Blacksmith: <&f>Goodluck on your travels!" ## The rest of the script is just a basic textline and making sure to zap to stage 2 and back to stage 4 at the end.
- narrate "<&o>The Blacksmith is too busy to notice you."
- narrate "<&a><&l>Blacksmith: <&f>May my tools protect you."
}
- wait 3
- zap step:4