summaryrefslogtreecommitdiff
path: root/npc/023-3/logic.txt
blob: d9320848b84b12d7ce8e4580ccbd27d3231fce40 (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
// TMW2 scripts.
// Author:
//    Jesusalva
// Description:
//    023-3 Abandoned Ice Caves Configuration File. Variables: $@LOGIC_0233BOSS

023-3	mapflag	zone	MMO

023-3,63,220,0	script	#Exit0233	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    .@q=getq(General_Narrator);
    .@q2=getq2(General_Narrator);
    // Cheater Detected
    if (.@q < 15) { 
        warp "Save", 0, 0;
        percentheal -100, -100;
        return false;
    }

	mesc l("Return to Frostia's Castle?");
	if (askyesno() == ASK_YES) {
		.@mapn$="024-16";
	    warp .@mapn$, 30, 26;
	}
	closeclientdialog;
	close;
}

023-3,48,22,0	script	#Finish0233	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    .@q=getq(General_Narrator);
    .@q2=getq2(General_Narrator);
    // Cheater Detected
    if (.@q < 13) { 
        warp "Save", 0, 0;
        percentheal -100, -100;
        return false;
    }

	.@mapn$="001-7";
    warp .@mapn$, 91, 90;
    end;
}

001-7,91,89,0	script	#Init0233	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    .@q=getq(General_Narrator);
    .@q2=getq2(General_Narrator);
    // Cheater Detected
    if (.@q < 13) { 
        warp "Save", 0, 0;
        percentheal -100, -100;
        return false;
    }
    if (.@q == 15) {
        dispbottom lg("I'm not a coward! I must press forward!");
        end;
    }
	.@mapn$="023-3";
    warp .@mapn$, 48, 23;
    end;
}

// A simple random treasure chest - to be sure players were introduced to this
// awesome system. Same rules as any treasure box still applies.
023-3,94,212,0	script	#chest_02330	NPC_CHEST,{

    TreasureBox();
    specialeffect(.dir == 0 ? 24 : 25, AREA, getnpcid()); // closed ? opening : closing
    close;

OnInit:
    .distance = 2;
    end;
}


// Miniboss fight must be enabled on right npc. No passing before that.
023-3,120,103,0	script	#MiniBossTrap0233	NPC_HIDDEN,0,2,{
    end;

OnTouch:
    .@q=getq(FrostiaQuest_Homunculus);
    if (!.@q) {
        dispbottom l("A powerful magic barrier repels you!");
        getmapxy(.@m$, .@x, .@y, 0);
        slide .@x-2, .@y;
        sit();
    }
    end;
}


// The scout which went ahead of you (+ miniboss mechanics)
023-3,86,88,0	script	Elite Scout#MB0233	NPC_DARKSABER,{
    if ($@LOGIC_0233BOSS) {
        npctalkonce l("FIGHT!");
        end;
    }
    if (getq(FrostiaQuest_Homunculus) >= 1) {
        npctalkonce l("I'm not going any closer to that cursed place!");
        end;
    }
    mesn;
    mesq l("Congratulations in making this far, @@.", strcharinfo(0));
    next;
    select
        l("Thanks, and bye."),
        l("What should I do now?");
    if (@menu == 1)
        close;
    mes "";
    mesn;
    mesq l("So, there is a magical barrier to the right, which is in place exactly to protect us.");
    next;
    mesn;
    mesq l("Past this checkpoint, is the village where the Monster King was born.");
    next;
    mesn;
    mesq l("If you want to pass through it, you'll need to defeat the Guardian which made the seal. You can bring friends for healing and support.");
    next;
    mesn;
    mesq l("Once the fight begins, the barrier at your left will lock. It won't open until the fight is over.");
    next;
    mesn;
    mesq l("Are you ready?");
    mesc l("WARNING: DO NOT PROCEED UNLESS YOU'RE READY."), 1;
    if (askyesno() == ASK_YES && !$@LOGIC_0233BOSS) {
        $@LOGIC_0233BOSS=getcharid(3); // It could be 1.
        $@LOGIC_0233BOXX=monster("023-3", any(85,94,103,113), any(91,96,102,111), "Guardian", Yeti, 1, .name$+"::OnYetiDefeat");
        initnpctimer;
    }
    closeclientdialog;
    end;
// Check if fight is still going on
OnTimer10000:
    if (!attachrid($@LOGIC_0233BOSS)) {
        killmonster("023-3", .name$+"::OnYetiDefeat");
        $@LOGIC_0233BOSS=0;
        end;
    }
    // You gave up, finish it now and not later
    if (getmap() != "023-3") {
        killmonster("023-3", .name$+"::OnYetiDefeat");
        $@LOGIC_0233BOSS=0;
        end;
    }
    // What if the Yeti left the chamber? O.o
    // It's not like there was mob collision to prevent this from happening
    // If that's the case, bring the Yeti to player position and order attack :>
    getmapxy(.@m$, .@x, .@y, UNITTYPE_MOB, $@LOGIC_0233BOXX);
    getmapxy(.@mx$, .@xx, .@yx, 0);
    if (!(is_between(79, 120, .@x) && is_between(75, 125, .@y))) {
        unitwarp($@LOGIC_0233BOXX, .@mx$, .@xx, .@yx);
        unitattack($@LOGIC_0233BOXX, $@LOGIC_0233BOSS);
        unittalk($@LOGIC_0233BOXX, "I did not forgot you, @@! %%e", strcharinfo(0));
        end;
    }
    initnpctimer;
    end;
// Yeti Defeated
OnYetiDefeat:
    stopnpctimer;
    .@rid=$@LOGIC_0233BOSS;
    $@LOGIC_0233BOSS=0;
    // In past, only MVP would count. Now, the requester count.
    if (playerattached())
        detachrid();
    // Player decided to leave the game, annuled
    if (!attachrid(.@rid))
        end;
    // Player decided to leave for a walk, annuled
    if (!isin("023-3", 79, 75, 120, 125))
        end;

    // We don't need compareandsetq because it's now the requester
    message(.@rid, l("You've slayed the Yeti."));
    npctalk l("Good luck in your journey, @@.", rid2name(.@rid));
    setq FrostiaQuest_Homunculus, 1;

    end;
OnInit:
    .distance = 5;
    end;
}


// Cannot flee from Miniboss Fight
023-3,80,84,0	script	#MiniBossTrapB0233	NPC_HIDDEN,5,0,{
    end;

OnTouch:
    .@q=getq(FrostiaQuest_Homunculus);
    .@q2=getq(FrostiaQuest_Homunculus);
    if ($@LOGIC_0233BOSS) {
        dispbottom l("A powerful magic barrier repels you!");
        slide 81, 86;
        sit();
    }
    end;
}

// A not-so-simple treasure chest from Sagratha's Dungeon
023-3,0,0,0	script	#0233ChestCtrl	NPC_HIDDEN,{
    end;

OnDelay:
    initnpctimer;
    end;

OnTimer180000:
    stopnpctimer;
OnInit:
    setarray .@x, 189, 191, 193, 186;
    setarray .@y,  44,  42,  43,  45;
    .@r=rand2(getarraysize(.@x));
    monster "023-3", .@x[.@r], .@y[.@r], "Treasure Chest", any(BronzeChest,BronzeMimic,SilverChest,SilverMimic,GoldenChest,GoldenMimic), 1, "#0233ChestCtrl::OnDelay";
    end;
}

// TODO: Spike traps and etc. at the corritor
// TODO: Rolling Stone Trap