Date: 2015/07/01 10:04:31 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
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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
# NPC Merchant
# Citizens 2 (build #992)
# Denizen 0.9.3 (build #1352)
#
# @author M0R_Gaming
#
# FOR EASY SETUP
# 1) Select the NPC and type /npc assign --set “sellâ€
# Assignment script for merchant.
“Merchantâ€:
type: assignment
default constants:
BuyDiamond: 400
BuyIronIngot: 100
BuyBlazeRod: 100
interact scripts:
# Priority starts from 10
- 10 “Sellâ€
actions:
on assignment:
# Enable/disable triggers with NPC via chatting, clicking and entering proximity.
- trigger name:chat toggle:true
- trigger name:click toggle:true
- trigger name:proximity toggle:true radius:5
on enter proximity:
- random 2
- chat â€<dark_gray>Welcome to my store.â€
- chat â€<dark_gray>Please take your timeâ€
on exit proximity:
- zap ’s@Sell’ step:default
“Sellâ€:
type: interact
steps:
default:
click trigger:
script:
- chat “<dark_gray>Do you wish to buy something?â€
- narrate "Type <gold>Yes<white> or <gold>No<white>"
- zap BuyMenu
BuyMenu:
chat trigger:
'Yes':
trigger: '/Yes/.'
script:
- chat <dark_gray>Well, we have <Gold>Diamonds, Iron Ingots, and Blaze Rods <dark_gray>in stock.
- chat <dark_gray>What would you like to buy?
- zap Buy
'No':
trigger: ‘/No/, I do not wish to buy anything.’
script:
- chat “<dark_gray>Come back later if you want anything.â€
- zap default
Buy:
chat trigger:
‘Diamond’:
trigger: ‘/Diamond/s please.’
script:
- chat <dark_gray>Sure thing! How much do you want?
- narrate “Type in your amount in integersâ€
- zap BuyDiamond
‘Iron’:
trigger: ‘/Iron/ Ingots please.’
script:
- chat <dark_gray>Sure thing! How much do you want?
- narrate “Type in your amount in integersâ€
- zap BuyDiamond
‘Blaze’:
trigger: ‘/Blaze/ Rods please.’
script:
- chat <dark_gray>Sure thing! How much do you want?
- narrate “Type in your amount in integersâ€
- zap BuyDiamond
BuyDiamond:
chat trigger:
‘’:
trigger: ’//I would like <player.chat_history>’
script:
- narrate “This has not been completed yetâ€
- zap default
“ShopCost":
type: task
script:
# Check for enchantments and the state of durability used.
- if <player.item_in_hand.enchantments> != null {
- flag player enchantlvl:0
- foreach <player.item_in_hand.enchantments.levels> {
- flag player enchantlvl:++:%value%
}
}
else {
- flag player enchantlvl:0
}
- flag player duralvl:<player.item_in_hand.durability>
# Calculates repair cost based on enchant level & durability.
- flag player enchantcost:<flag.p:enchantlvl>
- flag player enchantcost:**:<cons:repairenchant>
- flag player duracost:<flag.p:duralvl>
- flag player duracost:**:<cons:repairdurability>
- flag player repaircost:<flag.p:enchantcost>
- flag player repaircost:++:<flag.p:duracost>