-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathevent_template.js
More file actions
147 lines (147 loc) · 4.27 KB
/
event_template.js
File metadata and controls
147 lines (147 loc) · 4.27 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
export const eventX =
{
description: "Description of the event, and also a place to put the function that executes on entry.",
redirect: 20, // Automatically moves to that event - movement commands redundant
new_room: true, // if false, won't clear screen
escape_redirect: 10, // Destination of the escape command
north: 1, // destination of the north command
south: 2, // destination of the south command
east: 3, // destination of the east command
west: 4, // destination of the west command
on_direction: function(direction)
{
// Trigger when choosing one of the direction commands
// Use the provided argument to check which direction was selected
},
enemies:
[
{
name: "Enemy Name",
agility: 10,
constitution: 10,
escape_redirect: 50,
invincible: true, // Won't lose any constitution
callbacks:
[
{
timing: CallbackTiming.RoundEnd,
round: 1, // 0 means every round
callback: function()
{
// Trigger to execute on end of round 1.
}
},
{
timing: CallbackTiming.RoundStart,
round: 3, // 0 means every round
callback: function()
{
// Trigger to execute on start of round 3.
}
},
{
timing: CallbackTiming.CombatEnd,
callback: function()
{
// Trigger to execute on defeat.
// This will not trigger when escaping or ending combat through the system.stopCombat() function.
}
}
]
}
],
gold: 100, // collected with the "take gold" command
rations: 1, // collected with the "take ration" command
items: // collected with the take command
[
"Item1",
"Item2"
],
item_limit: 1, // only one of the items from the list can be taken
on_take: function(item)
{
// Trigger after taking an item.
// Use the provided argument to check which item was taken.
// Note that this argument is not the item id.
// It is the name that the user typed with the take command, changed to all lowercase.
},
eat: true, // can use the eat command
on_eat: function()
{
// Trigger to execute instead of the normal eat command.
},
yes_no_choice:
{
question: "Make a choice",
no: 11,
no_new_room: true,
on_no: function()
{
// Trigger to execute on no.
},
yes: 12,
yes_new_room: false,
on_yes: function()
{
// Trigger to execute on yes.
},
},
choice:
{
question: "What do you choose?",
options:
[
{
answer: "option1",
redirect: 13,
new_room: false
},
{
answer: "option2",
redirect: 14,
new_room: true,
on_option: function()
{
// Trigger to execute on option selected.
}
}
]
},
locals:
[
{
command: "local_command",
redirect: 100,
new_room: true,
on_command: function()
{
// Trigger to execute on command typed.
}
}
],
on_exit: function()
{
// Trigger to execute on room exit.
},
quiz:
{
question: "What do you thing the answer is?",
answers:
[
"correct1",
"correct2"
],
correct: 10,
correct_new_room: true,
on_correct: function()
{
// Trigger to execute if user gave one of the accepted answers.
},
incorrect: 13,
incorrect_new_room: true,
on_incorrect: function()
{
// Trigger to execute if user gave a wrong answer.
}
}
};