summaryrefslogtreecommitdiff
path: root/npc/023-3-1/logic.txt
blob: 205598828b03b8c262d64105dedf78726e5e6460 (plain) (blame)
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
// TMW2 scripts.
// Author:
//    Jesusalva
// Description:
//    023-3-1 The First Monster King's Throne Room Configuration File

023-3-1	mapflag	zone	MMO

023-3-1,45,27,0	script	#Finish02331	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    .@m$=getmap();
    .@n=getq(General_Narrator);
    .@q=getq(FrostiaQuest_Homunculus);
    // Cheater Detected
    if (.@n < 15) {
        warp "Save", 0, 0;
        die();
        end;
    }
    if (.@q < 3) {
        dispbottom l("The magic power outflowing in the room prevents you from leaving.");
        end;
    }
    if (mobcount(.@m$, "#Core02331::OnMobDie")) {
        dispbottom l("These assassins will catch me if I do that now!");
        end;
    }

	.@mapn$="023-3-2";
    warp .@mapn$, any(39,40), 58;
    end;
}

023-3-1,45,80,0	script	#Exit02331	NPC_HIDDEN,1,0,{
    end;
OnTouch:
    .@n=getq(General_Narrator);
    .@q=getq3(FrostiaQuest_Homunculus);
    // Cheater Detected
    if (.@n < 15) {
        warp "Save", 0, 0;
        die();
        end;
    }
    if (.@n == 15) {
        dispbottom lg("I'm not a coward! I must press forward!");
        end;
    }
	.@mapn$="001-7";
    warp .@mapn$, 59, 45;
    end;
}
// To the traps!

023-3-1,45,63,0	script	#Ambush02331	NPC_HIDDEN,10,0,{
OnTouch:
    .@q=getq(FrostiaQuest_Homunculus);
    if (.@q < 2) {
        dispbottom l("Error, cheater detected");
        die();
        end;
    }
    .@q=getq3(FrostiaQuest_Homunculus);
    if (!.@q) {
        .@m$=getmap();
        .@mobID1=monster(.@m$, 43, 55, l("Assassin"), HoodedNinja, 1, "#Core02331::OnMobDie");
        .@mobID2=monster(.@m$, 48, 55, l("Assassin"), HoodedNinja, 1, "#Core02331::OnMobDie");
        monster(.@m$, 43, 60, l("Assassin"), Assassin, 1, "#Core02331::OnMobDie");
        monster(.@m$, 43, 65, l("Assassin"), Assassin, 1, "#Core02331::OnMobDie");
        monster(.@m$, 48, 60, l("Assassin"), Assassin, 1, "#Core02331::OnMobDie");
        monster(.@m$, 48, 65, l("Assassin"), Assassin, 1, "#Core02331::OnMobDie");

        if (any(true,false))
            unittalk(.@mobID1, l("Kill 'em!"));
        else
            unittalk(.@mobID2, l("Kill 'em!"));

        setq3 FrostiaQuest_Homunculus, 1;
    }
    end;
}

// Main event core
023-3-1,45,52,0	script	#Core02331	NPC_HIDDEN,10,0,{
OnTouch:
    if (instance_id() < 0)
        end;
    .@q=getq(FrostiaQuest_Homunculus);
    if (.@q < 2) {
        dispbottom l("Error, cheater detected");
        die();
        end;
    }
    .@n$=instance_npcname(.name$);
    .@q=getq3(FrostiaQuest_Homunculus);
    if (.@q == 1) {
        // Begin the event core
        setq3 FrostiaQuest_Homunculus, 2;
        addtimer(1100, .@n$+"::OnEvent01");
		attachnpctimer();
        initnpctimer();
    }
    end;
OnEvent01:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    warp .@m$, 45, 42;
    @ISBAMUTH=monster(.@m$, 45, 34, l("Isbamuth"), Isbamuth, 1, .name$+"::OnIsbamuthDefeat");
    .@g1=monster(.@m$, 42, 37, l("Assassin"), HoodedNinja, 1, .name$+"::OnMobDie");
    .@g2=monster(.@m$, 48, 37, l("Assassin"), HoodedNinja, 1, .name$+"::OnMobDie");
    .@g3=monster(.@m$, 39, 40, l("Assassin"), Assassin, 1, .name$+"::OnMobDie");
    .@g4=monster(.@m$, 51, 40, l("Assassin"), Assassin, 1, .name$+"::OnMobDie");

    // Block everyone for cutscene (includes invencibility boost)
    setpcblock(PCBLOCK_HARD, true);
    sleep2(10);
    sc_start(SC_STUN, 7500, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, @ISBAMUTH);
    sc_start(SC_STUN, 7500, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .@g1);
    sc_start(SC_STUN, 7500, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .@g2);
    sc_start(SC_STUN, 7500, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .@g3);
    sc_start(SC_STUN, 7500, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, .@g4);

    unittalk(@ISBAMUTH, l("Seems like the rat have come after the cheese."));
    addtimer(1500, .@n$+"::OnE02");
    end;

OnE02:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unittalk(@ISBAMUTH, l("HAHAHAHA! How foolish of you, didn't even bother trying to sneak in!"));

    addtimer(1500, .@n$+"::OnE03");
    end;

