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
|
//-----------------------------------------------------------------------------
// Illia Forsaken Inn - Storage
// $@illia_progress = 6
//
// Level progress:
// 0: Initial state
// 1: Items and/or mobs are spawned
// 2: All spawns are done and the players killed all mobs
//-----------------------------------------------------------------------------
052-2.gat,23,69,0|script|#TriggerItemsInvoker|32767,1,0,
{
set @step, 6;
if ($@illia_progress < @step) goto L_ShouldNotBeHere;
if (strcharinfo(0) != $@ILLIA_HERO$) end;
if ($@illia_level_6_progress == 0) goto L_StartItemInvoker;
end;
L_ShouldNotBeHere:
percentheal -100, 0;
end;
L_StartItemInvoker:
set $@illia_level_6_progress, 1;
cmdothernpc "#ItemsInvoker", "Start";
end;
}
052-2.gat,1,1,0|script|#ItemsInvoker|127,
{
end;
onInit:
setarray $@illia_storage_items, 541, 567, 568, 562;
setarray $@illia_storage_special_items, 687, 827, 1229;
// Map coords : x1,y1, x2,y2, ...
setarray $@illia_storage_item_points, 20,67, 22,75, 27,71, 30,73, 34,76, 30,64, 34,65, 34,62, 21,61, 22,64;
end;
OnCommandStart:
set $@illia_storage_max_items, 20;
set $@illia_storage_deviation, (8 + ($Illia_Luvia_Harvest*70)/100)*3;
initnpctimer;
areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onStart";
end;
onStart:
message strcharinfo(0), "You feel a strange atmosphere in this room... You sense a strong magic rising from the depth!";
end;
OnTimer1000:
if ($@illia_storage_max_items == 0)
goto L_CheckMobs;
set $@item_invoke_index, rand(getarraysize($@illia_storage_item_points)/2);
set $@item_invoke_x, $@illia_storage_item_points[$@item_invoke_index*2];
set $@item_invoke_y, $@illia_storage_item_points[($@item_invoke_index*2)+1];
npcwarp $@item_invoke_x, $@item_invoke_y, "#ItemsInvoker";
// This is a fix to force the official mana client to display a npc after a warp.
// Note: the manaplus client do not need this.
disablenpc "#ItemsInvoker";
end;
OnTimer1500:
// See the note above.
enablenpc "#ItemsInvoker";
areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onItem";
misceffect FX_GROUND_SPAWN;
end;
OnTimer3750:
setnpctimer 0;
set $@item_invoke_x, 0;
set $@item_invoke_y, 0;
set $@item_invoke_index, 0;
end;
onItem:
if (strcharinfo(0) == $@ILLIA_HERO$)
goto L_ItemSpawn;
end;
L_ItemSpawn:
// This section will decide what to spawn: special monster, monster, item, special item
// Calculation uses a decreasing variable which introduces a deviation.
// Its initial value is based on $@Illia_Luvia_Harvest
// * first decide (50% / 50%) if the deviation will be positive or negative
// * Apply the deviation to a random number between 0, 100. (note the final value can be < 0 or > 100)
// The purpose is that, when the initial deviation is high, there are high chances to get either
// a special monster, or a special item.
set @m, rand(100);
if (@m < 50)
set @r, rand(100) - $@illia_storage_deviation;
if (@m >= 50)
set @r, rand(100) + $@illia_storage_deviation;
// Reduce the deviation
set $@illia_storage_deviation, $@illia_storage_deviation*83/100;
if (@r < 5)
goto L_MakeSpecialMonster;
if (@r < 50)
goto L_MakeMonster;
if (@r > 98)
goto L_MakeSpecialItem;
// Normal item
makeitem $@illia_storage_items[rand(getarraysize($@illia_storage_items))], rand(2, 8), "052-2.gat", $@item_invoke_x, $@item_invoke_y;
set $@illia_storage_max_items, $@illia_storage_max_items - 1;
set @r, 0;
end;
L_MakeSpecialMonster:
monster "052-2.gat", $@item_invoke_x, $@item_invoke_y, "", 1103, 1, "#ItemsInvoker::onDeath";
areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onWtf";
set $@illia_storage_max_items, $@illia_storage_max_items - 1;
end;
L_MakeMonster:
monster "052-2.gat", $@item_invoke_x, $@item_invoke_y, "", 1101, rand(1, 3), "#ItemsInvoker::onDeath";
set $@illia_storage_max_items, $@illia_storage_max_items - 1;
set @r, 0;
end;
L_MakeSpecialItem:
makeitem $@illia_storage_special_items[rand(getarraysize($@illia_storage_special_items))], rand(2, 4), "052-2.gat", $@item_invoke_x, $@item_invoke_y;
areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onWow";
set $@illia_storage_max_items, $@illia_storage_max_items - 1;
set @r, 0;
end;
L_CheckMobs:
if ($@illia_progress != 6)
goto L_Clear;
if (mobcount("052-2.gat", "#ItemsInvoker::onDeath") < 0)
goto L_Stop;
setnpctimer 0;
end;
L_Clear:
stopnpctimer;
setnpctimer 0;
set $@illia_storage_deviation, 0;
set $@illia_storage_max_items, 0;
killmonster "052-2.gat", "#ItemsInvoker::onDeath";
end;
L_Stop:
stopnpctimer;
setnpctimer 0;
npcwarp 1, 1, "#ItemsInvoker";
set $@illia_storage_deviation, 0;
set $@illia_storage_max_items, 0;
set $@illia_level_6_progress, 2;
set $@illia_progress, 7;
callfunc "UpdateIlliaProgress";
set $@illia_max_time, $@illia_max_time + 1200;
areatimer "052-2.gat", 19, 60, 35, 78, 10, "#ItemsInvoker::onStop";
end;
onDeath:
end;
onStop:
message strcharinfo(0), "The magic seems to quickly dissipate.";
end;
onWtf:
message strcharinfo(0), "Look out!";
end;
onWow:
message strcharinfo(0), "Wow, see what appeared!";
end;
}
052-2.gat,35,68,0|script|#ToPartyRoom|32767,1,1,
{
set @step, 6;
if ($@illia_progress < @step) goto L_ShouldNotBeHere;
if ($@illia_level_6_progress == 2) goto L_Warp;
message strcharinfo(0), "The strong magic inside this room prevents you from going further.";
end;
L_Warp:
warp "052-2.gat", 73, 48;
end;
L_ShouldNotBeHere:
percentheal -100, 0;
end;
}
|