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
|
// TMW2 Scripts
// Author:
// Jesusalva
// Description:
// Controls Forgotten Shrine
018-6-3 mapflag nowarpto
// 01863_RelevanceCheck ( Room ID )
function script 01863_RelevanceCheck {
.@id=getarg(0);
.@q=getq(LoFQuest_Barbara);
.@q2=getq2(LoFQuest_Barbara);
.@q3=getq3(LoFQuest_Barbara);
if (.@q < 3)
Exception("INVALID QUEST STATE, REVCHECK", RB_DEFAULT|RB_ISFATAL);
if (.@q != 3)
return false;
if (.@q3 & .@id)
return false;
return true;
}
// TODO: filler
function script 01863_DisableAllWarps {
return;
}
// Main Controller for Instanced maps
018-6-3,0,0,0 script #01863_InstCtrl NPC_HIDDEN,{
end;
// Map, x1, y1, x2, y2, mob, amount
function AreaMonsterB {
.@m$=getarg(0);
.@x1=getarg(1);
.@x2=getarg(3);
.@y1=getarg(2);
.@y2=getarg(4);
.@mi=getarg(5);
.@am=getarg(6);
if (!.@am)
return;
areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mi), .@mi, .@am);
//, instance_npcname(.name$)+"::OnKill"+.@mi);
return;
}
// Map, x1, y1, x2, y2, mob, bossID
function AreaMonsterBoss {
.@m$=getarg(0);
.@x1=getarg(1);
.@x2=getarg(3);
.@y1=getarg(2);
.@y2=getarg(4);
.@mi=getarg(5);
.@id=getarg(6);
areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mi), .@mi, 1, instance_npcname(.name$)+"::OnKill"+.@id);
return;
}
// BossRoom ( RoomID, x1, y1, x2, y2, adjustment )
// Adjustment is for bigger rooms. Defaults to false.
function BossRoom {
.@id=getarg(0);
.@x1=getarg(1);
.@y1=getarg(2);
.@x2=getarg(3);
.@y2=getarg(4);
.@ad=getarg(5, false);
// True: Must spawn boss, False: Allow to use warps
if (01863_RelevanceCheck(.@id)) {
mapannounce getmap(), l("BOSS FIGHT!"), bc_map|bc_pc;
// Spawn a boss. Aggressive chance: 33%
AreaMonsterBoss(getmap(), .@x1, .@y1, .@x2, .@y2, any(HolyPixie, NulityPixie, VanityPixie, TerraniteProtector, GoboBear, Centaur), .@id);
// BIG ROOM: 6~12 support units
// SMALL ROOM: 5~10 support units
AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2, BlackSlime, rand2(2,4)+.@ad);
AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2, DarkLizard, rand2(1,2)+.@ad);
AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2, BlackScorpion, rand2(1,2));
AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2, Archant, rand2(1,2)-.@ad);
// Only spawn the fast Hooded Ninja on big rooms
if (.@ad) {
AreaMonsterB(getmap(), .@x1, .@y1, .@x2, .@y2, HoodedNinja, any(0,0,1));
}
return false;
}
return true;
}
// W - West, C - Center, E - East, N - North, S - South
OnRoomNorth:
L_Room1:
if (BossRoom(1, 62, 41, 121, 58, true)) {
debugmes "Here we need to enable room warps";
//enablenpc instance_npcname("#01863_fromNorthtoNW");
//enablenpc instance_npcname("#01863_fromNorthtoNE");
}
end;
OnRoomNW:
L_Room2:
if (BossRoom(2, 48, 65, 68, 85)) {
debugmes "Here we need to enable room warps";
//enablenpc instance_npcname("#01863_fromNWtoNorth");
//enablenpc instance_npcname("#01863_fromNWtoNC");
}
end;
OnRoomNC:
L_Room4:
BossRoom(4, 77, 65, 103, 76);
end;
OnRoomNE:
L_Room8:
BossRoom(8, 111, 65, 131, 85);
end;
OnRoomSW:
L_Room16:
BossRoom(16, 48, 95, 68, 115);
end;
OnRoomSC:
L_Room32:
BossRoom(32, 77, 104, 103, 115);
end;
OnRoomSE:
L_Room64:
BossRoom(64, 111, 95, 131, 115);
end;
OnRoomSouth:
L_Room128:
BossRoom(128, 62, 122, 121, 139, true);
end;
// Kill boss will use setq3 and also erase any remaining monster
// Then it'll cast again the room event to enable the warps.
OnKill1:
.@q3=getq3(LoFQuest_Barbara);
setq3 LoFQuest_Barbara, .@q3|1;
killmonsterall(getmap());
goto L_Room1;
OnKill2:
.@q3=getq3(LoFQuest_Barbara);
setq3 LoFQuest_Barbara, .@q3|2;
killmonsterall(getmap());
goto L_Room2;
OnKill4:
.@q3=getq3(LoFQuest_Barbara);
setq3 LoFQuest_Barbara, .@q3|4;
killmonsterall(getmap());
goto L_Room4;
OnKill8:
.@q3=getq3(LoFQuest_Barbara);
setq3 LoFQuest_Barbara, .@q3|8;
killmonsterall(getmap());
goto L_Room8;
OnKill16:
.@q3=getq3(LoFQuest_Barbara);
setq3 LoFQuest_Barbara, .@q3|16;
killmonsterall(getmap());
goto L_Room16;
OnKill32:
.@q3=getq3(LoFQuest_Barbara);
setq3 LoFQuest_Barbara, .@q3|32;
killmonsterall(getmap());
goto L_Room32;
OnKill64:
.@q3=getq3(LoFQuest_Barbara);
setq3 LoFQuest_Barbara, .@q3|64;
killmonsterall(getmap());
goto L_Room64;
OnKill128:
.@q3=getq3(LoFQuest_Barbara);
setq3 LoFQuest_Barbara, .@q3|128;
killmonsterall(getmap());
goto L_Room128;
OnKill256:
.@q3=getq3(LoFQuest_Barbara);
setq3 LoFQuest_Barbara, .@q3|256;
killmonsterall(getmap());
end;
}
////////// Warp System below this file
// Xanthem: This is a NPC. I need you to duplicate it several times.
018-6-3,0,0,0 script #01863_fromOuttoNorth NPC_SUMMONING_CIRC,0,0,{
dispbottom l("I should be prepared before walking on this.");
end;
OnTouch:
.@q=getq(LoFQuest_Barbara);
.@q2=getq2(LoFQuest_Barbara);
.@q3=getq3(LoFQuest_Barbara);
if (.@q < 3)
Exception("ERROR, INVALID WARP", RB_DEFAULT|RB_ISFATAL);
// Disable any other active portal
01863_DisableAllWarps();
// Warp you to next room coordinates
slide 0, 0;
// Execute the next room code and finish
doevent instance_npcname("#01863_InstCtrl", .@q2)+"::OnBossNC";
end;
// NPC must remain hidden.
OnInit:
disablenpc .name$;
end;
OnInstanceInit:
disablenpc instance_npcname(.name$);
end;
}
|