summaryrefslogtreecommitdiff
path: root/npc/018-6-1/main.txt
blob: 3f8f1ba2a2381bdb8307f97b7ebba92ad7aae03f (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
// TMW2 Scripts
// Author:
//    Jesusalva
// Description:
//    Controls Elenium Mines, specially the instances

// Main Controller for Instanced maps
018-6-1,0,0,0	script	#01861_InstCtrl	NPC_HIDDEN,{
    end;

// Map, x, y, width, height, mob, amount
function AreaMonsterB {
    .@m$=getarg(0);
    .@x1=getarg(1);
    .@x2=.@x1+getarg(3);
    .@y1=getarg(2);
    .@y2=.@y1+getarg(4);
    .@mi=getarg(5);
    .@am=getarg(6);
    areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mi), .@mi, .@am, instance_npcname(.name$)+"::OnKill"+.@mi);
    return;
}

// (var, value)
function SetIfVoid {
    if (!getarg(0))
        return getarg(1);
    return 0;
}

// Bifs won't respawn
OnKill1226:
OnKill1227:
OnKill1228:
    end;

// Others: Wait 30 seconds and respawn
OnKill1178:
    .@mi=SetIfVoid(.@mi, 1178);
OnKill1051:
    .@mi=SetIfVoid(.@mi, 1051);
OnKill1074:
    .@mi=SetIfVoid(.@mi, 1074);
OnKill1123:
    .@mi=SetIfVoid(.@mi, 1123);
OnKill1176:
    .@mi=SetIfVoid(.@mi, 1176);
OnKill1026:
    .@mi=SetIfVoid(.@mi, 1026);

    // Common utils
    getmapxy(.@m$, .@x, .@y, 0);
    sleep(30000);
    AreaMonsterB(.@m$, .@x-2, .@y-2, 4, 4, .@mi, 1);
    end;

OnInstanceInit:
    // Generate map ID
    getmapxy(.@m$, .@x, .@y, UNITTYPE_NPC);

    // Bif monsters
    AreaMonsterB(.@m$,  40,  49, 7, 8, BigEleniumBif, 5);
    AreaMonsterB(.@m$,  95,  51, 7, 8, BigEleniumBif, 5);
    AreaMonsterB(.@m$, 145,  83, 6, 5, EleniumBif, 5);
    AreaMonsterB(.@m$,  62,  86, 6, 5, EleniumBif, 5);
    AreaMonsterB(.@m$,  65, 130, 6, 5, EleniumBif, 5);
    AreaMonsterB(.@m$, 125, 158, 6, 5, SmallEleniumBif, 4);
    AreaMonsterB(.@m$, 129, 183, 6, 5, SmallEleniumBif, 4);
    AreaMonsterB(.@m$,  34, 181, 5, 5, SmallEleniumBif, 4);

    // Common Monsters
    AreaMonsterB(.@m$,  80, 172, 54, 25, BlackSlime, 16);
    AreaMonsterB(.@m$,  89, 167, 54, 25, DarkLizard, 8);
    AreaMonsterB(.@m$,  96, 103, 56, 29, BlackScorpion, 17);
    AreaMonsterB(.@m$, 101, 105, 54, 25, MountainSnake, 9);
    AreaMonsterB(.@m$,  70,  45, 44, 25, WickedMushroom, 14);
    AreaMonsterB(.@m$,  68,  45, 31, 21, Archant, 7);
    end;

}
/////////////////////////////
018-6-1,83,26,0	script	#ToForgottenChamber	NPC_SUMMONING_CIRC,0,0,{
    dispbottom l("It looks dangerous.");
    end;

OnTouch:
    .@q=getq(LoFQuest_Barbara);
    .@q2=getq2(LoFQuest_Barbara);
    .@q3=getq3(LoFQuest_Barbara);
    // Skipped cutscenes, show you the EXIT
    if (.@q == 1 && .@q3 != 2)
        cwarp "017-1", 32, 45;

    if (.@q >= 1) {
        warp BarbaraInstCheck(0), 90, 91;
        // Complete the first arc if possible
        if (.@q == 1) {
            setq1 LoFQuest_Barbara, 2;
            setq3 LoFQuest_Barbara, 0;
        }
        // Update M0 NPCs based on quest state
        if (.@q > 2)
            enablenpc instance_npcname("#ToForgottenShrine", .@q2);
        if (.@q == 2) {
            if (.@q3 == 5)
                enablenpc instance_npcname("#ToForgottenShrine", .@q2);
            if (.@q3 == 3)
                enablenpc instance_npcname("#ToSouthHall", .@q2);
            // Note: state 64 and 128 are temporary and must be removed
            if (.@q3 & 64)
                setq3 LoFQuest_Barbara, .@q3^64;
            // Safety update
            .@q3=getq3(LoFQuest_Barbara);
            if (.@q3 & 128)
                setq3 LoFQuest_Barbara, .@q3^128;

        }

    } else {
        Exception("ERROR, YOU SHOULD NOT BEEN SEEING THIS. 018-6-1.TFC");
    }
    end;

OnInit:
    disablenpc .name$;
    end;

}

///////////////////////////// Minievents
018-6-1,128,131,0	script	Wounded Soldier#01861	NPC_GUARD_DEAD,{
    //npctalk3 l("Please find her and don't worry with me! And be careful!");
    npctalk3 l("*scream in pain*");
    close;

OnMain:
    mesn l("Wounded Soldier");
    mesq l("Hey, you! Are you here on Kenton's orders?!");
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("My name is Benjamin, and I was in charge of an incursion here to capture Barbara.");
    next;
    mesn l("Benjamin, Wounded Soldier");
    mesq l("My unit, however, was attacked!");
    mesc l("You help Benjamin in getting up.");
    mesq l("I now entrust this quest in your hands!");
    mesc l("With a wave, Benjamin returns to report Kenton about the outcome.");
    setq3 LoFQuest_Barbara, 1;
    disablenpc instance_npcname(.name$); // NPC will now go to rest
    close;

OnInit:
    disablenpc .name$;
    end;
OnInstanceInit:
    disablenpc instance_npcname(.name$);
    end;
}

// Event trigger
018-6-1,121,132,0	script	Wounded Soldier#01861	NPC_WOUNDEDSOLDIER, 0, 10,{
OnTouch:
    .@q=getq(LoFQuest_Barbara);
    .@q2=getq2(LoFQuest_Barbara);
    .@q3=getq3(LoFQuest_Barbara);
    if (.@q == 1 && .@q3 == 0) {
        enablenpc instance_npcname("Wounded Soldier#01861", .@q2);
        addtimer 500, instance_npcname("Wounded Soldier#01861", .@q2)+"::OnMain";
    }
    end;
}