OnE03:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unittalk(@ISBAMUTH, l("Remember my name: I am Isbamuth, and I've took the Throne which rightfully belongs to me."));

    addtimer(1500, .@n$+"::OnE04");
    end;

OnE04:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unittalk(@ISBAMUTH, l("This throne is not from the Monster King... IT BELONGS ONLY TO ME!"));

    addtimer(1500, .@n$+"::OnE05");
    end;

OnE05:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unittalk(@ISBAMUTH, l("Now, as you gave yourself the trouble of coming here..."));

    addtimer(1500, .@n$+"::OnE06");
    end;

OnE06:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    setpcblock(PCBLOCK_HARD, false);
    unittalk(@ISBAMUTH, l("LET'S DANCE!"));
    mapannounce(.@m$, "##2"+l("Victory Conditions: Survive!"), 0);
    mapannounce(.@m$, "##1"+l("Defeat Conditions: Your death!"), 0);

    addtimer(15000, .@n$+"::OnW01");
    addtimer(60000, .@n$+"::OnW02");
    addtimer(180000, .@n$+"::OnE07");
    end;

OnE07:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    @SCOUT=monster(.@m$, 43, 29, l("Assassin"), HoodedNinja, 1, .name$+"::OnMobDie");
    sc_start(SC_STUN, 14000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK, @SCOUT);

    unitemote(@SCOUT, E_KITTY);
    unitstop(@ISBAMUTH);
    dispbottom l("Something seems to be happening close to the Throne.");

    deltimer(.@n$+"::OnW01");
    deltimer(.@n$+"::OnW02");
    addtimer(2000, .@n$+"::OnE08");
    end;

OnE08:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unittalk(@ISBAMUTH, l("What's it, scout."));
    unitwalk(@ISBAMUTH, 45, 34);

    addtimer(2500, .@n$+"::OnE09");
    end;

OnE09:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unitemote(@SCOUT, E_THUMBUP);
    unittalk(@ISBAMUTH, l("So, it is ready?"));

    addtimer(2000, .@n$+"::OnE10");
    end;

OnE10:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unittalk(@ISBAMUTH, l("I hate to leave you now, @@, but I have more important things to do.", strcharinfo(0)));

    addtimer(1500, .@n$+"::OnE11");
    end;

OnE11:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unittalk(@ISBAMUTH, l("Enjoy this world while it lasts. Heh. It's time to... detonate."));

    addtimer(1500, .@n$+"::OnE12");
    end;

OnE12:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    // A warp to non-instanced version to prevent death sprite from showing up.
    unitwarp(@ISBAMUTH, "023-3-1", 45, 45);
    unitwarp(@SCOUT, "023-3-1", 45, 45);
    .@isb=@ISBAMUTH;
    @ISBAMUTH=0;
    unitkill(.@isb);
    unitkill(@SCOUT);
    setq1 FrostiaQuest_Homunculus, 3;
    mapannounce(.@m$, "##2"+l("Victory Conditions: Defeat all enemies!"), 0);
    mapannounce(.@m$, "##1"+l("Defeat Conditions: Your death!"), 0);
    end;

// War events
OnW01:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unittalk(@ISBAMUTH, l("Be cursed, you fool!"));
    sc_start(SC_CURSE, 3000, 1, 10000, SCFLAG_NOAVOID|SCFLAG_FIXEDTICK);

    // Maybe you're stupidly ignoring what we just said?
    if (TUTORIAL)
        dispbottom col(l("REMINDER: You do not need to kill anything, you need to ##BSURVIVE##b!"), 3);

    addtimer(45000, .@n$+"::OnW01");
    end;

OnW02:
    .@m$=getmap();
    .@n$=instance_npcname(.name$);

    unittalk(@ISBAMUTH, l("Come to my aid! Vanish this fool!"));
    monster(.@m$, 42, 37, l("Assassin"), any(Assassin,Bandit,RobinBandit), 1, .name$+"::OnMobDie");
    monster(.@m$, 48, 37, l("Assassin"), HoodedNinja, 1, .name$+"::OnMobDie");
    monster(.@m$, 39, 40, l("Assassin"), any(Assassin,Bandit,RobinBandit), 1, .name$+"::OnMobDie");
    monster(.@m$, 51, 40, l("Assassin"), Assassin, 1, .name$+"::OnMobDie");

    addtimer(60000, .@n$+"::OnW02");
    end;

// Secret events. Do not handle Isbamuth death as it should be impossible...
OnIsbamuthDefeat:
    if (!@ISBAMUTH)
        end;
    Exception(l("Why do you bully me! - This is a bug: 02331.LOGIC.OID"), RB_DISPBOTTOM|RB_DEBUGMES);
    deltimer(.@n$+"::OnW01");
    deltimer(.@n$+"::OnW02");
    getexp 0, 1000;
    @ISBAMUTH=monster(.@m$, 45, 34, l("Isbamuth"), Isbamuth, 1, .name$+"::OnIsbamuthDefeat");
    end;

// For mobcount() only
OnMobDie:
    end;

OnTimer1000:
    .@m$=instance_mapname("023-3-1");
    if (getmapusers(.@m$))
        initnpctimer;
OnTimerQuit:
    // Cleanup - you fail.
    killmonsterall(.@m$);
	stopnpctimer();
	detachnpctimer();
    end;
}