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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
|
//-----------------------------------------------------------------------------
// Illia Island
// $@illia_progress = 4
//
// Level progress:
// 0: Did not start the channelling, or previous channelling failed
// 1: Channelling started
// 2: Channelling completed
//-----------------------------------------------------------------------------
052-1.gat,25,44,0|script|#EnchantDoorTrigger|32767,3,4,{
set @step, 4;
if ($@illia_progress < @step) goto L_ShouldNotBeHere;
if (strcharinfo(0) == $@ILLIA_HERO$ &&
$@illia_level_4_progress == 0) goto L_EnchantDoor;
end;
L_EnchantDoor:
enablenpc "#Enchanted Door";
end;
L_ShouldNotBeHere:
percentheal -100, 0;
end;
}
052-1.gat,57,29,0|script|#Enchanted Door|369,1,1{
if ($@illia_level_4_progress != 2) goto L_PushBack;
end;
L_PushBack:
warp "052-1.gat", 57, 34;
percentheal -20, 0;
message strcharinfo(0), "You are pushed back violently. There is probably some way to break this barrier.";
mes "You are pushed back violently.";
mes "There is probably some way to break this barrier.";
close;
OnCommandDS:
areamonster "052-1.gat", 56, 30, 60, 31, "", 1101, 2 + rand(3), "#Enchanted Door::onSpawn";
misceffect FX_EVIL_SUMMON;
end;
onSpawn:
end;
}
052-1.gat,57,29,0|script|#Enchanted Door2|127,1,1{
if ($@illia_level_4_progress == 2) goto L_Warp;
end;
L_Warp:
warp "052-2.gat", 33, 40;
end;
OnCommandDestroy:
misceffect FX_ENCHANTED_DOOR_BROKEN;
end;
}
052-1.gat,51,38,0|script|Engravings|127,{
mes "You can read some words engraved inside this rock, but some are erased by wind and time:";
next;
mes "\".. can use this .. power..´. . .´. . . amplify a spell ..´.";
mes " . ´´. Don't let .. spell power .´..´ . .. fade away ...";
mes "´ .Use lazurite stones ´..´. they will appear. ..´ .. drop them inside .. this circle.";
mes ". ´ power.. drains .. life..´. .´ focus . .not move at all´. .\"";
next;
mes "Below this strange writing, you notice a word still deeply engraved in the stone:";
next;
mes "\"#catalazuli\"";
next;
mes "... that looks like an incantation or something.";
if ($@illia_level_4_progress == 0)
goto L_SuggestChannelling;
close;
L_SuggestChannelling:
next;
mes "I think this blue circle right here can be helpful to break the enchantment that blocks the door of the Inn.";
next;
mes "Let's see how I can activate it...";
mes "But I should probably get inside it, first.";
close;
}
function|script|StartChannelling|{
if (isat("052-1.gat",53,38) == 0)
end;
if ($@illia_level_4_progress > 0)
end;
set $@illia_level_4_progress, 1;
set $@illia_char_channelling$, strcharinfo(0);
set @bonus, (readparam(bInt)+1) / 25;
// Lazurite Stones power, will also depend on the Int of the channelling character
setarray $@illia_lazurites_power,
12 + @bonus, // small
32 + @bonus, // regular
65 + @bonus; // large
// coordinates where stones will appear
setarray $@illia_small_lazurites, 50,41, 44,33, 61,42;
setarray $@illia_regular_lazurites, 68,29, 47,25, 38,45, 70,40;
setarray $@illia_large_lazurites, 21,40, 34,25;
// amount of initial magic power
set $@illia_magic_power, 1811 + readparam(bInt)*2;
// Channelling required power depends on the base Int of the character
set $@illia_magic_power_required, 5707 - 2*readparam(bInt);
// magic power loss depends also on Int
set $@illia_magic_power_loss, 53 - ((readparam(bInt)+1)*2)/10;
// register the power status to display hints to the players
// Statuses: 0=critical(below 300), 1=neutral, 2=almost there (max-300)
set $@illia_magic_power_status, 1;
message strcharinfo(0), "Ok, let's stay focused now!";
cmdothernpc "#Power Circle", "St";
close;
}
052-1.gat,53,38,0|script|#Power Circle|368,{
set @step, 4;
if ($@illia_progress < @step)
goto L_ShouldNotBeHere;
if (isat("052-1.gat",53,38) == 0)
goto L_Hint;
end;
OnCommandSt:
initnpctimer;
end;
L_Hint:
mes "Magic seems to be flowing from this place. I should find out what it is.";
close;
OnTimer2000:
callsub S_CheckChannelling;
end;
OnTimer4000:
callsub S_CheckChannelling;
end;
OnTimer6000:
// Spawn items at specific place
callsub S_ItemSpawn;
callsub S_CheckChannelling;
end;
OnTimer8000:
callsub S_CheckChannelling;
end;
OnTimer10000:
// Spawn items at specific place
callsub S_ItemSpawn;
callsub S_CheckChannelling;
end;
OnTimer11000:
setnpctimer 0;
// Spawn monsters (demonic spirits) near the enchanted door
cmdothernpc "#Enchanted Door", "DS";
end;
S_ItemSpawn:
if (isloggedin(getcharid(3, $@illia_char_channelling$)) == 0)
return;
attachrid(getcharid(3, $@illia_char_channelling$));
// spawn items at random
set $@illia_item_spawn_i, rand(getarraysize($@illia_small_lazurites)/2);
set $@illia_item_spawn_x, $@illia_small_lazurites[$@illia_item_spawn_i*2];
set $@illia_item_spawn_y, $@illia_small_lazurites[($@illia_item_spawn_i*2)+1];
if (rand(10) > 0)
makeitem 873, rand(4,7), "052-1.gat", $@illia_item_spawn_x, $@illia_item_spawn_y;
set $@illia_item_spawn_i, rand(getarraysize($@illia_regular_lazurites)/2);
set $@illia_item_spawn_x, $@illia_regular_lazurites[$@illia_item_spawn_i*2];
set $@illia_item_spawn_y, $@illia_regular_lazurites[($@illia_item_spawn_i*2)+1];
if (rand(8) > 0)
makeitem 874, rand(3,4), "052-1.gat", $@illia_item_spawn_x, $@illia_item_spawn_y;
set $@illia_item_spawn_i, rand(getarraysize($@illia_large_lazurites)/2);
set $@illia_item_spawn_x, $@illia_large_lazurites[$@illia_item_spawn_i*2];
set $@illia_item_spawn_y, $@illia_large_lazurites[($@illia_item_spawn_i*2)+1];
if (rand(4) > 0)
makeitem 875, rand(1,2), "052-1.gat", $@illia_item_spawn_x, $@illia_item_spawn_y;
set $@illia_item_spawn_i, 0;
set $@illia_item_spawn_x, 0;
set $@illia_item_spawn_y, 0;
detachrid;
return;
S_CheckChannelling:
// Remove stones inside the circle
set $@illia_magic_power, $@illia_magic_power +
getareadropitem("052-1.gat", 52, 37, 54, 39, 873, 1)*$@illia_lazurites_power[0] +
getareadropitem("052-1.gat", 52, 37, 54, 39, 874, 1)*$@illia_lazurites_power[1] +
getareadropitem("052-1.gat", 52, 37, 54, 39, 875, 1)*$@illia_lazurites_power[2];
// magic power fades over time
set $@illia_magic_power, $@illia_magic_power - $@illia_magic_power_loss;
set $@illia_magic_power_last_status, $@illia_magic_power_status;
set $@illia_magic_power_status, 1;
if ($@illia_magic_power < 300)
set $@illia_magic_power_status, 0;
if ($@illia_magic_power > $@illia_magic_power_required - 300)
set $@illia_magic_power_status, 2;
// Player loses a part of his health while channelling
if (isloggedin(getcharid(3, $@illia_char_channelling$)) == 0)
goto L_ChannellingFail;
attachrid(getcharid(3, $@illia_char_channelling$));
// Display an effect showing the drain
misceffect FX_CHANNELLING_RAISE;
percentheal -4, 0;
if (isdead())
goto L_ChannellingDead;
if (isat("052-1.gat",53,38) == 0)
goto L_ChannellingMoved;
// check the magic power
if ($@illia_magic_power <= 0)
goto L_ChannellingPowerVanished;
if ($@illia_magic_power >= $@illia_magic_power_required)
goto L_ChannellingComplete;
detachrid;
if ($@illia_magic_power_last_status == 0 && $@illia_magic_power_status == 1)
mapannounce "052-1.gat", $@illia_char_channelling$ + ": I think I'm controlling the spell again now. Keep up!", 0;
if ($@illia_magic_power_last_status == 1 && $@illia_magic_power_status == 0)
mapannounce "052-1.gat", $@illia_char_channelling$ + ": Guys I'm loosing it! Hurry up!", 0;
if ($@illia_magic_power_last_status == 1 && $@illia_magic_power_status == 2)
mapannounce "052-1.gat", $@illia_char_channelling$ + ": I almost have the power to cast it! One last effort!", 0;
if ($@illia_magic_power_last_status == 2 && $@illia_magic_power_status == 1)
mapannounce "052-1.gat", $@illia_char_channelling$ + ": Damn! It faded a little.", 0;
return;
L_ChannellingComplete:
message strcharinfo(0), "You successfully cast the spell and broke the door's enchantment!";
detachrid;
stopnpctimer;
setnpctimer 0;
set $@illia_magic_power, 0;
set $@illia_magic_power_required, 0;
set $@illia_magic_power_last_status, 0;
set $@illia_magic_power_status, 0;
set $@illia_magic_power_loss, 0;
set $@illia_char_channelling$, "";
set $@illia_level_4_progress, 2;
set $@illia_progress, 5;
set $@illia_max_time, $@illia_max_time + 900;
// Effect to display the disenchant is cast
misceffect FX_CHANNELLING_CAST;
// move away the enchanted door
cmdothernpc "#Enchanted Door2", "Destroy";
disablenpc "#Enchanted Door";
end;
L_ChannellingDead:
misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0);
goto L_ChannellingFail;
L_ChannellingMoved:
// kill the player as part of the process: the magic process drained his life.
// But only if he is still in the island (otherwise, he probably got warped
// and does not need being killed)
if (isin("052-1.gat",1,1,100,80) == 0)
goto L_ChannellingFail;
percentheal -100, 0;
misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0);
message strcharinfo(0), "You moved out of the power circle. The magic power you accumulated backfires at you!";
goto L_ChannellingFail;
L_ChannellingPowerVanished:
// kill the player as part of the process: the magic process drained his life.
percentheal -100, 0;
misceffect FX_MAGIC_DARK_EXPLOSION, strcharinfo(0);
message strcharinfo(0), "The magic power vanished, and your spell backfires at you!";
goto L_ChannellingFail;
L_ChannellingFail:
detachrid;
stopnpctimer;
setnpctimer 0;
set $@illia_magic_power, 0;
set $@illia_magic_power_required, 0;
set $@illia_magic_power_last_status, 0;
set $@illia_magic_power_status, 0;
set $@illia_magic_power_loss, 0;
set $@illia_char_channelling$, "";
set $@illia_level_4_progress, 0;
end;
L_ShouldNotBeHere:
percentheal -100, 0;
end;
}
|