root/npc/guild2/schg_cas02.txt @ 10

Revision 1, 87.3 kB (checked in by jinshiro, 17 years ago)
Line 
1//===== eAthena Script =======================================
2//= War of Emperium Second Edition
3//===== By: ==================================================
4//= L0ne_W0lf
5//===== Current Version: =====================================
6//= 1.7
7//===== Compatible With: =====================================
8//= eAthena SVN
9//===== Description: =========================================
10//= WoE SE Schwaltzvalt Castle 2
11//===== Additional Comments: =================================
12//= 1.0 First Version [L0ne_W0lf]
13//= 1.1 Fixed setcell range of first barricade. [L0ne_W0lf]
14//= 1.2 Fixed first Barricade being desotryable. [L0ne_W0lf]
15//= 1.3 Swaped an end for a close in eco investing. [L0ne_W0lf]
16//= 1.4 Fixed 3rd Control Device wasting supplies. [L0ne_W0lf]
17//= 1.5 Fixed double message in defense investing. [L0ne_W0lf]
18//=     Corrected a minor typo in the guild steward.
19//= 1.6 Fixed a guardian spawning NPCs. [L0ne_W0lf]
20//= 1.7 Fixed investment period not resetting. [L0ne_W0lf]
21//=     Made it so treasure won't spawn if castle is empty.
22//=     Treasure will now be killed before spawning.
23//============================================================
24
25schg_cas02,1,1,0        script  Manager#sch02_02        111,{
26        end;
27
28OnInterIfInitOnce:
29        GetCastleData "schg_cas02",0,"::OnRecvCastleSc02";
30        end;
31
32OnRecvCastlesc02:
33        RequestGuildInfo GetCastleData("schg_cas02",1);
34        if (GetCastleData("schg_cas02",1) == 0) {
35                donpcevent "Manager#sch02_02::Onstart";
36        }
37        end;
38
39OnAgitStart:
40        if (agitcheck()) {
41                MapRespawnGuildID "schg_cas02",GetCastleData("schg_cas02",1),2;
42                GvgOn "schg_cas02";
43                donpcevent "Manager#sch02_02::Onstart";
44        }
45        else {
46                donpcevent "#sch02_RL00::OnDisable";
47                donpcevent "#sch02_RL01::OnDisable";
48                donpcevent "#sch02_RL02::OnDisable";
49                donpcevent "#sch02_RL03::OnDisable";
50        }
51        end;
52
53OnAgitEnd:
54        GvgOff "schg_cas02";
55        if (GetCastleData("schg_cas02",1)) {
56                KillMonster "schg_cas02","Steward#sch02::OnStartArena";
57                donpcevent "Manager#sch02_02::Onreset";
58        }
59        end;
60
61Onstart:
62        // 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians
63        // Settings for all but Summon Guardians
64        // 0 = Okay; 1 = Destroyed; 2 = Repairing
65        // Summon Guardians
66        // 0 = Do not Summon; 1 = Summon
67        if (GetCastleData("schg_cas02",1)) {
68                setarray $agit_sc02[0],0,0,0,0,0,0;
69                donpcevent "#sch02_df01::OnEnable";
70                donpcevent "#sch02_df02::OnEnable";
71                donpcevent "#sch02_RL00::OnEnable";
72                donpcevent "#sch02_RL01::OnEnable";
73                donpcevent "#sch02_RL02::OnEnable";
74                donpcevent "#sch02_RL03::OnEnable";
75        }
76        monster "schg_cas02",162,193,"Emperium",1288,1,"Steward#sch02::OnStartArena";
77        end;
78
79Onreset:
80        donpcevent "#sch02_df01::OnDisable";
81        donpcevent "#sch02_df02::OnDisable";
82        donpcevent "#sch02_gard01::Onreset";
83        donpcevent "#sch02_gard02::Onreset";
84        donpcevent "#sch02_RL00::OnDisable";
85        donpcevent "#sch02_RL01::OnDisable";
86        donpcevent "#sch02_RL02::OnDisable";
87        donpcevent "#sch02_RL03::OnDisable";
88        donpcevent "1st Guardian Stone#sch02::OnDisable";
89        donpcevent "2nd Guardian Stone#sch02::OnDisable";
90        donpcevent "Control Device01#sch02::OnDisable";
91        donpcevent "Control Device02#sch02::OnDisable";
92        donpcevent "Control Device03#sch02::OnDisable";
93        if (agitcheck()) {
94                setarray $agit_sc02[0],0,0,1,1,1,0;
95        }
96        end;
97
98Onchange:
99        setarray $agit_sc02[0],2,2,1,1,2,0;
100        monster "schg_cas02",162,193,"Emperium",1288,1,"Steward#sch02::OnStartArena";
101        donpcevent "Control Device03#sch02::OnEnable";
102        donpcevent "1st Guardian Stone#sch02::OnEnable";
103        donpcevent "2nd Guardian Stone#sch02::OnEnable";
104        end;
105
106OnClock0001:
107        if (!GetCastleData("schg_cas02",1)) end;
108        killmonster "schg_cas02","Manager#sch02_02::OnMyTreasureDied";
109        set .@Treasure,GetCastleData("schg_cas02",2)/5+4;
110        if (.@Treasure) {
111                monster "schg_cas02",249,378,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
112                monster "schg_cas02",250,378,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
113                monster "schg_cas02",251,378,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
114                monster "schg_cas02",252,378,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
115                if (.@Treasure < 5) end;
116                monster "schg_cas02",253,378,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
117                if (.@Treasure < 6) end;
118                monster "schg_cas02",246,376,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
119                if (.@Treasure < 7) end;
120                monster "schg_cas02",247,376,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
121                if (.@Treasure < 8) end;
122                monster "schg_cas02",248,376,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
123                if (.@Treasure < 9) end;
124                monster "schg_cas02",249,376,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
125                if (.@Treasure < 10) end;
126                monster "schg_cas02",250,376,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
127                if (.@Treasure < 11) end;
128                monster "schg_cas02",250,374,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
129                if (.@Treasure < 12) end;
130                monster "schg_cas02",251,374,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
131                if (.@Treasure < 13) end;
132                monster "schg_cas02",252,374,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
133                if (.@Treasure < 14) end;
134                monster "schg_cas02",253,374,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
135                if (.@Treasure < 15) end;
136                monster "schg_cas02",246,372,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
137                if (.@Treasure < 16) end;
138                monster "schg_cas02",247,372,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
139                if (.@Treasure < 17) end;
140                monster "schg_cas02",248,372,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
141                if (.@Treasure < 18) end;
142                monster "schg_cas02",249,372,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
143                if (.@Treasure < 19) end;
144                monster "schg_cas02",250,372,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
145                if (.@Treasure < 20) end;
146                monster "schg_cas02",249,370,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
147                if (.@Treasure < 21) end;
148                monster "schg_cas02",250,370,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
149                if (.@Treasure < 22) end;
150                monster "schg_cas02",251,370,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
151                if (.@Treasure < 23) end;
152                monster "schg_cas02",252,270,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
153                if (.@Treasure < 24) end;
154                monster "schg_cas02",253,370,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
155        }
156        setcastledata "schg_cas02",4,0;
157        setcastledata "schg_cas02",5,0;
158        end;
159
160OnTreasureDied:
161        end;
162}
163
164schg_cas02,140,184,3    script  Endeef#sch02_01 868,{
165        set .@GID, GetCastleData("schg_cas02",1);
166        if (.@GID == 0) {
167                mes "[Endeef]";
168                mes "Great job. Now, all you";
169                mes "need to do is destroy this";
170                mes "Emperium to gain ownership";
171                mes "over this stronghold.";
172                close;
173        }
174        if (getcharid(2) == .@GID) {
175                if (strcharinfo(0) != getguildmaster(.@GID)) {
176                        mes "[Endeef]";
177                        mes "As guardian of this";
178                        mes "stronghold, I answer only";
179                        mes "to the master of the guild";
180                        mes "that controls this place.";
181                        close;
182                }
183                else {
184                        if (agitcheck() == 0) {
185                                mes "[Endeef]";
186                                mes "I am Endeef, guardian of";
187                                mes "this stronghold. For now,";
188                                mes "all is quiet in this place.";
189                                next;
190                                switch(select("Converse:Cancel")) {
191                                case 1:
192                                        mes "[Endeef]";
193                                        mes "Do you have any questions";
194                                        mes "about this stronghold?";
195                                        next;
196                                        switch(select("Guardian Stones:Fortress Gates:Link Flags:Battle Strategy:Cancel")) {
197                                        case 1:
198                                                mes "[Endeef]";
199                                                mes "There is one Emperium";
200                                                mes "and two Guardian Stones in";
201                                                mes "each fortress. These stones";
202                                                mes "are the first line of defense,";
203                                                mes "and must be destroyed before";
204                                                mes "enemies can even enter.";
205                                                next;
206                                                mes "[Endeef]";
207                                                mes "The stones are located in";
208                                                mes "^4D4DFFGate Houses^000000 which must be";
209                                                mes "protected to prevent enemies";
210                                                mes "from reaching the Emperium.";
211                                                mes "Guardian Stones can ^4D4DFFrecall";
212                                                mes "your Guardians^000000 for protection.";
213                                                next;
214                                                mes "[Endeef]";
215                                                mes "Fortresses with higher levels";
216                                                mes "of defense can summon more";
217                                                mes "Guardians: this is why it is";
218                                                mes "so important for guilds to";
219                                                mes "invest in Defense Growth.";
220                                                next;
221                                                mes "[Endeef]";
222                                                mes "Guardian Stones that have";
223                                                mes "been destroyed can be revived";
224                                                mes "after a certain time, but one of^FFFFFF ^000000 the guild members must give";
225                                                mes "me the order. I can also report^FFFFFF ^000000 the status of the Guardian Stones.";
226                                                close;
227                                        case 2:
228                                                mes "[Endeef]";
229                                                mes "^4D4DFFFortress Gates^000000 are the second ^FFFFFF ^000000 line of guild stronghold defense,";
230                                                mes "and are protected by extra barricades activated by the Guardian Stones.";
231                                                mes "These gates are located in three different parts of the fortress.";
232                                                next;
233                                                mes "[Endeef]";
234                                                mes "Barricades are protected by";
235                                                mes "Guardian Stones, and are";
236                                                mes "restored when the Guardian";
237                                                mes "Stones are retrieved. However,";
238                                                mes "it is not as easy to restore";
239                                                mes "destroyed Fortress Gates.";
240                                                next;
241                                                mes "[Endeef]";
242                                                mes "Fortress Gates can only be";
243                                                mes "restored when the ^4D4DFFguild";
244                                                mes "master of a stronghold";
245                                                mes "changes^000000, or if ^4D4DFFrestoration";
246                                                mes "is requested by the guild";
247                                                mes "master of the stronghold^000000.";
248                                                close;
249                                        case 3:
250                                                mes "[Endeef]";
251                                                mes "Strongholds have many";
252                                                mes "Link Flags that allow you";
253                                                mes "to access vital areas within";
254                                                mes "restrictions placed by the";
255                                                mes "Barricades. Usually, ^4D4DFFFlag 1";
256                                                mes "links to the Gate House^000000.";
257                                                next;
258                                                mes "[Endeef]";
259                                                mes "Many flags link directly to";
260                                                mes "the flag near the Emperium.";
261                                                mes "The final numbered flag is";
262                                                mes "linked to the Convenience";
263                                                mes "Facility of the stronghold's";
264                                                mes "owner. Keep this in mind.";
265                                                close;
266                                        case 4:
267                                                mes "[Endeef]";
268                                                mes "Strategy? It would be better";
269                                                mes "to develop your battle plan to";
270                                                mes "exploit your guild's advantages";
271                                                mes "and your enemies' weaknesses.";
272                                                mes "Use the Gate Houses and Barricades, and rebuild as quickly as you can!";
273                                                close;
274                                        case 5:
275                                                mes "[Endeef]";
276                                                mes "You have no questions";
277                                                mes "to ask of me? Well, I'm";
278                                                mes "here to serve your needs.";
279                                                close;
280                                        }
281                                case 2:
282                                        mes "[Endeef]";
283                                        mes "I'm always here, so";
284                                        mes "feel free to request my";
285                                        mes "assistance whenever";
286                                        mes "the need arises.";
287                                        close;
288                                }
289                        }
290                        else {
291                                mes "[Endeef]";
292                                mes "Greetings, "+strcharinfo(0)+".";
293                                mes "What are your orders?";
294                                next;
295                                switch(select("Increase Stronghold Defense:Situational Briefing:Cancel")) {
296                                case 1:
297                                        if ($agit_sc02[5] == 0) {
298                                                if (getgdskilllv(.@GID,10002) == 0) {
299                                                        mes "[Endeef]";
300                                                        mes "I'm sorry, but the Guardian";
301                                                        mes "Stones aren't powerful enough";
302                                                        mes "to summon Guardians yet. We";
303                                                        mes "need to accumulate more";
304                                                        mes "knowledge before they can";
305                                                        mes "summon any Guardians.";
306                                                        close;
307                                                }
308                                                else {
309                                                        mes "[Endeef]";
310                                                        mes "I shall endeavor to summon";
311                                                        mes "a Guardian through a Guardian";
312                                                        mes "Stone. However, keep in mind";
313                                                        mes "that this will not work if the";
314                                                        mes "Guardian Stone is destroyed.";
315                                                        setarray $agit_sc02[5],1;
316                                                        if ($agit_sc02[0] == 0) {
317                                                                donpcevent "#sch02_gard01::OnEnable";
318                                                        }
319                                                        if ($agit_sc02[1] == 0) {
320                                                                donpcevent "#sch02_gard02::OnEnable";
321                                                        }
322                                                        close;
323                                                }
324                                        }
325                                        else {
326                                                mes "[Endeef]";
327                                                mes "You've already commanded";
328                                                mes "me to summon a Guardian";
329                                                mes "to defend the stronghold.";
330                                                close;
331                                        }
332                                case 2:
333                                        mes "[Endeef]";
334                                        mes "Our defense status is...";
335                                        if ($agit_sc02[0] == 1) {
336                                                mes "1st Guardian Stone: ^FF0000Destroyed^000000";
337                                        }
338                                        else if ($agit_sc02[0] == 2) {
339                                                mes "1st Guardian Stone: ^008000Repairing^000000";
340                                        }
341                                        else {
342                                                mes "1st Guardian Stone: ^4D4DFFOperational^000000";
343                                        }
344                                        if ($agit_sc02[1] == 1) {
345                                                mes "2nd Guardian Stone: ^FF0000Destroyed^000000";
346                                        }
347                                        else if ($agit_sc02[1] == 2) {
348                                                mes "2nd Guardian Stone: ^008000Repairing^000000";
349                                        }
350                                        else {
351                                                mes "2nd Guardian Stone: ^4D4DFFOperational^000000";
352                                        }
353                                        if ($agit_sc02[2] == 1) {
354                                                mes "1st Fortress Gate: ^FF0000Destroyed^000000";
355                                        }
356                                        else if ($agit_sc02[2] == 2) {
357                                                mes "1st Fortress Gate: ^008000Repairing^000000";
358                                        }
359                                        else {
360                                                mes "1st Fortress Gate: ^4D4DFFOperational^000000";
361                                        }
362                                        if ($agit_sc02[3] == 1) {
363                                                mes "2nd Fortress Gate: ^FF0000Destroyed^000000";
364                                        }
365                                        else if ($agit_sc02[3] == 2) {
366                                                mes "2nd Fortress Gate: ^008000Repairing^000000";
367                                        }
368                                        else {
369                                                mes "2nd Fortress Gate: ^4D4DFFOperational^000000";
370                                        }
371                                        if ($agit_sc02[4] == 1) {
372                                                mes "3rd Fortress Gate: ^FF0000Destroyed^000000";
373                                        }
374                                        else if ($agit_sc02[4] == 2) {
375                                                mes "3rd Fortress Gate: ^008000Repairing^000000";
376                                        }
377                                        else {
378                                                mes "3rd Fortress Gate: ^4D4DFFOperational^000000";
379                                        }
380                                        close;
381                                case 3:
382                                        mes "[Endeef]";
383                                        mes "I'll be standing by,";
384                                        mes "awaiting your orders.";
385                                        close;
386                                }
387                        }
388                }
389        }
390        else {
391                mes "[Endeef]";
392                mes "Who are you? Scoundrel!";
393                mes "Leave this stronghold now!";
394                close;
395        }
396
397OnInit:
398        setarray $agit_sc02[0],0,0,0,0,0,0;
399        end;
400}
401
402schg_cas02,1,1,0        script  #sch02_gard01   -1,{
403OnEnable:
404        set .@defence,GetCastleData("schg_cas02",3);
405        guardian "schg_cas02",326,83,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //0;
406        if ((.@defence > 10) && (.@defence < 31)) {
407                set .MyMobCount,2;
408                guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
409        }
410        else if ((.@defence > 30) && (.@defence < 51)) {
411                set .MyMobCount,3;
412                guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
413                guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //2;
414        }
415        else if ((.@defence > 50) && (.@defence < 71)) {
416                set .MyMobCount,4;
417                guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
418                guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //2;
419                guardian "schg_cas02",296,82,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //3;
420        }
421        else if (.@defence > 70) {
422                set .MyMobCount,5;
423                guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
424                guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //2;
425                guardian "schg_cas02",296,82,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //3;
426                guardian "schg_cas02",285,40,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //4;
427        }
428        else {
429                set .MyMobCount,2;
430                guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
431        }
432        initnpctimer;
433        end;
434
435OnTimer300000:
436        set .MyMobCount,.MyMobCount+1;
437        guardian "schg_cas02",236,41,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //5;
438        mapannounce "schg_cas02","The 1st Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
439        end;
440
441OnTimer900000:
442        set .MyMobCount,.MyMobCount+1;
443        guardian "schg_cas02",285,40,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //6;
444        mapannounce "schg_cas02","The 2nd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
445        end;
446
447OnTimer1800000:
448        set .MyMobCount,.MyMobCount+1;
449        guardian "schg_cas02",296,82,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //7;
450        mapannounce "schg_cas02","The 3rd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
451        end;
452
453OnTimer2700000:
454        set .MyMobCount,.MyMobCount+1;
455        guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //8;
456        mapannounce "schg_cas02","The 4th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
457        end;
458
459OnTimer3600000:
460        set .MyMobCount,.MyMobCount+1;
461        guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //9;
462        mapannounce "schg_cas02","The 5th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
463        stopnpctimer;
464        end;
465
466OnGuardianDied:
467        set .MyMobCount,.MyMobCount-1;
468        if (.MyMobCount < 2) {
469                set .MyMobCount,.MyMobCount+1;
470                guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //10;
471        }
472        end;
473
474Onreset:
475        stopnpctimer;
476        killmonster "schg_cas02","#sch02_gard01::OnGuardianDied";
477        end;
478}
479
480schg_cas02,1,2,0        script  #sch02_gard02   -1,{
481OnEnable:
482        set .@defence,GetCastleData("schg_cas02",3);
483        guardian "schg_cas02",359,85,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //11;
484        if ((.@defence > 10) && (.@defence < 31)) {
485                set .MyMobCount,2;
486                guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
487        }
488        else if ((.@defence > 30) && (.@defence < 51)) {
489                set .MyMobCount,3;
490                guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
491                guardian "schg_cas02",337,154,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //13;
492        }
493        else if ((.@defence > 50) && (.@defence < 71)) {
494                set .MyMobCount,4;
495                guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
496                guardian "schg_cas02",337,154,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //13;
497                guardian "schg_cas02",317,183,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //14;
498        }
499        else if (.@defence > 70) {
500                set .MyMobCount,5;
501                guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
502                guardian "schg_cas02",337,154,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //13;
503                guardian "schg_cas02",317,183,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //14;
504                guardian "schg_cas02",307,222,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //15;
505        }
506        else {
507                set .MyMobCount,2;
508                guardian "schg_cas02",307,222,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
509        }
510        initnpctimer;
511        end;
512
513OnTimer600000:
514        set .MyMobCount,.MyMobCount+1;
515        guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //16;
516        end;
517
518OnTimer1200000:
519        set .MyMobCount,.MyMobCount+1;
520        guardian "schg_cas02",337,154,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //17;
521        end;
522
523OnTimer2100000:
524        set .MyMobCount,.MyMobCount+1;
525        guardian "schg_cas02",317,183,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //18;
526        end;
527
528OnTimer3000000:
529        set .MyMobCount,.MyMobCount+1;
530        guardian "schg_cas02",307,222,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //19;
531        end;
532
533OnTimer3900000:
534        set .MyMobCount,.MyMobCount+1;
535        guardian "schg_cas02",359,85,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //20;
536        stopnpctimer;
537        end;
538
539OnGuardianDied:
540        set .MyMobCount,.MyMobCount-1;
541        if (.MyMobCount < 2) {
542                set .MyMobCount,.MyMobCount+1;
543                guardian "schg_cas02",236,41,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //21;
544        }
545        end;
546
547Onreset:
548        stopnpctimer;
549        killmonster "schg_cas02","#sch02_gard02::OnGuardianDied";
550        end;
551}
552
553schg_cas02,1,3,0        script  #sch02_df01     -1,{
554OnEnable:
555        guardian "schg_cas02",231,58,"1st Guardian Stone",1907,"#sch02_df01::OnGuardianStoneDied"; //22;
556        end;
557
558OnDisable:
559        killmonster "schg_cas02","#sch02_df01::OnGuardianStoneDied";
560        setarray $agit_sc02[0],1; //Global Variable
561        stopnpctimer;
562        end;
563
564OnGuardianStoneDied:
565        // 1st Guardian Stone is Destroyed
566        setarray $agit_sc02[0],1;
567        if (($agit_sc02[0] == 1) || ($agit_sc02[0] == 2)) {
568                set .@destroyed,.@destroyed + 1;
569        }
570        if (($agit_sc02[1] == 1) || ($agit_sc02[1] == 2)) {
571                set .@destroyed,.@destroyed + 1;
572        }
573        if (.@destroyed == 2) {
574                mapannounce "schg_cas02","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
575                donpcevent "#sch02_RL00::OnDisable";
576                donpcevent "#sch02_gard01::Onreset";
577        }
578        else {
579                mapannounce "schg_cas02","The 1st Guardian Stone has been destroyed!",bc_map,"0x00ff00";
580                donpcevent "#sch02_gard01::Onreset";
581        }
582        initnpctimer;
583        end;
584
585OnTimer300000:
586        donpcevent "1st Guardian Stone#sch02::OnEnable";
587        setarray $agit_sc02[0],2; //Global Variable
588        stopnpctimer;
589        end;
590}
591
592schg_cas02,231,57,0     script  1st Guardian Stone#sch02        844,{
593        set .@GID, GetCastleData("schg_cas02",1);
594        if (getcharid(2) == .@GID) {
595                mes "^3355FFYou will need the";
596                mes "following materials to";
597                mes "rebuild a destroyed";
598                mes "Guardian Stone.^000000";
599                next;
600                mes "1 Oridecon";
601                mes "1 Elunium";
602                mes "30 Stones";
603                mes "5 Blue Gemstones";
604                mes "5 Yellow Gemstones";
605                mes "5 Red Gemstones";
606                next;
607                mes "^3355FFDo you want to continue?^000000";
608                switch(select("No:Continue")) {
609                case 1:
610                        mes "^3355FFWork canceled.^000000";
611                        close;
612                case 2:
613                        if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
614                                mes "^3355FFArrange Stones, Elunium, and";
615                                mes "Oridecon, in that order, in the";
616                                mes "center. Then you must arrange";
617                                mes "the enchanted Gemstones to";
618                                mes "rebuild the Guardian Stone.^000000";
619                                next;
620                                switch(select("Elunium:Oridecon:Stone")) {
621                                case 1:
622                                        mes "^3355FFElunium has been";
623                                        mes "placed in the center.^000000";
624                                        next;
625                                        break;
626                                case 2:
627                                        mes "^3355FFOridecon has been";
628                                        mes "placed in the center.^000000";
629                                        next;
630                                        break;
631                                case 3:
632                                        mes "^3355FFStones have been";
633                                        mes "placed in the center.^000000";
634                                        set .@nice,.@nice+10;
635                                        next;
636                                        break;
637                                }
638                                switch(select("Elunium:Oridecon:Stone")) {
639                                case 1:
640                                        mes "^3355FFYou have lined the";
641                                        mes "outside of the center";
642                                        mes "with some Elunium.^000000";
643                                        set .@nice,.@nice+10;
644                                        next;
645                                        break;
646                                case 2:
647                                        mes "^3355FFYou have lined the";
648                                        mes "outside of the center";
649                                        mes "with some Oridecon.^000000";
650                                        next;
651                                        break;
652                                case 3:
653                                        mes "^3355FFYou have lined the";
654                                        mes "outside of the center";
655                                        mes "with some Stones.^000000";
656                                        next;
657                                        break;
658                                }
659                                switch(select("Elunium:Oridecon:Stone")) {
660                                case 1:
661                                        mes "^3355FFYou covered the";
662                                        mes "rest of the materials";
663                                        mes "with some Elunium.^000000";
664                                        next;
665                                        break;
666                                case 2:
667                                        mes "^3355FFYou covered the";
668                                        mes "rest of the materials";
669                                        mes "with some Oridecon.^000000";
670                                        set .@nice,.@nice+10;
671                                        next;
672                                        break;
673                                case 3:
674                                        mes "^3355FFYou covered the";
675                                        mes "rest of the materials";
676                                        mes "with some Stones.^000000";
677                                        next;
678                                        break;
679                                }
680                                mes "^3355FFNow you need to arrange";
681                                mes "the enchanted Gemstones";
682                                mes "accordingly. You can identify";
683                                mes "their Magic properties by";
684                                mes "their casting effect.^000000";
685                                next;
686                                while(1) {
687                                        if (.@roof0 > 7) {
688                                                break;
689                                        }
690                                        else {
691                                                switch(rand(1,3)) {
692                                                case 1:
693                                                        specialeffect 54; //"1st Guardian Stone#sch02" EF_BEGINSPELL2
694                                                        mes "^3355FFThe Gemstones must";
695                                                        mes "be arranged in the correct";
696                                                        mes "order according to their";
697                                                        mes "magic properties and power.^000000";
698                                                        next;
699                                                        switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
700                                                        case 1:
701                                                                mes "^3355FFYou placed the Red Gemstone.";
702                                                                mes "However, the Guardian Stone";
703                                                                mes "Repair System failed because";
704                                                                mes "of a magic power conflict.^000000";
705                                                                close;
706                                                        case 2:
707                                                                mes "^3355FFYou placed the Yellow Gemstone.";
708                                                                mes "However, the Guardian Stone";
709                                                                mes "Repair System failed because";
710                                                                mes "of a magic power conflict.^000000";
711                                                                close;
712                                                        case 3:
713                                                                mes "^3355FFYou placed the Blue Gemstone.^000000";
714                                                                set .@nice,.@nice+10;
715                                                                set .@roof0,.@roof0 + 1;
716                                                                specialeffect 18; //"1st Guardian Stone#sch02" EF_STEAL
717                                                                next;
718                                                                break;
719                                                        }
720                                                        break;
721                                                case 2:
722                                                        specialeffect 225; //"1st Guardian Stone#sch02" EF_VOLCANO
723                                                        mes "^3355FFThe Gemstones must";
724                                                        mes "be arranged in the correct";
725                                                        mes "order according to their";
726                                                        mes "magic properties and power.^000000";
727                                                        next;
728                                                        switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
729                                                        case 1:
730                                                                mes "^3355FFYou placed the Red Gemstone.^000000";
731                                                                set .@nice,.@nice+10;
732                                                                set .@roof0,.@roof0 + 1;
733                                                                specialeffect 18; //"1st Guardian Stone#sch02" EF_STEAL
734                                                                next;
735                                                                break;
736                                                        case 2:
737                                                                mes "^3355FFYou placed the Yellow Gemstone.";
738                                                                mes "However, the Guardian Stone";
739                                                                mes "Repair System failed because";
740                                                                mes "of a magic power conflict.^000000";
741                                                                close;
742                                                        case 3:
743                                                                mes "^3355FFYou placed the Blue Gemstone.";
744                                                                mes "However, the Guardian Stone";
745                                                                mes "Repair System failed because";
746                                                                mes "of a magic power conflict.^000000";
747                                                                close;
748                                                        }
749                                                        break;
750                                                case 3:
751                                                        specialeffect 56; //"1st Guardian Stone#sch02" EF_BEGINSPELL4
752                                                        mes "^3355FFThe Gemstones must";
753                                                        mes "be arranged in the correct";
754                                                        mes "order according to their";
755                                                        mes "magic properties and power.^000000";
756                                                        next;
757                                                        switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
758                                                        case 1:
759                                                                mes "^3355FFYou placed the Red Gemstone.";
760                                                                mes "However, the Guardian Stone";
761                                                                mes "Repair System failed because";
762                                                                mes "of a magic power conflict.^000000";
763                                                                close;
764                                                        case 2:
765                                                                mes "^3355FFYou placed the Yellow Gemstone.^000000";
766                                                                set .@nice,.@nice+10;
767                                                                set .@roof0,.@roof0 + 1;
768                                                                specialeffect 18; //"1st Guardian Stone#sch02" EF_STEAL
769                                                                next;
770                                                                break;
771                                                        case 3:
772                                                                mes "^3355FFYou placed the Blue Gemstone.";
773                                                                mes "However, the Guardian Stone";
774                                                                mes "Repair System failed because";
775                                                                mes "of a magic power conflict.^000000";
776                                                                close;
777                                                        }
778                                                }
779                                        }
780                                }
781                                if (.@nice > 90) {
782                                        if ($agit_sc02[0] == 0) {
783                                                mes "^3355FFThe Guardian Stone";
784                                                mes "Repair System has";
785                                                mes "already completed.^000000";
786                                                close;
787                                        }
788                                        else {
789                                                if (agitcheck() == 0) {
790                                                        mes "^3355FFIt is impossible to";
791                                                        mes "rebuild the Guardian";
792                                                        mes "Stone because the";
793                                                        mes "Emperium is not present.^000000";
794                                                        close;
795                                                }
796                                                else {
797                                                        mes "^3355FFThe Gemstones have been";
798                                                        mes "arranged, and the Guardian";
799                                                        mes "Stone is successfully repaired.^000000";
800                                                        delitem 984,1; //Oridecon
801                                                        delitem 985,1; //Elunium
802                                                        delitem 7049,30; //Stone
803                                                        delitem 717,5; //Blue_Gemstone
804                                                        delitem 715,5; //Yellow_Gemstone
805                                                        delitem 716,5; //Red_Gemstone
806                                                        close2;
807                                                        donpcevent "#sch02_df01::OnEnable";
808                                                        specialeffect 135; //"1st Guardian Stone#sch02" EF_ICECRASH
809                                                        disablenpc "1st Guardian Stone#sch02";
810                                                        setarray $agit_sc02[0],0;
811                                                        set .@df_all,$agit_sc02[0]+$agit_sc02[1];
812                                                        if (.@df_all == 0) {
813                                                                mapannounce "schg_cas02","The Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
814                                                                donpcevent "#sch02_RL00::OnEnable";
815                                                        }
816                                                        else {
817                                                                mapannounce "schg_cas02","The 1st Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
818                                                        }
819                                                        if ($agit_sc02[5] == 1) {
820                                                                donpcevent "#sch02_gard01::OnEnable";
821                                                        }
822                                                        end;
823                                                }
824                                        }
825                                }
826                                else {
827                                        mes "^3355FFAfter all of that work...";
828                                        mes "It looks like you failed";
829                                        mes "to fix the Guardian Stone,";
830                                        mes "and lost some materials.^000000";
831                                        delitem 7049,10; //Stone
832                                        delitem 717,2; //Blue_Gemstone
833                                        delitem 715,2; //Yellow_Gemstone
834                                        delitem 716,2; //Red_Gemstone
835                                        close;
836                                }
837                        }
838                        else {
839                                mes "^3355FFYou don't have enough";
840                                mes "materials to repair";
841                                mes "the Guardian Stone.^000000";
842                                close;
843                        }
844                }
845        }
846        end;
847
848OnInit:
849        disablenpc "1st Guardian Stone#sch02";
850        end;
851
852OnEnable:
853        enablenpc "1st Guardian Stone#sch02";
854        specialeffect 247; //"1st Guardian Stone#sch02" EF_MAPPILLAR2
855        end;
856
857OnDisable:
858        disablenpc "1st Guardian Stone#sch02";
859        end;
860}
861
862schg_cas02,1,4,0        script  #sch02_df02     -1,{
863OnEnable:
864        guardian "schg_cas02",335,230,"2nd Guardian Stone",1908,"#sch02_df02::OnGuardianStoneDied"; //23;
865        end;
866
867OnDisable:
868        killmonster "schg_cas02","#sch02_df02::OnGuardianStoneDied";
869        setarray $agit_sc02[1],1; //Global Variable
870        stopnpctimer;
871        end;
872
873OnGuardianStoneDied:
874        // 2nd Guardian Stone is Destroyed
875        setarray $agit_sc02[1],1;
876        if (($agit_sc02[0] == 1) || ($agit_sc02[0] == 2)) {
877                set .@destroyed,.@destroyed + 1;
878        }
879        if (($agit_sc02[1] == 1) || ($agit_sc02[1] == 2)) {
880                set .@destroyed,.@destroyed + 1;
881        }
882        if (.@destroyed == 2) {
883                mapannounce "schg_cas02","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
884                donpcevent "#sch02_RL00::OnDisable";
885                donpcevent "#sch02_gard02::Onreset";
886        }
887        else {
888                mapannounce "schg_cas02","The 2nd Guardian Stone has been destroyed!",bc_map,"0x00ff00";
889                donpcevent "#sch02_gard02::Onreset";
890        }
891        initnpctimer;
892        end;
893
894OnTimer300000:
895        donpcevent "2nd Guardian Stone#sch02::OnEnable";
896        setarray $agit_sc02[1],2; //Global Variable
897        stopnpctimer;
898        end;
899}
900
901schg_cas02,335,231,0    script  2nd Guardian Stone#sch02        844,{
902        set .@GID, GetCastleData("schg_cas02",1);
903        if (getcharid(2) == .@GID) {
904                mes "^3355FFYou will need the";
905                mes "following materials to";
906                mes "rebuild a destroyed";
907                mes "Guardian Stone.^000000";
908                next;
909                mes "1 Oridecon";
910                mes "1 Elunium";
911                mes "30 Stones";
912                mes "5 Blue Gemstones";
913                mes "5 Yellow Gemstones";
914                mes "5 Red Gemstones";
915                next;
916                mes "^3355FFDo you want to continue?^000000";
917                switch(select("No:Continue")) {
918                case 1:
919                        mes "^3355FFWork canceled.^000000";
920                        close;
921                case 2:
922                        if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
923                                mes "^3355FFArrange Stones, Elunium, and";
924                                mes "Oridecon, in that order, in the";
925                                mes "center. Then you must arrange";
926                                mes "the enchanted Gemstones to";
927                                mes "rebuild the Guardian Stone.^000000";
928                                next;
929                                switch(select("Elunium:Oridecon:Stone")) {
930                                case 1:
931                                        mes "^3355FFElunium has been";
932                                        mes "placed in the center.^000000";
933                                        next;
934                                        break;
935                                case 2:
936                                        mes "^3355FFOridecon has been";
937                                        mes "placed in the center.^000000";
938                                        next;
939                                        break;
940                                case 3:
941                                        mes "^3355FFStones have been";
942                                        mes "placed in the center.^000000";
943                                        set .@nice,.@nice+10;
944                                        next;
945                                        break;
946                                }
947                                switch(select("Elunium:Oridecon:Stone")) {
948                                case 1:
949                                        mes "^3355FFYou have lined the";
950                                        mes "outside of the center";
951                                        mes "with some Elunium.^000000";
952                                        set .@nice,.@nice+10;
953                                        next;
954                                        break;
955                                case 2:
956                                        mes "^3355FFYou have lined the";
957                                        mes "outside of the center";
958                                        mes "with some Oridecon.^000000";
959                                        next;
960                                        break;
961                                case 3:
962                                        mes "^3355FFYou have lined the";
963                                        mes "outside of the center";
964                                        mes "with some Stones.^000000";
965                                        next;
966                                        break;
967                                }
968                                switch(select("Elunium:Oridecon:Stone")) {
969                                case 1:
970                                        mes "^3355FFYou covered the";
971                                        mes "rest of the materials";
972                                        mes "with some Elunium.^000000";
973                                        next;
974                                        break;
975                                case 2:
976                                        mes "^3355FFYou covered the";
977                                        mes "rest of the materials";
978                                        mes "with some Oridecon.^000000";
979                                        set .@nice,.@nice+10;
980                                        next;
981                                        break;
982                                case 3:
983                                        mes "^3355FFYou covered the";
984                                        mes "rest of the materials";
985                                        mes "with some Stones.^000000";
986                                        next;
987                                        break;
988                                }
989                                mes "^3355FFNow you need to arrange";
990                                mes "the enchanted Gemstones";
991                                mes "accordingly. You can identify";
992                                mes "their Magic properties by";
993                                mes "their casting effect.^000000";
994                                next;
995                                while(1) {
996                                        if (.@roof0 > 7) {
997                                                break;
998                                        }
999                                        else {
1000                                                switch(rand(1,3)) {
1001                                                case 1:
1002                                                        specialeffect 54; //"2nd Guardian Stone#sch02" EF_BEGINSPELL2
1003                                                        mes "^3355FFThe Gemstones must";
1004                                                        mes "be arranged in the correct";
1005                                                        mes "order according to their";
1006                                                        mes "magic properties and power.^000000";
1007                                                        next;
1008                                                        switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
1009                                                        case 1:
1010                                                                mes "^3355FFYou placed the Red Gemstone.";
1011                                                                mes "However, the Guardian Stone";
1012                                                                mes "Repair System failed because";
1013                                                                mes "of a magic power conflict.^000000";
1014                                                                close;
1015                                                        case 2:
1016                                                                mes "^3355FFYou placed the Yellow Gemstone.";
1017                                                                mes "However, the Guardian Stone";
1018                                                                mes "Repair System failed because";
1019                                                                mes "of a magic power conflict.^000000";
1020                                                                close;
1021                                                        case 3:
1022                                                                mes "^3355FFYou placed the Blue Gemstone.^000000";
1023                                                                set .@nice,.@nice+10;
1024                                                                set .@roof0,.@roof0 + 1;
1025                                                                specialeffect 18; //"2nd Guardian Stone#sch02" EF_STEAL
1026                                                                next;
1027                                                                break;
1028                                                        }
1029                                                        break;
1030                                                case 2:
1031                                                        specialeffect 225; //"2nd Guardian Stone#sch02" EF_VOLCANO
1032                                                        mes "^3355FFThe Gemstones must";
1033                                                        mes "be arranged in the correct";
1034                                                        mes "order according to their";
1035                                                        mes "magic properties and power.^000000";
1036                                                        next;
1037                                                        switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
1038                                                        case 1:
1039                                                                mes "^3355FFYou placed the Red Gemstone.^000000";
1040                                                                set .@nice,.@nice+10;
1041                                                                set .@roof0,.@roof0 + 1;
1042                                                                specialeffect 18; //"2nd Guardian Stone#sch02" EF_STEAL
1043                                                                next;
1044                                                                break;
1045                                                        case 2:
1046                                                                mes "^3355FFYou placed the Yellow Gemstone.";
1047                                                                mes "However, the Guardian Stone";
1048                                                                mes "Repair System failed because";
1049                                                                mes "of a magic power conflict.^000000";
1050                                                                close;
1051                                                        case 3:
1052                                                                mes "^3355FFYou placed the Blue Gemstone.";
1053                                                                mes "However, the Guardian Stone";
1054                                                                mes "Repair System failed because";
1055                                                                mes "of a magic power conflict.^000000";
1056                                                                close;
1057                                                        }
1058                                                        break;
1059                                                case 3:
1060                                                        specialeffect 56; //"2nd Guardian Stone#sch02" EF_BEGINSPELL4
1061                                                        mes "^3355FFThe Gemstones must";
1062                                                        mes "be arranged in the correct";
1063                                                        mes "order according to their";
1064                                                        mes "magic properties and power.^000000";
1065                                                        next;
1066                                                        switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
1067                                                        case 1:
1068                                                                mes "^3355FFYou placed the Red Gemstone.";
1069                                                                mes "However, the Guardian Stone";
1070                                                                mes "Repair System failed because";
1071                                                                mes "of a magic power conflict.^000000";
1072                                                                close;
1073                                                        case 2:
1074                                                                mes "^3355FFYou placed the Yellow Gemstone.^000000";
1075                                                                set .@nice,.@nice+10;
1076                                                                set .@roof0,.@roof0 + 1;
1077                                                                specialeffect 18; //"2nd Guardian Stone#sch02" EF_STEAL
1078                                                                next;
1079                                                                break;
1080                                                        case 3:
1081                                                                mes "^3355FFYou placed the Blue Gemstone.";
1082                                                                mes "However, the Guardian Stone";
1083                                                                mes "Repair System failed because";
1084                                                                mes "of a magic power conflict.^000000";
1085                                                                close;
1086                                                        }
1087                                                }
1088                                        }
1089                                }
1090                                if (.@nice > 90) {
1091                                        if ($agit_sc02[1] == 0) {
1092                                                mes "^3355FFThe Guardian Stone";
1093                                                mes "Repair System has";
1094                                                mes "successfully completed.^000000";
1095                                                close;
1096                                        }
1097                                        else {
1098                                                if (agitcheck() == 0) {
1099                                                        mes "^3355FFIt is impossible to";
1100                                                        mes "rebuild the Guardian";
1101                                                        mes "Stone because the";
1102                                                        mes "Emperium is not present.^000000";
1103                                                        close;
1104                                                }
1105                                                else {
1106                                                        mes "^3355FFThe Gemstones have been";
1107                                                        mes "arranged, and the Guardian";
1108                                                        mes "Stone is successfully repaired.^000000";
1109                                                        delitem 984,1; //Oridecon
1110                                                        delitem 985,1; //Elunium
1111                                                        delitem 7049,30; //Stone
1112                                                        delitem 717,5; //Blue_Gemstone
1113                                                        delitem 715,5; //Yellow_Gemstone
1114                                                        delitem 716,5; //Red_Gemstone
1115                                                        close2;
1116                                                        donpcevent "#sch02_df02::OnEnable";
1117                                                        specialeffect 135; //"2nd Guardian Stone#sch02" EF_ICECRASH
1118                                                        disablenpc "2nd Guardian Stone#sch02";
1119                                                        setarray $agit_sc02[1],0;
1120                                                        set .@df_all,$agit_sc02[0]+$agit_sc02[1];
1121                                                        if (.@df_all == 0) {
1122                                                                mapannounce "schg_cas02","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
1123                                                                donpcevent "#sch02_RL00::OnEnable";
1124                                                        }
1125                                                        else {
1126                                                                mapannounce "schg_cas02","The 2nd Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
1127                                                        }
1128                                                        if ($agit_sc02[5] == 1) {
1129                                                                donpcevent "#sch02_gard02::OnEnable";
1130                                                        }
1131                                                        end;
1132                                                }
1133                                        }
1134                                }
1135                                else {
1136                                        mes "^3355FFAfter all of that work...";
1137                                        mes "It looks like you failed";
1138                                        mes "to fix the Guardian Stone,";
1139                                        mes "and lost some materials.^000000";
1140                                        delitem 7049,10; //Stone
1141                                        delitem 717,2; //Blue_Gemstone
1142                                        delitem 715,2; //Yellow_Gemstone
1143                                        delitem 716,2; //Red_Gemstone
1144                                        close;
1145                                }
1146                        }
1147                        else {
1148                                mes "^3355FFYou don't have enough";
1149                                mes "materials to repair";
1150                                mes "the Guardian Stone.^000000";
1151                                close;
1152                        }
1153                }
1154        }
1155        end;
1156
1157OnInit:
1158        disablenpc "2nd Guardian Stone#sch02";
1159        end;
1160
1161OnEnable:
1162        enablenpc "2nd Guardian Stone#sch02";
1163        specialeffect 247; //"2nd Guardian Stone#sch02" EF_MAPPILLAR2
1164        end;
1165
1166OnDisable:
1167        disablenpc "2nd Guardian Stone#sch02";
1168        end;
1169}
1170
1171schg_cas02,2,1,0        script  #sch02_RL00     -1,{
1172OnEnable:
1173        setcell "schg_cas02",290,98,290,105,cell_walkable,0;
1174        setcell "schg_cas02",290,98,290,105,cell_shootable,0;
1175        guardian "schg_cas02",289,98," ",1905,"#sch02_RL00::OnBarrierDestroyed"; //24;
1176        guardian "schg_cas02",289,100," ",1905,"#sch02_RL00::OnBarrierDestroyed"; //25;
1177        guardian "schg_cas02",289,102," ",1905,"#sch02_RL00::OnBarrierDestroyed"; //26;
1178        guardian "schg_cas02",289,104," ",1905,"#sch02_RL00::OnBarrierDestroyed"; //27;
1179        end;
1180
1181OnDisable:
1182        setcell "schg_cas02",290,98,290,105,cell_walkable,1;
1183        setcell "schg_cas02",290,98,290,105,cell_shootable,1;
1184        killmonster "schg_cas02","#sch02_RL00::OnBarrierDestroyed";
1185        end;
1186
1187OnBarrierDestroyed:
1188        end;
1189}
1190
1191schg_cas02,2,2,0        script  #sch02_RL01     -1,{
1192OnEnable:
1193        set .MyMobCount,6;
1194        setcell "schg_cas02",279,98,279,105,cell_walkable,0;
1195        guardian "schg_cas02",280,98," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //28;
1196        guardian "schg_cas02",280,100," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //29;
1197        guardian "schg_cas02",280,102," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //30;
1198        guardian "schg_cas02",281,99," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //31;
1199        guardian "schg_cas02",281,101," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //32;
1200        guardian "schg_cas02",281,103," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //33;
1201        end;
1202
1203OnBarrierDestroyed:
1204        set .MyMobCount,.MyMobCount-1;
1205        if (.MyMobCount == 0) {
1206                setarray $agit_sc02[2],1;
1207                mapannounce "schg_cas02","The 1st Fortress Gate is destroyed.",bc_map,"0x00ff00";
1208                setcell "schg_cas02",279,98,279,105,cell_walkable,1;
1209        }
1210        end;
1211
1212OnDisable:
1213        setcell "schg_cas02",279,98,279,105,cell_walkable,1;
1214        killmonster "schg_cas02","#sch02_RL01::OnBarrierDestroyed";
1215        end;
1216}
1217
1218schg_cas02,2,3,0        script  #sch02_RL02     -1,{
1219OnEnable:
1220        set .MyMobCount,6;
1221        setcell "schg_cas02",230,213,230,218,cell_walkable,0;
1222        guardian "schg_cas02",231,214," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //34;
1223        guardian "schg_cas02",231,216," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //35;
1224        guardian "schg_cas02",231,218," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //36;
1225        guardian "schg_cas02",232,213," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //37;
1226        guardian "schg_cas02",232,215," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //38;
1227        guardian "schg_cas02",232,217," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //39;
1228        end;
1229
1230OnBarrierDestroyed:
1231        set .MyMobCount,.MyMobCount-1;
1232        if (.MyMobCount == 0) {
1233                setarray $agit_sc02[3],1;
1234                mapannounce "schg_cas02","The 2nd Fortress Gate is destroyed.",bc_map,"0x00ff00";
1235                setcell "schg_cas02",230,213,230,218,cell_walkable,1;
1236        }
1237        end;
1238
1239OnDisable:
1240        setcell "schg_cas02",230,213,230,218,cell_walkable,1;
1241        killmonster "schg_cas02","#sch02_RL02::OnBarrierDestroyed";
1242        end;
1243}
1244
1245schg_cas02,2,4,0        script  #sch02_RL03     -1,{
1246OnEnable:
1247        set .MyMobCount,4;
1248        setcell "schg_cas02",160,141,165,141,cell_walkable,0;
1249        guardian "schg_cas02",160,140," ",1905,"#sch02_RL03::OnBarrierDestroyed"; //40;
1250        guardian "schg_cas02",162,140," ",1905,"#sch02_RL03::OnBarrierDestroyed"; //41;
1251        guardian "schg_cas02",164,140," ",1905,"#sch02_RL03::OnBarrierDestroyed"; //42;
1252        guardian "schg_cas02",166,140," ",1905,"#sch02_RL03::OnBarrierDestroyed"; //43;
1253        end;
1254
1255OnBarrierDestroyed:
1256        set .MyMobCount,.MyMobCount-1;
1257        if (.MyMobCount == 0) {
1258                setarray $agit_sc02[4],1;
1259                mapannounce "schg_cas02","The 3rd Fortress Gate is destroyed!",bc_map,"0x00ff00";
1260                setcell "schg_cas02",160,141,165,141,cell_walkable,1;
1261        }
1262        end;
1263
1264OnDisable:
1265        setcell "schg_cas02",160,141,165,141,cell_walkable,1;
1266        killmonster "schg_cas02","#sch02_RL03::OnBarrierDestroyed";
1267        end;
1268}
1269
1270schg_cas02,288,97,0     script  Control Device01#sch02  111,{
1271        set .@GID, GetCastleData("schg_cas02",1);
1272        if (getcharid(2) == .@GID) {
1273                if (strcharinfo(0) == getguildmaster(.@GID)) {
1274                        if ($agit_sc02[2] == 2) {
1275                                mes "^3355FFDemolished Fortress";
1276                                mes "Gates can be repaired,";
1277                                mes "but you will need to gather";
1278                                mes "the following materials.^000000";
1279                                next;
1280                                mes "^4D4DFF10 Steel^000000,";
1281                                mes "^4D4DFF30 Trunks^000000,";
1282                                mes "^4D4DFF5 Oridecon^000000, and";
1283                                mes "^4D4DFF10 Emveretarcon^000000.";
1284                                next;
1285                                select("Continue");
1286                                if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
1287                                        mes "^3355FFYou will need Trunks to";
1288                                        mes "repair the support frame,";
1289                                        mes "Oridecon to enhance the";
1290                                        mes "gate's endurance, and";
1291                                        mes "Emveretarcon to basically";
1292                                        mes "hold everything together.^000000";
1293                                        next;
1294                                        set .@ro_of01,rand(10,15);
1295                                        while(1) {
1296                                                if (.@ro_of02 == .@ro_of01) {
1297                                                        break;
1298                                                }
1299                                                else {
1300                                                        switch(rand(1,4)) {
1301                                                        case 1:
1302                                                                mes "^3355FFThe support frame";
1303                                                                mes "is badly damaged:";
1304                                                                mes "fixing this part";
1305                                                                mes "is a top priority.^000000";
1306                                                                next;
1307                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1308                                                                case 1:
1309                                                                        mes "^3355FFThe frame has been";
1310                                                                        mes "reinforced with wood.^000000";
1311                                                                        set .@rp_temp,.@rp_temp + 1;
1312                                                                        set .@ro_of02,.@ro_of02 + 1;
1313                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1314                                                                        next;
1315                                                                        break;
1316                                                                case 2:
1317                                                                        mes "^3355FFYou tried using steel,";
1318                                                                        mes "but it's not working very";
1319                                                                        mes "well. You'll have to try";
1320                                                                        mes "something else.^000000";
1321                                                                        close;
1322                                                                case 3:
1323                                                                        mes "^3355FFYou tried using emveretarcon,";
1324                                                                        mes "but it's not working very well.^FFFFFF ^3355FF You'll have to try something else.";
1325                                                                        close;
1326                                                                case 4:
1327                                                                        mes "^3355FFYou tried using oridecon,";
1328                                                                        mes "but it's not working very";
1329                                                                        mes "well. You'll have to try";
1330                                                                        mes "something else.^000000";
1331                                                                        close;
1332                                                                }
1333                                                                break;
1334                                                        case 2:
1335                                                                mes "^3355FFIt looks like the gate's";
1336                                                                mes "overall endurance needs to";
1337                                                                mes "be reinforced with something.^000000";
1338                                                                next;
1339                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1340                                                                case 1:
1341                                                                        mes "^3355FFYou tried using wood";
1342                                                                        mes "to reinforce the gate.^000000";
1343                                                                        set .@ro_of02,.@ro_of02 + 1;
1344                                                                        next;
1345                                                                        break;
1346                                                                case 2:
1347                                                                        mes "^3355FFYou tried using steel";
1348                                                                        mes "to reinforce the gate, but";
1349                                                                        mes "it's not working well at all.";
1350                                                                        mes "You'll have to start over.^000000";
1351                                                                        close;
1352                                                                case 3:
1353                                                                        mes "^3355FFYou tried using emveretarcon";
1354                                                                        mes "to reinforce the gate, but it's";
1355                                                                        mes "not working well at all.";
1356                                                                        mes "You'll have to start over.^000000";
1357                                                                        close;
1358                                                                case 4:
1359                                                                        mes "^3355FFYou hammered the";
1360                                                                        mes "oridecon: it looks";
1361                                                                        mes "like this will work.^000000";
1362                                                                        set .@rp_temp,.@rp_temp + 1;
1363                                                                        set .@ro_of02,.@ro_of02 + 1;
1364                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1365                                                                        next;
1366                                                                        break;
1367                                                                }
1368                                                                break;
1369                                                        case 3:
1370                                                                mes "^3355FFThe damage to the gate";
1371                                                                mes "has caused all these";
1372                                                                mes "cracks. You'll have to";
1373                                                                mes "weld them solid somehow.^000000";
1374                                                                next;
1375                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1376                                                                case 1:
1377                                                                        mes "^3355FFYou tried using wood to fix";
1378                                                                        mes "this problem, but it seems";
1379                                                                        mes "to have made it worse.";
1380                                                                        mes "You'll have to start all over.^000000";
1381                                                                        close;
1382                                                                case 2:
1383                                                                        mes "^3355FFYou used steel to weld";
1384                                                                        mes "all the cracks: the gate is";
1385                                                                        mes "is starting to look more solid.^000000";
1386                                                                        set .@rp_temp,.@rp_temp + 1;
1387                                                                        set .@ro_of02,.@ro_of02 + 1;
1388                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1389                                                                        next;
1390                                                                        break;
1391                                                                case 3:
1392                                                                        mes "^3355FFYou tried using emveretarcon";
1393                                                                        mes "to reinforce the gate, but it's";
1394                                                                        mes "not working well at all.";
1395                                                                        mes "You'll have to start over.^000000";
1396                                                                        close;
1397                                                                case 4:
1398                                                                        mes "^3355FFYou tried using oridecon,";
1399                                                                        mes "but it's not working very";
1400                                                                        mes "well. You'll have to try";
1401                                                                        mes "something else.^000000";
1402                                                                        close;
1403                                                                }
1404                                                                break;
1405                                                        case 4:
1406                                                                mes "^3355FFNow you need to make";
1407                                                                mes "sure that the gate is held";
1408                                                                mes "together pretty solidly.^000000";
1409                                                                next;
1410                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1411                                                                case 1:
1412                                                                        mes "^3355FFYou tried using wood to fix";
1413                                                                        mes "this problem, but it seems";
1414                                                                        mes "to have made it worse.";
1415                                                                        mes "You'll have to start all over.^000000";
1416                                                                        close;
1417                                                                case 2:
1418                                                                        mes "^3355FFYou tried using steel,";
1419                                                                        mes "but it's not working very";
1420                                                                        mes "well. You'll have to try";
1421                                                                        mes "something else.^000000";
1422                                                                        close;
1423                                                                case 3:
1424                                                                        mes "^3355FFYou successfully used";
1425                                                                        mes "the emveretarcon to repair";
1426                                                                        mes "much of the gate's damage.^000000";
1427                                                                        set .@rp_temp,.@rp_temp + 1;
1428                                                                        set .@ro_of02,.@ro_of02 + 1;
1429                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1430                                                                        next;
1431                                                                        break;
1432                                                                case 4:
1433                                                                        mes "^3355FFYou tried using oridecon,";
1434                                                                        mes "but it's not working very";
1435                                                                        mes "well. You'll have to try";
1436                                                                        mes "something else.^000000";
1437                                                                        close;
1438                                                                }
1439                                                        }
1440                                                }
1441                                        }
1442                                        mes "^3355FFWell, it looks like";
1443                                        mes "you're just about done";
1444                                        mes "with repairing the gate.^000000";
1445                                        next;
1446                                        if (agitcheck() == 0) {
1447                                                mes "^3355FFUnfortunately, the Fortress";
1448                                                mes "Gate can't be reconstructed:";
1449                                                mes "the Emperium is no longer here.^000000";
1450                                                close;
1451                                        }
1452                                        else {
1453                                                if (.@rp_temp == .@ro_of01) {
1454                                                        mes "^3355FFThe Fortress Gate has";
1455                                                        mes "been successfully repaired!^000000";
1456                                                        delitem 1019,30; //Wooden_Block
1457                                                        delitem 999,10; //Steel
1458                                                        delitem 1011,10; //Emveretarcon
1459                                                        delitem 984,5; //Oridecon
1460                                                        close2;
1461                                                        donpcevent "#sch02_RL01::OnEnable";
1462                                                        disablenpc "Control Device01#sch02";
1463                                                        mapannounce "schg_cas02","The 1st Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
1464                                                        setarray $agit_sc02[2],0;
1465                                                        end;
1466                                                }
1467                                                else {
1468                                                        mes "^3355FFThe wall has been breached,";
1469                                                        mes "and the attempt to repair the";
1470                                                        mes "Fortress Gate has failed.";
1471                                                        mes "You lost some of your";
1472                                                        mes "repair resources...^000000";
1473                                                        delitem 984,2; //Oridecon
1474                                                        delitem 999,4; //Steel
1475                                                        delitem 1019,14; //Wooden_Block
1476                                                        delitem 1011,3; //Emveretarcon
1477                                                        close;
1478                                                }
1479                                        }
1480                                }
1481                                else {
1482                                        mes "^3355FFYou can't attempt to repair";
1483                                        mes "the Fortress Gate if you don't";
1484                                        mes "have all the needed materials.^000000";
1485                                        close;
1486                                }
1487                        }
1488                }
1489        }
1490        end;
1491
1492OnInit:
1493        disablenpc "Control Device01#sch02";
1494        end;
1495
1496OnEnable:
1497        enablenpc "Control Device01#sch02";
1498        end;
1499
1500OnDisable:
1501        disablenpc "Control Device01#sch02";
1502        end;
1503}
1504
1505schg_cas02,230,209,0    script  Control Device02#sch02  111,{
1506        set .@GID, GetCastleData("schg_cas02",1);
1507        if (getcharid(2) == .@GID) {
1508                if (strcharinfo(0) == getguildmaster(.@GID)) {
1509                        if ($agit_sc02[3] == 2) {
1510                                mes "^3355FFDemolished Fortress";
1511                                mes "Gates can be repaired,";
1512                                mes "but you will need to gather";
1513                                mes "the following materials.^000000";
1514                                next;
1515                                mes "^4D4DFF10 Steel^000000,";
1516                                mes "^4D4DFF30 Trunks^000000,";
1517                                mes "^4D4DFF5 Oridecon^000000, and";
1518                                mes "^4D4DFF10 Emveretarcon^000000.";
1519                                next;
1520                                select("Continue");
1521                                if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
1522                                        mes "^3355FFYou will need Trunks to";
1523                                        mes "repair the support frame,";
1524                                        mes "Oridecon to enhance the";
1525                                        mes "gate's endurance, and";
1526                                        mes "Emveretarcon to basically";
1527                                        mes "hold everything together.^000000";
1528                                        next;
1529                                        set .@ro_of01,rand(10,15);
1530                                        while(1) {
1531                                                if (.@ro_of02 == .@ro_of01) {
1532                                                        break;
1533                                                }
1534                                                else {
1535                                                        switch(rand(1,4)) {
1536                                                        case 1:
1537                                                                mes "^3355FFThe support frame";
1538                                                                mes "is badly damaged:";
1539                                                                mes "fixing this part";
1540                                                                mes "is a top priority.^000000";
1541                                                                next;
1542                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1543                                                                case 1:
1544                                                                        mes "^3355FFThe frame has been";
1545                                                                        mes "reinforced with wood.^000000";
1546                                                                        set .@rp_temp,.@rp_temp + 1;
1547                                                                        set .@ro_of02,.@ro_of02 + 1;
1548                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1549                                                                        next;
1550                                                                        break;
1551                                                                case 2:
1552                                                                        mes "^3355FFYou tried using steel,";
1553                                                                        mes "but it's not working very";
1554                                                                        mes "well. You'll have to try";
1555                                                                        mes "something else.^000000";
1556                                                                        close;
1557                                                                case 3:
1558                                                                        mes "^3355FFYou tried using emveretarcon";
1559                                                                        mes "to reinforce the gate, but it's";
1560                                                                        mes "not working well at all.";
1561                                                                        mes "You'll have to start over.^000000";
1562                                                                        close;
1563                                                                case 4:
1564                                                                        mes "^3355FFYou tried using oridecon,";
1565                                                                        mes "but it's not working very";
1566                                                                        mes "well. You'll have to try";
1567                                                                        mes "something else.^000000";
1568                                                                        close;
1569                                                                }
1570                                                                break;
1571                                                        case 2:
1572                                                                mes "^3355FFIt looks like the gate's";
1573                                                                mes "overall endurance needs to";
1574                                                                mes "be reinforced with something.^000000";
1575                                                                next;
1576                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1577                                                                case 1:
1578                                                                        mes "^3355FFYou tried using wood";
1579                                                                        mes "to reinforce the gate.^000000";
1580                                                                        set .@ro_of02,.@ro_of02 + 1;
1581                                                                        next;
1582                                                                        break;
1583                                                                case 2:
1584                                                                        mes "^3355FFYou tried using steel";
1585                                                                        mes "to reinforce the gate, but";
1586                                                                        mes "it's not working well at all.";
1587                                                                        mes "You'll have to start over.^000000";
1588                                                                        close;
1589                                                                case 3:
1590                                                                        mes "^3355FFYou tried using emveretarcon";
1591                                                                        mes "to reinforce the gate, but it's";
1592                                                                        mes "not working well at all.";
1593                                                                        mes "You'll have to start over.^000000";
1594                                                                        close;
1595                                                                case 4:
1596                                                                        mes "^3355FFYou hammered the";
1597                                                                        mes "oridecon: it looks";
1598                                                                        mes "like this will work.^000000";
1599                                                                        set .@rp_temp,.@rp_temp + 1;
1600                                                                        set .@ro_of02,.@ro_of02 + 1;
1601                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1602                                                                        next;
1603                                                                        break;
1604                                                                }
1605                                                                break;
1606                                                        case 3:
1607                                                                mes "^3355FFThe damage to the gate";
1608                                                                mes "has caused all these";
1609                                                                mes "cracks. You'll have to";
1610                                                                mes "weld them solid somehow.^000000";
1611                                                                next;
1612                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1613                                                                case 1:
1614                                                                        mes "^3355FFYou tried using wood to fix";
1615                                                                        mes "this problem, but it seems";
1616                                                                        mes "to have made it worse.";
1617                                                                        mes "You'll have to start all over.^000000";
1618                                                                        close;
1619                                                                case 2:
1620                                                                        mes "^3355FFYou used steel to weld";
1621                                                                        mes "all the cracks: the gate is";
1622                                                                        mes "is starting to look more solid.^000000";
1623                                                                        set .@rp_temp,.@rp_temp + 1;
1624                                                                        set .@ro_of02,.@ro_of02 + 1;
1625                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1626                                                                        next;
1627                                                                        break;
1628                                                                case 3:
1629                                                                        mes "^3355FFYou tried using emveretarcon";
1630                                                                        mes "to reinforce the gate, but it's";
1631                                                                        mes "not working well at all.";
1632                                                                        mes "You'll have to start over.^000000";
1633                                                                        close;
1634                                                                case 4:
1635                                                                        mes "^3355FFYou tried using oridecon,";
1636                                                                        mes "but it's not working very";
1637                                                                        mes "well. You'll have to try";
1638                                                                        mes "something else.^000000";
1639                                                                        close;
1640                                                                }
1641                                                                break;
1642                                                        case 4:
1643                                                                mes "^3355FFNow you need to make";
1644                                                                mes "sure that the gate is held";
1645                                                                mes "together pretty solidly.^000000";
1646                                                                next;
1647                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1648                                                                case 1:
1649                                                                        mes "^3355FFYou tried using wood to fix";
1650                                                                        mes "this problem, but it seems";
1651                                                                        mes "to have made it worse.";
1652                                                                        mes "You'll have to start all over.^000000";
1653                                                                        close;
1654                                                                case 2:
1655                                                                        mes "^3355FFYou tried using steel,";
1656                                                                        mes "but it's not working very";
1657                                                                        mes "well. You'll have to try";
1658                                                                        mes "something else.^000000";
1659                                                                        close;
1660                                                                case 3:
1661                                                                        mes "^3355FFYou successfully used";
1662                                                                        mes "the emveretarcon to repair";
1663                                                                        mes "much of the gate's damage.^000000";
1664                                                                        set .@rp_temp,.@rp_temp + 1;
1665                                                                        set .@ro_of02,.@ro_of02 + 1;
1666                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1667                                                                        next;
1668                                                                        break;
1669                                                                case 4:
1670                                                                        mes "^3355FFYou tried using oridecon,";
1671                                                                        mes "but it's not working very";
1672                                                                        mes "well. You'll have to try";
1673                                                                        mes "something else.^000000";
1674                                                                        close;
1675                                                                }
1676                                                        }
1677                                                }
1678                                        }
1679                                        mes "^3355FFWell, it looks like";
1680                                        mes "you're just about done";
1681                                        mes "with repairing the gate.^000000";
1682                                        next;
1683                                        if (agitcheck() == 0) {
1684                                                mes "^3355FFUnfortunately, the Fortress";
1685                                                mes "Gate can't be reconstructed:";
1686                                                mes "the Emperium is no longer here.^000000";
1687                                                close;
1688                                        }
1689                                        else {
1690                                                if (.@rp_temp == .@ro_of01) {
1691                                                        mes "^3355FFThe Fortress Gate has";
1692                                                        mes "been successfully repaired!^000000";
1693                                                        delitem 1019,30; //Wooden_Block
1694                                                        delitem 999,10; //Steel
1695                                                        delitem 1011,10; //Emveretarcon
1696                                                        delitem 984,5; //Oridecon
1697                                                        close2;
1698                                                        donpcevent "#sch02_RL02::OnEnable";
1699                                                        disablenpc "Control Device02#sch02";
1700                                                        mapannounce "schg_cas02","The 2nd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
1701                                                        setarray $agit_sc02[3],0; //Global Variable
1702                                                        setarray $agit_sc02[2],2; //Global Variable
1703                                                        donpcevent "Control Device01#sch02::OnEnable";
1704                                                        end;
1705                                                }
1706                                                else {
1707                                                        mes "^3355FFThe wall has been breached,";
1708                                                        mes "and the attempt to repair the";
1709                                                        mes "Fortress Gate has failed.";
1710                                                        mes "You lost some of your";
1711                                                        mes "repair resources...^000000";
1712                                                        delitem 984,2; //Oridecon
1713                                                        delitem 999,4; //Steel
1714                                                        delitem 1019,14; //Wooden_Block
1715                                                        delitem 1011,3; //Emveretarcon
1716                                                        close;
1717                                                }
1718                                        }
1719                                }
1720                                else {
1721                                        mes "^3355FFYou can't attempt to repair";
1722                                        mes "the Fortress Gate if you don't";
1723                                        mes "have all the needed materials.^000000";
1724                                        close;
1725                                }
1726                        }
1727                }
1728        }
1729        end;
1730
1731OnInit:
1732        disablenpc "Control Device02#sch02";
1733        end;
1734
1735OnEnable:
1736        enablenpc "Control Device02#sch02";
1737        end;
1738
1739OnDisable:
1740        disablenpc "Control Device02#sch02";
1741        end;
1742}
1743
1744schg_cas02,159,143,0    script  Control Device03#sch02  111,{
1745        set .@GID, GetCastleData("schg_cas02",1);
1746        if (getcharid(2) == .@GID) {
1747                if (strcharinfo(0) == getguildmaster(.@GID)) {
1748                        if ($agit_sc02[4] == 2) {
1749                                mes "^3355FFDemolished Fortress";
1750                                mes "Gates can be repaired,";
1751                                mes "but you will need to gather";
1752                                mes "the following materials.^000000";
1753                                next;
1754                                mes "^4D4DFF10 Steel^000000,";
1755                                mes "^4D4DFF30 Trunks^000000,";
1756                                mes "^4D4DFF5 Oridecon^000000, and";
1757                                mes "^4D4DFF10 Emveretarcon^000000.";
1758                                next;
1759                                select("Continue");
1760                                if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
1761                                        mes "^3355FFYou will need Trunks to";
1762                                        mes "repair the support frame,";
1763                                        mes "Oridecon to enhance the";
1764                                        mes "gate's endurance, and";
1765                                        mes "Emveretarcon to basically";
1766                                        mes "hold everything together.^000000";
1767                                        next;
1768                                        set .@ro_of01,rand(10,15);
1769                                        while(1) {
1770                                                if (.@ro_of02 == .@ro_of01) {
1771                                                        break;
1772                                                }
1773                                                else {
1774                                                        switch(rand(1,4)) {
1775                                                        case 1:
1776                                                                mes "^3355FFThe support frame";
1777                                                                mes "is badly damaged:";
1778                                                                mes "fixing this part";
1779                                                                mes "is a top priority.^000000";
1780                                                                next;
1781                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1782                                                                case 1:
1783                                                                        mes "^3355FFThe frame has been";
1784                                                                        mes "reinforced with wood.^000000";
1785                                                                        set .@rp_temp,.@rp_temp + 1;
1786                                                                        set .@ro_of02,.@ro_of02 + 1;
1787                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1788                                                                        next;
1789                                                                        break;
1790                                                                case 2:
1791                                                                        mes "^3355FFYou tried using steel,";
1792                                                                        mes "but it's not working very";
1793                                                                        mes "well. You'll have to try";
1794                                                                        mes "something else.^000000";
1795                                                                        close;
1796                                                                case 3:
1797                                                                        mes "^3355FFYou tried using emveretarcon";
1798                                                                        mes "to reinforce the gate, but it's";
1799                                                                        mes "not working well at all.";
1800                                                                        mes "You'll have to start over.^000000";
1801                                                                        close;
1802                                                                case 4:
1803                                                                        mes "^3355FFYou tried using oridecon,";
1804                                                                        mes "but it's not working very";
1805                                                                        mes "well. You'll have to try";
1806                                                                        mes "something else.^000000";
1807                                                                        close;
1808                                                                }
1809                                                                break;
1810                                                        case 2:
1811                                                                mes "^3355FFIt looks like the gate's";
1812                                                                mes "overall endurance needs to";
1813                                                                mes "be reinforced with something.^000000";
1814                                                                next;
1815                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1816                                                                case 1:
1817                                                                        mes "^3355FFYou tried using wood";
1818                                                                        mes "to reinforce the gate.^000000";
1819                                                                        set .@ro_of02,.@ro_of02 + 1;
1820                                                                        next;
1821                                                                        break;
1822                                                                case 2:
1823                                                                        mes "^3355FFYou tried using steel";
1824                                                                        mes "to reinforce the gate, but";
1825                                                                        mes "it's not working well at all.";
1826                                                                        mes "You'll have to start over.^000000";
1827                                                                        close;
1828                                                                case 3:
1829                                                                        mes "^3355FFYou tried using emveretarcon";
1830                                                                        mes "to reinforce the gate, but it's";
1831                                                                        mes "not working well at all.";
1832                                                                        mes "You'll have to start over.^000000";
1833                                                                        close;
1834                                                                case 4:
1835                                                                        mes "^3355FFYou hammered the";
1836                                                                        mes "oridecon: it looks";
1837                                                                        mes "like this will work.^000000";
1838                                                                        set .@rp_temp,.@rp_temp + 1;
1839                                                                        set .@ro_of02,.@ro_of02 + 1;
1840                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1841                                                                        next;
1842                                                                        break;
1843                                                                }
1844                                                                break;
1845                                                        case 3:
1846                                                                mes "^3355FFThe damage to the gate";
1847                                                                mes "has caused all these";
1848                                                                mes "cracks. You'll have to";
1849                                                                mes "weld them solid somehow.^000000";
1850                                                                next;
1851                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1852                                                                case 1:
1853                                                                        mes "^3355FFYou tried using wood to fix";
1854                                                                        mes "this problem, but it seems";
1855                                                                        mes "to have made it worse.";
1856                                                                        mes "You'll have to start all over.^000000";
1857                                                                        close;
1858                                                                case 2:
1859                                                                        mes "^3355FFYou used steel to weld";
1860                                                                        mes "all the cracks: the gate is";
1861                                                                        mes "is starting to look more solid.^000000";
1862                                                                        set .@rp_temp,.@rp_temp + 1;
1863                                                                        set .@ro_of02,.@ro_of02 + 1;
1864                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1865                                                                        next;
1866                                                                        break;
1867                                                                case 3:
1868                                                                        mes "^3355FFYou tried using emveretarcon";
1869                                                                        mes "to reinforce the gate, but it's";
1870                                                                        mes "not working well at all.";
1871                                                                        mes "You'll have to start over.^000000";
1872                                                                        close;
1873                                                                case 4:
1874                                                                        mes "^3355FFYou tried using oridecon,";
1875                                                                        mes "but it's not working very";
1876                                                                        mes "well. You'll have to try";
1877                                                                        mes "something else.^000000";
1878                                                                        close;
1879                                                                }
1880                                                                break;
1881                                                        case 4:
1882                                                                mes "^3355FFNow you need to make";
1883                                                                mes "sure that the gate is held";
1884                                                                mes "together pretty solidly.^000000";
1885                                                                next;
1886                                                                switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
1887                                                                case 1:
1888                                                                        mes "^3355FFYou tried using wood to fix";
1889                                                                        mes "this problem, but it seems";
1890                                                                        mes "to have made it worse.";
1891                                                                        mes "You'll have to start all over.^000000";
1892                                                                        close;
1893                                                                case 2:
1894                                                                        mes "^3355FFYou tried using steel,";
1895                                                                        mes "but it's not working very";
1896                                                                        mes "well. You'll have to try";
1897                                                                        mes "something else.^000000";
1898                                                                        close;
1899                                                                case 3:
1900                                                                        mes "^3355FFYou successfully used";
1901                                                                        mes "the emveretarcon to repair";
1902                                                                        mes "much of the gate's damage.^000000";
1903                                                                        set .@rp_temp,.@rp_temp + 1;
1904                                                                        set .@ro_of02,.@ro_of02 + 1;
1905                                                                        specialeffect2 101; // EF_REPAIRWEAPON
1906                                                                        next;
1907                                                                        break;
1908                                                                case 4:
1909                                                                        mes "^3355FFYou tried using oridecon,";
1910                                                                        mes "but it's not working very";
1911                                                                        mes "well. You'll have to try";
1912                                                                        mes "something else.^000000";
1913                                                                        close;
1914                                                                }
1915                                                        }
1916                                                }
1917                                        }
1918                                        mes "^3355FFWell, it looks like";
1919                                        mes "you're just about done";
1920                                        mes "with repairing the gate.^000000";
1921                                        next;
1922                                        if (agitcheck() == 0) {
1923                                                mes "^3355FFUnfortunately, the Fortress";
1924                                                mes "Gate can't be reconstructed:";
1925                                                mes "the Emperium is no longer here.^000000";
1926                                                close;
1927                                        }
1928                                        else {
1929                                                if (.@rp_temp == .@ro_of01) {
1930                                                        mes "^3355FFThe Fortress Gate has";
1931                                                        mes "been successfully repaired!^000000";
1932                                                        delitem 1019,30; //Wooden_Block
1933                                                        delitem 999,10; //Steel
1934                                                        delitem 1011,10; //Emveretarcon
1935                                                        delitem 984,5; //Oridecon
1936                                                        close2;
1937                                                        donpcevent "#sch02_RL03::OnEnable";
1938                                                        disablenpc "Control Device03#sch02";
1939                                                        mapannounce "schg_cas02","The 3rd Fortress Gate has been reconstructed!!",bc_map,"0x00ff00";
1940                                                        setarray $agit_sc02[4],0;
1941                                                        setarray $agit_sc02[3],2;
1942                                                        donpcevent "Control Device02#sch02::OnDevice02#sch02_dlrp02";
1943                                                        end;
1944                                                }
1945                                                else {
1946                                                        mes "^3355FFThe wall has been breached,";
1947                                                        mes "and the attempt to repair the";
1948                                                        mes "Fortress Gate has failed.";
1949                                                        mes "You lost some of your";
1950                                                        mes "repair resources...^000000";
1951                                                        delitem 984,2; //Oridecon
1952                                                        delitem 999,4; //Steel
1953                                                        delitem 1019,14; //Wooden_Block
1954                                                        delitem 1011,3; //Emveretarcon
1955                                                        close;
1956                                                }
1957                                        }
1958                                }
1959                                else {
1960                                        mes "^3355FFYou can't attempt to repair";
1961                                        mes "the Fortress Gate if you don't";
1962                                        mes "have all the needed materials.^000000";
1963                                        close;
1964                                }
1965                        }
1966                }
1967        }
1968        end;
1969
1970OnInit:
1971        disablenpc "Control Device03#sch02";
1972        end;
1973
1974OnEnable:
1975        enablenpc "Control Device03#sch02";
1976        end;
1977
1978OnDisable:
1979        disablenpc "Control Device03#sch02";
1980        end;
1981}
1982
1983// Link Flags
1984schg_cas02,143,198,0    script  LF-01#schg_cas02        111,{
1985        set .@GID, GetCastleData("schg_cas02",1);
1986        if (getcharid(2) == .@GID) {
1987                mes "^3355FFThis is the Stronghold";
1988                mes "Teleport Service. Please";
1989                mes "choose a destination";
1990                mes "within the stronghold.^000000";
1991                switch(select("First Gate House:Second Gate House:Cancel")) {
1992                case 1:
1993                        warp "schg_cas02",235,44;
1994                        end;
1995                case 2:
1996                        warp "schg_cas02",302,233;
1997                        end;
1998                case 3:
1999                        close;
2000                }
2001        }
2002        end;
2003}
2004
2005schg_cas02,143,202,0    script  LF-02#schg_cas02        111,{
2006        set .@GID, GetCastleData("schg_cas02",1);
2007        if (getcharid(2) == .@GID) {
2008                mes "^3355FFThis is the Stronghold";
2009                mes "Teleport Service. Please";
2010                mes "choose a destination";
2011                mes "within the stronghold.^000000";
2012                switch(select("Defense area 1-1:Defense area 1-2:Cancel")) {
2013                case 1:
2014                        warp "schg_cas02",317,83;
2015                        end;
2016                case 2:
2017                        warp "schg_cas02",359,83;
2018                        end;
2019                case 3:
2020                        close;
2021                }
2022        }
2023        end;
2024}
2025
2026schg_cas02,143,206,0    script  LF-03#schg_cas02        111,{
2027        set .@GID, GetCastleData("schg_cas02",1);
2028        if (getcharid(2) == .@GID) {
2029                mes "^3355FFThis is the Stronghold";
2030                mes "Teleport Service. Please";
2031                mes "choose a destination";
2032                mes "within the stronghold.^000000";
2033                switch(select("Defense area 2-1:Defense area 2-2:Cancel")) {
2034                case 1:
2035                        warp "schg_cas02",283,79;
2036                        end;
2037                case 2:
2038                        warp "schg_cas02",280,122;
2039                        end;
2040                case 3:
2041                        close;
2042                }
2043        }
2044        end;
2045}
2046
2047schg_cas02,145,208,0    script  LF-04#schg_cas02        111,{
2048        set .@GID, GetCastleData("schg_cas02",1);
2049        if (getcharid(2) == .@GID) {
2050                mes "^3355FFThis is the Stronghold";
2051                mes "Teleport Service. Please";
2052                mes "choose a destination";
2053                mes "within the stronghold.^000000";
2054                switch(select("Defense area 3-1:Defense area 3-2:Cancel")) {
2055                case 1:
2056                        warp "schg_cas02",215,110;
2057                        end;
2058                case 2:
2059                        warp "schg_cas02",255,215;
2060                        end;
2061                case 3:
2062                        close;
2063                }
2064        }
2065        end;
2066}
2067
2068schg_cas02,180,208,0    script  LF-05#schg_cas02        111,{
2069        set .@GID, GetCastleData("schg_cas02",1);
2070        if (getcharid(2) == .@GID) {
2071                mes "^3355FFThis is the Stronghold";
2072                mes "Teleport Service. Please";
2073                mes "choose a destination";
2074                mes "within the stronghold.^000000";
2075                switch(select("Center 1 Area:Center 2 Area:Cancel")) {
2076                case 1:
2077                        warp "schg_cas02",338,153;
2078                        end;
2079                case 2:
2080                        warp "schg_cas02",213,226;
2081                        end;
2082                case 3:
2083                        close;
2084                }
2085        }
2086        end;
2087}
2088
2089schg_cas02,182,206,0    script  LF-06#schg_cas02        111,{
2090        set .@GID, GetCastleData("schg_cas02",1);
2091        if (getcharid(2) == .@GID) {
2092                mes "^3355FFThis is the Stronghold";
2093                mes "Teleport Service. Please";
2094                mes "choose a destination";
2095                mes "within the stronghold.^000000";
2096                switch(select("Defense area 1-1:Defense area 2-1:Defense area 3-1:Cancel")) {
2097                case 1:
2098                        warp "schg_cas02",317,83;
2099                        end;
2100                case 2:
2101                        warp "schg_cas02",283,79;
2102                        end;
2103                case 3:
2104                        warp "schg_cas02",215,110;
2105                        end;
2106                case 4:
2107                        close;
2108                }
2109        }
2110        end;
2111}
2112
2113schg_cas02,182,202,0    script  LF-07#schg_cas02        111,{
2114        set .@GID, GetCastleData("schg_cas02",1);
2115        if (getcharid(2) == .@GID) {
2116                mes "^3355FFThis is the Stronghold";
2117                mes "Teleport Service. Please";
2118                mes "choose a destination";
2119                mes "within the stronghold.^000000";
2120                switch(select("Area 1-2:Area 2-2:Area 3-2:Cancel")) {
2121                case 1:
2122                        warp "schg_cas02",359,83;
2123                        end;
2124                case 2:
2125                        warp "schg_cas02",280,122;
2126                        end;
2127                case 3:
2128                        warp "schg_cas02",255,215;
2129                        end;
2130                case 4:
2131                        close;
2132                }
2133        }
2134        end;
2135}
2136
2137schg_cas02,182,198,0    script  LF-08#schg_cas02        111,{
2138        set .@GID, GetCastleData("schg_cas02",1);
2139        if (getcharid(2) == .@GID) {
2140                mes "^3355FFThis is the Stronghold";
2141                mes "Teleport Service. Would";
2142                mes "you like to teleport to the";
2143                mes "Convenience Facility for";
2144                mes "guild members?^000000";
2145                switch(select("Go to Convenience Facility:Cancel")) {
2146                case 1:
2147                        warp "schg_cas02",101,306;
2148                        end;
2149                case 2:
2150                        close;
2151                }
2152        }
2153        end;
2154}
2155
2156schg_cas02,235,222,0    script  Andlangr#LF_sc02_1::LF_sc02_1   111,{
2157        set .@GID, GetCastleData("schg_cas02",1);
2158        if (getcharid(2) == .@GID) {
2159                mes "^3355FFThis is the Stronghold";
2160                mes "Teleport Service. Would";
2161                mes "you like to teleport to";
2162                mes "the Emperium Center?^000000";
2163                switch(select("Teleport:Cancel")) {
2164                case 1:
2165                        warp "schg_cas02",136,188;
2166                        end;
2167                case 2:
2168                        close;
2169                }
2170        }
2171        end;
2172}
2173
2174schg_cas02,157,136,0    duplicate(LF_sc02_1)    Andlangr#LF_sc02_2      111
2175schg_cas02,168,136,4    duplicate(LF_sc02_1)    Andlangr#LF_sc02_3      111
2176schg_cas02,320,232,4    duplicate(LF_sc02_1)    Andlangr#LF_sc02_4      111
2177schg_cas02,295,109,0    duplicate(LF_sc02_1)    Andlangr#LF_sc02_5      111
2178schg_cas02,295,92,0     duplicate(LF_sc02_1)    Andlangr#LF_sc02_6      111
2179schg_cas02,285,90,4     duplicate(LF_sc02_1)    Andlangr#LF_sc02_7      111
2180schg_cas02,285,190,4    duplicate(LF_sc02_1)    Andlangr#LF_sc02_8      111
2181schg_cas02,238,66,0     duplicate(LF_sc02_1)    Andlangr#LF_sc02_9      111
2182schg_cas02,230,45,0     duplicate(LF_sc02_1)    Andlangr#LF_sc02_10     111
2183schg_cas02,233,120,0    duplicate(LF_sc02_1)    Andlangr#LF_sc02_11     111
2184schg_cas02,247,120,0    duplicate(LF_sc02_1)    Andlangr#LF_sc02_12     111
2185schg_cas02,261,162,0    duplicate(LF_sc02_1)    Andlangr#LF_sc02_13     111
2186schg_cas02,244,162,0    duplicate(LF_sc02_1)    Andlangr#LF_sc02_14     111
2187schg_cas02,235,207,0    duplicate(LF_sc02_1)    Andlangr#LF_sc02_15     111
2188
2189// Guild Manager
2190schg_cas02,105,378,3    script  Steward#sch02   55,{
2191        set .@GID, GetCastleData("schg_cas02",1);
2192        if (.@GID == 0) {
2193                mes "[ Steward ]";
2194                mes "I await for the master";
2195                mes "whom destiny will choose";
2196                mes "for me. Do you think you";
2197                mes "have to courage and strength";
2198                mes "to conquer this stronghold?";
2199                close;
2200        }
2201        if (getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)) {
2202                mes "[ Steward ]";
2203                mes "Hmpf. Your threats don't";
2204                mes "scare me! Guardians, drive";
2205                mes "this infidel away from here!";
2206                mes "I will always be loyal to the";
2207                mes "master of this stronghold,";
2208                mes "the one and only ^FF0000" + getguildmaster(.@GID) + "^000000.";
2209                close;
2210        }
2211        mes "[ Steward ]";
2212        mes "Ah, Master ^FF0000" + getguildmaster(.@GID) + "^000000...";
2213        mes "How shall I serve you today?";
2214        mes "Was there an aspect of this";
2215        mes "stronghold's maintenance";
2216        mes "you wanted to discuss?";
2217        next;
2218        switch(select("Stronghold Briefing:Invest in Commercial Growth:Invest in Defense growth:Hire/Fire Storage Staff:Go to Master's room")) {
2219        case 1:
2220                mes "[ Steward ]";
2221                mes "The Commercial Growth";
2222                mes "Level of the stronghold is ^0000ff" + GetCastleData("schg_cas02",2) + ".";
2223                if (GetCastleData("schg_cas02",4) > 0) {
2224                        mes "Last time, you invested in";
2225                        mes "Commercial Growth " + GetCastleData("schg_cas02",4) + ".";
2226                }
2227                next;
2228                mes "[ Steward ]";
2229                mes "Our stronghold's";
2230                mes "safeguard level is " + GetCastleData("schg_cas02",3) + ".";
2231                if (GetCastleData("schg_cas02",5) > 0) {
2232                        mes "Last time, you invested";
2233                        mes "in defense " + GetCastleData("schg_cas02",5) + " times.";
2234                }
2235                mes " ";
2236                mes "That is all, master.";
2237                close;
2238        case 2:
2239                set .@Economy,GetCastleData("schg_cas02",2);
2240                if(.@Economy < 8) set .@eco_invest,10000;
2241                if(.@Economy >= 8) set .@eco_invest,20000;
2242                if(.@Economy >= 16) set .@eco_invest,40000;
2243                if(.@Economy >= 25) set .@eco_invest,80000;
2244                if(.@Economy >= 34) set .@eco_invest,160000;
2245                if(.@Economy >= 44) set .@eco_invest,320000;
2246                if(.@Economy >= 54) set .@eco_invest,640000;
2247                if(.@Economy >= 65) set .@eco_invest,1280000;
2248                if(.@Economy >= 76) set .@eco_invest,2560000;
2249                if(.@Economy >= 88) set .@eco_invest,5120000;
2250                mes "[ Steward ]";
2251                mes "Raising the stronghold's";
2252                mes "commercial growth will";
2253                mes "increase the quantity of";
2254                mes "goods produced for the guild.";
2255                mes "Investing in commercial growth";
2256                mes "will help the guild's future.";
2257                next;
2258                mes "[ Steward ]";
2259                mes "You can make one investment";
2260                mes "each day, but if you can make";
2261                mes "two investments if you pay";
2262                mes "more zeny: this will speed";
2263                mes "up commercial development,";
2264                mes "but can be quite expensive.";
2265                next;
2266                if (.@Economy == 100) {
2267                        mes "[ Steward ]";
2268                        mes "However, our stronghold's";
2269                        mes "commerical growth level is";
2270                        mes "at 100%. It's not possible to";
2271                        mes "develop commercial growth";
2272                        mes "any further than that.";
2273                        close;
2274                }
2275                if (GetCastleData("schg_cas02",4) == 2) {
2276                        mes "[ Steward ]";
2277                        mes "You've already made two";
2278                        mes "investments today, so you'll";
2279                        mes "have to wait until tomorrow";
2280                        mes "to make another investment.";
2281                        close;
2282                }
2283                if (GetCastleData("schg_cas02",4) == 0) {
2284                        mes "[ Steward ]";
2285                        mes "You must pay ^FF0000" + .@eco_invest + "^000000 zeny";
2286                        mes "to make an investment";
2287                        mes "Will you invest in this";
2288                        mes "stronghold's commerical";
2289                        mes "development now?";
2290                }
2291                else {
2292                        mes "[ Steward ]";
2293                        mes "You must pay ^FF0000" + .@eco_invest + "^000000";
2294                        mes "more zeny to make a second";
2295                        mes "investment today. Will you";
2296                        mes "invest one more time?";
2297                }
2298                next;
2299                switch(select("Invest in Commercial Growth:Cancel")) {
2300                case 1:
2301                        if (Zeny < .@eco_invest) {
2302                                mes "[ Steward ]";
2303                                mes "I'm sorry, Master, but";
2304                                mes "you do not have enough";
2305                                mes "zeny to make an investment";
2306                                mes "for the guild today.";
2307                                close;
2308                        }
2309                        set zeny,zeny-.@eco_invest;
2310                        SetCastleData "schg_cas02",4,GetCastleData("schg_cas02",4)+1;
2311                        SetCastleData "schg_cas02",2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
2312                        mes "[ Steward ]";
2313                        mes "A wise use of the guild's";
2314                        mes "funds, Master. We can expect";
2315                        mes "to see the results of this";
2316                        mes "investment by tomorrow.";
2317                        close;
2318                case 2:
2319                        mes "[ Steward ]";
2320                        mes "As you command, Master.";
2321                        close;
2322                }
2323        case 3:
2324                set .@Defence,GetCastleData("schg_cas02",3);
2325                if(.@Defence < 8) set .@def_invest,20000;
2326                if(.@Defence >= 8) set .@def_invest,40000;
2327                if(.@Defence >= 16) set .@def_invest,80000;
2328                if(.@Defence >= 25) set .@def_invest,160000;
2329                if(.@Defence >= 34) set .@def_invest,320000;
2330                if(.@Defence >= 44) set .@def_invest,640000;
2331                if(.@Defence >= 54) set .@def_invest,1280000;
2332                if(.@Defence >= 65) set .@def_invest,2560000;
2333                if(.@Defence >= 76) set .@def_invest,5120000;
2334                if(.@Defence >= 88) set .@def_invest,10240000;
2335                mes "[ Steward ]";
2336                mes "Investing in our stronghold's";
2337                mes "defense will enhance the";
2338                mes "durability of our Guardians";
2339                mes "and the Emperium. We'll need";
2340                mes "every advantage to protect";
2341                mes "ourselves from our enemies.";
2342                next;
2343                mes "[ Steward ]";
2344                mes "You can invest in defense";
2345                mes "once per day, but if you pay";
2346                mes "more zeny, you can invest";
2347                mes "a maximum of two times daily.";
2348                next;
2349                mes "[ Steward ]";
2350                if (GetCastleData("schg_cas02",3) == 100) {
2351                        mes "The Defense Level of this";
2352                        mes "stronghold is 100%, and";
2353                        mes "cannot be increased further.";
2354                        close;
2355                }
2356                if (GetCastleData("schg_cas02",5) == 2) {
2357                        mes "Master, you've already";
2358                        mes "invested in Defense twice";
2359                        mes "today. You'll need to wait";
2360                        mes "until tomorrow if you really";
2361                        mes "want to increase our defenses.";
2362                        close;
2363                }
2364                if (GetCastleData("schg_cas02",5) == 0) {
2365                        mes "We need ^FF0000" + .@def_invest + "^000000";
2366                        mes "zeny to invest in our";
2367                        mes "stronghold's defenses.";
2368                        mes "Will you invest now?";
2369                }
2370                else {
2371                        mes "We need ^FF0000" + .@def_invest + "^000000";
2372                        mes "zeny to invest in our";
2373                        mes "stronghold's defenses";
2374                        mes "a second time today.";
2375                        mes "Will you invest now?";
2376                }
2377                next;
2378                switch(select("Invest in Defense:Cancel")) {
2379                case 1:
2380                        if (Zeny < .@def_invest) {
2381                                mes "[ Steward ]";
2382                                mes "I'm sorry, Master, but";
2383                                mes "you do not have enough";
2384                                mes "zeny to make an investment";
2385                                mes "for the guild today.";
2386                                close;
2387                        }
2388                        set zeny,zeny-.@def_invest;
2389                        SetCastleData "schg_cas02",5,GetCastleData("schg_cas02",5)+1;
2390                        SetCastleData "schg_cas02",3,.@Defence+1;
2391                        mes "[ Steward ]";
2392                        mes "A wise use of the guild's";
2393                        mes "funds, Master. Increasing";
2394                        mes "the frequency of treasure";
2395                        mes "procured by the guild will";
2396                        mes "definitely help us all.";
2397                        close;
2398                case 2:
2399                        mes "[ Steward ]";
2400                        mes "As you command, Master.";
2401                        close;
2402                }
2403        case 4:
2404                if (GetCastleData("schg_cas02",9) == 1) {
2405                        mes "[ Steward ]";
2406                        mes "Do you wish to dismiss";
2407                        mes "the Kafra Employee that";
2408                        mes "we've hired for the guild?";
2409                        next;
2410                        switch(select("Dismiss:Cancel")) {
2411                        case 1:
2412                                cutin "kafra_01",2;
2413                                mes "[ Hired Kafra Employee ]";
2414                                mes "Master, please reconsider!";
2415                                mes "I've been working very hard";
2416                                mes "for the success of the guild!";
2417                                mes "I'll try harder to serve the";
2418                                mes "guild members of this";
2419                                mes "stronghold, I promise!";
2420                                next;
2421                                switch(select("Dismiss:Cancel")) {
2422                                case 1:
2423                                        mes "[ Hired Kafra Employee ]";
2424                                        mes "Why?! What have I done";
2425                                        mes "to deserve this? Waaah~!";
2426                                        next;
2427                                        cutin "kafra_01",255;
2428                                        break;
2429                                case 2:
2430                                        mes "[ Hired Kafra Employee ]";
2431                                        mes "Thank you, Master!";
2432                                        mes "I'll obey your every";
2433                                        mes "command as best I can!";
2434                                        mes "You won't regret this!";
2435                                        close;
2436                                }
2437                                break;
2438                        case 2:
2439                                mes "[ Steward ]";
2440                                mes "She works very hard,";
2441                                mes "in my opinion. It was in";
2442                                mes "all of our best interests to";
2443                                mes "allow her to stay with us.";
2444                                close;
2445                        }
2446                        disablenpc "Kafra Employee#sch02";
2447                        SetCastleData "schg_cas02",9,0;
2448                        mes "[ Steward ]";
2449                        mes "That Kafra Employee";
2450                        mes "has been dismissed.";
2451                        mes "Were really dissatisfied";
2452                        mes "by the quality of her service?";
2453                        close;
2454                }
2455                else {
2456                        mes "[ Steward ]";
2457                        mes "Will you hire a";
2458                        mes "Kafra Employee to serve";
2459                        mes "our stronghold? You must";
2460                        mes "pay ^FF000010,000 zeny^000000 to hire one.";
2461                        next;
2462                        switch(select("Hire:Cancel")) {
2463                        case 1:
2464                                if (getgdskilllv(.@GID,10001) == 0) {
2465                                        mes "[ Steward ]";
2466                                        mes "Master, we cannot hire a";
2467                                        mes "Kafra Employee because";
2468                                        mes "you have not yet attained";
2469                                        mes "the ^FF0000Contract with Kafra^000000";
2470                                        mes "guild skill.";
2471                                        close;
2472                                }
2473                                if (Zeny < 10000) {
2474                                        mes "[ Steward ]";
2475                                        mes "Master, we cannot hire a";
2476                                        mes "Kafra Employee because";
2477                                        mes "we do not have enough";
2478                                        mes "funds to pay the contract fee.";
2479                                        close;
2480                                }
2481                                set zeny,zeny-10000;
2482                                enablenpc "Kafra Employee#sch02";
2483                                SetCastleData "schg_cas02",9,1;
2484                                mes "[ Steward ]";
2485                                mes "Very well. We have formed";
2486                                mes "a contract with the Kafra";
2487                                mes "Head Office, and hired a";
2488                                mes "Kafra Employee for our";
2489                                mes "stronghold. Here she is~";
2490                                next;
2491                                cutin "kafra_01",2;
2492                                mes "[ Hired Kafra Employee ]";
2493                                mes "How do you do? I've";
2494                                mes "been dispatched by the";
2495                                mes "Kafra Head Office to";
2496                                mes "serve your guild's needs.";
2497                                mes "I'll do my best to follow";
2498                                mes "your every command, Master.";
2499                                next;
2500                                cutin "kafra_01",255;
2501                                mes "[ Steward ]";
2502                                mes "Our contract will expire";
2503                                mes "after one month, so we must";
2504                                mes "pay additional fees to keep";
2505                                mes "this Kafra Employee in";
2506                                mes "the service of our guild.";
2507                                close;
2508                        case 2:
2509                                mes "[ Steward ]";
2510                                mes "As you command, Master.";
2511                                mes "However, I suggest hiring";
2512                                mes "a Kafra Employee as soon";
2513                                mes "as possible since our guild";
2514                                mes "would greatly benefit from";
2515                                mes "the convenient Kafra services.";
2516                                close;
2517                        }
2518                }
2519        case 5:
2520                mes "[ Steward ]";
2521                mes "Do you wish to enter the";
2522                mes "Guild Treasure Room?";
2523                mes "Only you, the Guild Master,";
2524                mes "are permitted to enter.";
2525                next;
2526                mes "[ Steward ]";
2527                mes "Please remember to open";
2528                mes "the Treasure Boxes at the";
2529                mes "proper time. Otherwise, the";
2530                mes "treasure may disappear if";
2531                mes "something unexpected happens.";
2532                next;
2533                switch(select("Go to Treasure Room:Cancel")) {
2534                case 1:
2535                        mes "[ Steward ]";
2536                        mes "Allow me to guide you";
2537                        mes "on the secret path to";
2538                        mes "the Treasure Room.";
2539                        mes "Press the secret switch";
2540                        mes "when you wish to return here.";
2541                        close2;
2542                        warp "schg_cas02",249,373;
2543                        end;
2544                case 2:
2545                        mes "[ Steward ]";
2546                        mes "Items in the Treasure Room";
2547                        mes "are produced once each day.";
2548                        mes "Therefore, you must obtain";
2549                        mes "the treasure items everyday.";
2550                        mes "For the sake of the guild,";
2551                        mes "prioritize treasure harvesting!";
2552                        close;
2553                }
2554        }
2555
2556Onstop:
2557        stopnpctimer;
2558        end;
2559
2560OnStartArena:
2561        set .@GID,getcharid(2);
2562        // Lower castle Economy
2563        set .@Economy,GetCastleData("schg_cas02",2) - 5;
2564        if (.@Economy < 0) set .@Economy, 0;
2565        SetCastleData "schg_cas02", 2, .@Economy;
2566        // Lower Castle Defence
2567        set .@Defence,GetCastleData("schg_cas02",3) - 5;
2568        if (.@Defence < 0) set .@Defence, 0;
2569        SetCastleData "schg_cas02", 3, .@Defence;
2570        // Set new owner
2571        SetCastleData "schg_cas02",1, .@GID;
2572        // Clear castle's data.
2573        for( set .@i, 4; .@i <= 9; set .@i, .@i+1 )
2574                SetCastleData "schg_cas02", .@i, 0;
2575        // Disable Kafra
2576        disablenpc "Kafra Employee#sch02";
2577
2578        set .msg,2;
2579        if (.msg == 1) {
2580                announce "Fortress [" + GetCastleName("schg_cas02") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
2581                donpcevent "Manager#sch02_02::Onstart";
2582        }
2583        else if (.msg == 2) {
2584                announce "The [" + getguildname(.@gid) + "] conquered the [Nithafjoll 2] stronghold of "+GetCastleName("schg_cas02"),bc_all;
2585                mapannounce "schg_cas02","The emperium has been shattered!",bc_map,"0x00FF00";
2586                if (agitcheck()) {
2587                        donpcevent "Manager#sch02_02::Onreset";
2588                        initnpctimer;
2589                }
2590                else {
2591                        donpcevent "Manager#sch02_02::Onreset";
2592                        stopnpctimer;
2593                }
2594        }
2595        else if (.msg == 0) {
2596                announce "Fortress [" + GetCastleName("schg_cas02") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
2597                donpcevent "Manager#sch02_02::Onreset";
2598                stopnpctimer;
2599                end;
2600        }
2601        MapRespawnGuildID "schg_cas02",GetCastleData("schg_cas02",1),2;
2602        GetCastleData "schg_cas02",0,"::OnRecvCastlesc02";
2603        end;
2604
2605OnTimer10000:
2606        donpcevent "Manager#sch02_02::Onchange";
2607        mapannounce "schg_cas02","Rebuild this stonghold's Guardian Stones and Fortress Gates to secure your guild's new aquisition!",bc_map,"0x00FF00";
2608        end;
2609}
2610
2611// Guild Kafra
2612schg_cas02,131,365,3    script  Kafra Employee#sch02    117,{
2613        cutin "kafra_01",2;
2614        set .@GID, GetCastleData("schg_cas02",1);
2615        if (getcharid(2) == .@GID && getgdskilllv(.@GID,10001)) {
2616                mes "[Kafra Employee]";
2617                mes "Welcome, proud member";
2618                mes "of the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild!";
2619                mes "The Kafra Corporation is ready";
2620                mes "to assist you wherever you go!";
2621                next;
2622                switch(select("Use Storage:Use Warp Service:Rent Pushcart:Cancel")) {
2623                case 1:
2624                        if (basicskillcheck() && getskilllv("NV_BASIC") < 6) {
2625                                mes "[Kafra Employee]";
2626                                mes "I'm so sorry, but you must";
2627                                mes "have at least Novice Skill";
2628                                mes "Lv.6 to use the Storage.";
2629                        }
2630                        else {
2631                                openstorage;
2632                        }
2633                        break;
2634                case 2:
2635                        mes "[Kafra Employee]";
2636                        mes "Please tell me your";
2637                        mes "Warp destination.";
2638                        next;
2639                        switch(select("Juno -> 200 z:Cancel")) {
2640                        case 1:
2641                                if (Zeny < 200) {
2642                                        mes "[Kafra Employee]";
2643                                        mes "I'm sorry, but you don't";
2644                                        mes "have enough zeny to pay";
2645                                        mes "the warp fee. Would you";
2646                                        mes "please check your funds again?";
2647                                        close2;
2648                                        cutin "kafra_01",255;
2649                                        end;
2650                                }
2651                                set zeny,zeny-200;
2652                                warp "yuno",158,125;
2653                                end;
2654                        case 2:
2655                                cutin "kafra_01",255;
2656                        }
2657                        break;
2658                case 3:
2659                        if (BaseClass != Job_Merchant) {
2660                                mes "[Kafra Employee]";
2661                                mes "I'm sorry, but the Pushcart";
2662                                mes "rental service can only be";
2663                                mes "used by Merchant, Blacksmith,";
2664                                mes "and Alchemist class characters.";
2665                        }
2666                        else if (checkcart() == 1) {
2667                                mes "[Kafra Employee]";
2668                                mes "Hm? You've already";
2669                                mes "rented a Pushcart.";
2670                        }
2671                        else {
2672                                mes "[Kafra Employee]";
2673                                mes "The Pushcart rental fee";
2674                                mes "is 800 zeny. Would you";
2675                                mes "like to rent a Pushcart?";
2676                                next;
2677                                switch(select("Rent Pushcart:Cancel")) {
2678                                case 1:
2679                                        if (Zeny < 800) {
2680                                                mes "[Kafra Employee]";
2681                                                mes "I'm sorry, but you don't";
2682                                                mes "have enough zeny to rent";
2683                                                mes "one of our Pushcarts.";
2684                                                close2;
2685                                                cutin "kafra_01",255;
2686                                                end;
2687                                        }
2688                                        set zeny,zeny-800;
2689                                        setcart;
2690                                        break;
2691                                case 2:
2692                                        break;
2693                                }
2694                        }
2695                        break;
2696                case 4:
2697                        mes "[Kafra Employee]";
2698                        mes "Thank you for using the";
2699                        mes "Kafra Service. Wherever";
2700                        mes "you go, Kafra will be";
2701                        mes "there to support you!";
2702                        close2;
2703                        cutin "kafra_01",255;
2704                        end;
2705                }
2706                close2;
2707                cutin "kafra_01",255;
2708                end;
2709        }
2710        else {
2711                mes "[Kafra Employee]";
2712                mes "I'm sorry, but I've been";
2713                mes "exclusively contracted";
2714                mes "to the members of the";
2715                mes "^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
2716                mes "You'll have to ask another";
2717                mes "Kafra Employee to help you...";
2718                close2;
2719                cutin "kafra_01",255;
2720                end;
2721        }
2722
2723OnRecvCastlesc02:
2724        if (GetCastleData("schg_cas02",1) == 0) {
2725                monster "schg_cas02",0,0,"Evil Druid",1117,10;
2726                monster "schg_cas02",0,0,"Khalitzburg",1132,4;
2727                monster "schg_cas02",0,0,"Abysmal Knight",1219,3;
2728                monster "schg_cas02",0,0,"Executioner",1205,1;
2729                monster "schg_cas02",0,0,"Penomena",1216,10;
2730                monster "schg_cas02",0,0,"Alarm",1193,18;
2731                monster "schg_cas02",0,0,"Clock",1269,9;
2732                monster "schg_cas02",0,0,"Raydric Archer",1276,12;
2733                monster "schg_cas02",0,0,"Wanderer",1208,3;
2734                monster "schg_cas02",0,0,"Alice",1275,1;
2735                monster "schg_cas02",0,0,"Bloody Knight",1268,2;
2736                monster "schg_cas02",0,0,"Dark Lord",1272,2;
2737                monster "schg_cas02",0,0,"Tower Keeper",1270,4;
2738        }
2739        if (GetCastleData("schg_cas02",9) < 1) {
2740                disablenpc "Kafra Employee#sch02";
2741        }
2742        end;
2743}
2744
2745schg_cas02,257,369,0    script  #sc02_switch    111,{
2746        mes " ";
2747        mes "^3355FFWill you pull";
2748        mes "this small lever?^000000";
2749        next;
2750        switch(select("Pull Lever:Cancel")) {
2751        case 1:
2752                warp "schg_cas02",339,79;
2753                end;
2754        case 2:
2755                close;
2756        }
2757}
2758
2759sch_gld,296,247,4       script  Andlangr#flag_sc02_1::Sc02_Flag 722,{
2760        set .@GID, GetCastleData("schg_cas02",1);
2761        if (.@GID == 0) {
2762                mes "[ Schwaltzvalt Royal Edict ]";
2763                mes "The Holy Kingdom of";
2764                mes "Schwaltzvalt declares that";
2765                mes "one has yet to claim lordship";
2766                mes "over this stronghold. The one";
2767                mes "that breaks the Emperium will";
2768                mes "be recognized as its new owner.";
2769                close;
2770        }
2771        else {
2772                if (getcharid(2) == .@GID) {
2773                        mes "[ Ringing Voice ]";
2774                        mes "Courageous one,";
2775                        mes "do you wish to return";
2776                        mes "to your stronghold?";
2777                        next;
2778                        switch(select("Return to the Stronghold:Cancel")) {
2779                        case 1:
2780                                set .@GID, GetCastleData("schg_cas02",1);
2781                                if (getcharid(2) == .@GID) {
2782                                        warp "schg_cas02",136,188;
2783                                        end;
2784                                }
2785                                close;
2786                        case 2:
2787                                close;
2788                        }
2789                }
2790                mes "[ Schwaltzvalt Royal Edict ]";
2791                mes "The Holy Kingdom of";
2792                mes "Schwaltzvalt decrees that";
2793                mes "this stronghold is owned";
2794                mes "by the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
2795                next;
2796                mes "[ Schwaltzvalt Royal Edict ]";
2797                mes "^FF0000" + GetGuildMaster(.@GID) + "^000000 is";
2798                mes "Guild Master of ^FF0000" + GetGuildName(.@GID) + "^000000.";
2799                mes "Any that object must claim this";
2800                mes "stronghold through strength of";
2801                mes "steel and magic during the";
2802                mes "appointed Guild Siege times.";
2803                close;
2804        }
2805
2806OnRecvCastlesc02:
2807        FlagEmblem GetCastleData("schg_cas02",1);
2808        end;
2809}
2810
2811sch_gld,280,247,4       duplicate(Sc02_Flag)    Andlangr#flag_sc02_2    722
Note: See TracBrowser for help on using the browser.