Browse Source

Added the Schwaltzvalt Guild Castles 1-5. (update 3/3)

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12532 54d463be-8e91-2dee-dedb-b68131a5f0ec
L0ne_W0lf 17 năm trước cách đây
mục cha
commit
06775a7179

+ 1 - 0
npc/Changelog.txt

@@ -1,6 +1,7 @@
 Date		Added
 ======
 2008/04/07
+	* Rev. 12531 Added the Schwaltzvalt Guild Castles 1-5. (update 3/3) [L0ne_W0lf]
 	* Rev. 12531 Added the Arunafeltz Guild Castles 1-5. (update 2/3) [L0ne_W0lf]
 	* Rev. 12530 Added new town guild flags in Rachel and Juno. (update 1/3) [L0ne_W0lf]
 2008/04/05

+ 2868 - 0
npc/guild2/schg_cas01.txt

@@ -0,0 +1,2868 @@
+//===== eAthena Script =======================================
+//= War of Emperium Second Edition
+//===== By: ==================================================
+//= L0ne_W0lf
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= eAthena SVN
+//===== Description: =========================================
+//= WoE SE Schwaltzvalt Castle 1
+//===== Additional Comments: =================================
+//= 1.0 First Version [L0ne_W0lf]
+//============================================================
+
+schg_cas01,1,1,0	script	Manager#sch01_02	111,{
+	end;
+
+OnInterIfInitOnce:
+	GetCastleData "schg_cas01",0,"::OnRecvCastleSc01";
+	end;
+
+OnRecvCastleSc01:
+	RequestGuildInfo GetCastleData("schg_cas01",1);
+	if (GetCastleData("schg_cas01",1) == 0) {
+		donpcevent "Manager#sch01_02::Onstart";
+	}
+	end;
+
+OnAgitStart:
+	if (agitcheck()) {
+		MapRespawnGuildID "schg_cas01",GetCastleData("schg_cas01",1),2;
+		GvgOn "schg_cas01";
+		donpcevent "Manager#sch01_02::Onstart";
+	}
+	else {
+		donpcevent "#sch01_RL00::OnDisable";
+		donpcevent "#sch01_RL01::OnDisable";
+		donpcevent "#sch01_RL02::OnDisable";
+		donpcevent "#sch01_RL03::OnDisable";
+	}
+	end;
+
+OnAgitEnd:
+	GvgOff "schg_cas01";
+	if (GetCastleData("schg_cas01",1)) {
+		KillMonster "schg_cas01","Steward#sch01::OnStartArena";
+		donpcevent "Manager#sch01_02::Onreset";
+	}
+	end;
+
+Onstart:
+	// 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians
+	// Settings for all but Summon Guardians
+	// 0 = Okay; 1 = Destroyed; 2 = Repairing
+	// Summon Guardians
+	// 0 = Do not Summon; 1 = Summon
+	if (GetCastleData("schg_cas01",1)) {
+		setarray $agit_sc01[0],0,0,0,0,0,0;
+		donpcevent "#sch01_df01::OnEnable";
+		donpcevent "#sch01_df02::OnEnable";
+		donpcevent "#sch01_RL00::OnEnable";
+		donpcevent "#sch01_RL01::OnEnable";
+		donpcevent "#sch01_RL02::OnEnable";
+		donpcevent "#sch01_RL03::OnEnable";
+	}
+	monster "schg_cas01",120,272,"Emperium",1288,1,"Steward#sch01::OnStartArena";
+	end;
+
+Onreset:
+	donpcevent "#sch01_df01::OnDisable";
+	donpcevent "#sch01_df02::OnDisable";
+	donpcevent "#sch01_gard01::Onreset";
+	donpcevent "#sch01_gard02::Onreset";
+	donpcevent "#sch01_RL00::OnDisable";
+	donpcevent "#sch01_RL01::OnDisable";
+	donpcevent "#sch01_RL02::OnDisable";
+	donpcevent "#sch01_RL03::OnDisable";
+	donpcevent "1st Guardian Stone#sch01::OnDisable";
+	donpcevent "2nd Guardian Stone#sch01::OnDisable";
+	donpcevent "Control Device01#sch01::OnDisable";
+	donpcevent "Control Device02#sch01::OnDisable";
+	donpcevent "Control Device03#sch01::OnDisable";
+	if (agitcheck()) {
+		setarray $agit_sc01[0],0,0,1,1,1,0;
+	}
+	end;
+
+Onchange:
+	setarray $agit_sc01[0],2,2,1,1,2,0;
+	monster "schg_cas01",120,272,"Emperium",1288,1,"Steward#sch01::OnStartArena";
+	donpcevent "Control Device03#sch01::OnEnable";
+	donpcevent "1st Guardian Stone#sch01::OnEnable";
+	donpcevent "2nd Guardian Stone#sch01::OnEnable";
+	end;
+
+OnClock0001:
+	set .@Treasure,GetCastleData("schg_cas01",2)/5+4;
+	if (.@Treasure) {
+		monster "schg_cas01",388,388,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 2) end;
+		monster "schg_cas01",388,389,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 3) end;
+		monster "schg_cas01",388,390,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 4) end;
+		monster "schg_cas01",387,390,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 5) end;
+		monster "schg_cas01",386,390,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 6) end;
+		monster "schg_cas01",385,390,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 7) end;
+		monster "schg_cas01",384,389,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 8) end;
+		monster "schg_cas01",384,388,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 9) end;
+		monster "schg_cas01",384,387,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 10) end;
+		monster "schg_cas01",384,386,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 11) end;
+		monster "schg_cas01",384,385,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 12) end;
+		monster "schg_cas01",384,384,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 13) end;
+		monster "schg_cas01",385,384,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 14) end;
+		monster "schg_cas01",386,384,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 15) end;
+		monster "schg_cas01",387,384,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 16) end;
+		monster "schg_cas01",388,384,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 17) end;
+		monster "schg_cas01",389,384,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 18) end;
+		monster "schg_cas01",390,384,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 19) end;
+		monster "schg_cas01",390,385,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 20) end;
+		monster "schg_cas01",390,386,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 21) end;
+		monster "schg_cas01",389,386,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 22) end;
+		monster "schg_cas01",388,386,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 23) end;
+		monster "schg_cas01",387,286,"Treasure Chest",1938,1,"Manager#sch01_02::OnTreasureDied";
+		if (.@Treasure < 24) end;
+		monster "schg_cas01",386,386,"Treasure Chest",1324,1,"Manager#sch01_02::OnTreasureDied";
+	}
+	end;
+
+OnTreasureDied:
+	end;
+}
+
+schg_cas01,123,306,3	script	Ef#sch01_01	868,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (.@GID == 0) {
+		mes "[Ef]";
+		mes "Great job. Now, all you";
+		mes "need to do is destroy this";
+		mes "Emperium to gain ownership";
+		mes "over this stronghold.";
+		close;
+	}
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) != getguildmaster(.@GID)) {
+			mes "[Ef]";
+			mes "As guardian of this";
+			mes "stronghold, I answer only";
+			mes "to the master of the guild";
+			mes "that controls this place.";
+			close;
+		}
+		else {
+			if (agitcheck() == 0) {
+				mes "[Ef]";
+				mes "I am Ef, guardian of";
+				mes "this stronghold. For now,";
+				mes "all is quiet in this place.";
+				next;
+				switch(select("Converse:Cancel")) {
+				case 1:
+					mes "[Ef]";
+					mes "Do you have any questions";
+					mes "about this stronghold?";
+					next;
+					switch(select("Guardian Stones:Fortress Gates:Link Flags:Battle Strategy:Cancel")) {
+					case 1:
+						mes "[Ef]";
+						mes "There is one Emperium";
+						mes "and two Guardian Stones in";
+						mes "each fortress. These stones";
+						mes "are the first line of defense,";
+						mes "and must be destroyed before";
+						mes "enemies can even enter.";
+						next;
+						mes "[Ef]";
+						mes "The stones are located in";
+						mes "^4D4DFFGate Houses^000000 which must be";
+						mes "protected to prevent enemies";
+						mes "from reaching the Emperium.";
+						mes "Guardian Stones can ^4D4DFFrecall";
+						mes "your Guardians^000000 for protection.";
+						next;
+						mes "[Ef]";
+						mes "Fortresses with higher levels";
+						mes "of defense can summon more";
+						mes "Guardians: this is why it is";
+						mes "so important for guilds to";
+						mes "invest in Defense Growth.";
+						next;
+						mes "[Ef]";
+						mes "Guardian Stones that have";
+						mes "been destroyed can be revived";
+						mes "after a certain time, but one of^FFFFFF ^000000 the guild members must give";
+						mes "me the order. I can also report^FFFFFF ^000000 the status of the Guardian Stones.";
+						close;
+					case 2:
+						mes "[Ef]";
+						mes "^4D4DFFFortress Gates^000000 are the second ^FFFFFF ^000000 line of guild stronghold defense,";
+						mes "and are protected by extra barricades activated by the Guardian Stones.";
+						mes "These gates are located in three different parts of the fortress.";
+						next;
+						mes "[Ef]";
+						mes "Barricades are protected by";
+						mes "Guardian Stones, and are";
+						mes "restored when the Guardian";
+						mes "Stones are retrieved. However,";
+						mes "it is not as easy to restore";
+						mes "destroyed Fortress Gates.";
+						next;
+						mes "[Ef]";
+						mes "Fortress Gates can only be";
+						mes "restored when the ^4D4DFFguild";
+						mes "master of a stronghold";
+						mes "changes^000000, or if ^4D4DFFrestoration";
+						mes "is requested by the guild";
+						mes "master of the stronghold^000000.";
+						close;
+					case 3:
+						mes "[Ef]";
+						mes "Strongholds have many";
+						mes "Link Flags that allow you";
+						mes "to access vital areas within";
+						mes "restrictions placed by the";
+						mes "Barricades. Usually, ^4D4DFFFlag 1";
+						mes "links to the Gate House^000000.";
+						next;
+						mes "[Ef]";
+						mes "Many flags link directly to";
+						mes "the flag near the Emperium.";
+						mes "The final numbered flag is";
+						mes "linked to the Convenience";
+						mes "Facility of the stronghold's";
+						mes "owner. Keep this in mind.";
+						close;
+					case 4:
+						mes "[Ef]";
+						mes "Strategy? It would be better";
+						mes "to develop your battle plan to";
+						mes "exploit your guild's advantages";
+						mes "and your enemies' weaknesses.";
+						mes "Use the Gate Houses and Barricades, and rebuild as quickly as you can!";
+						close;
+					case 5:
+						mes "[Ef]";
+						mes "You have no questions";
+						mes "to ask of me? Well, I'm";
+						mes "here to serve your needs.";
+						close;
+					}
+				case 2:
+					mes "[Ef]";
+					mes "I'm always here, so";
+					mes "feel free to request my";
+					mes "assistance whenever";
+					mes "the need arises.";
+					close;
+				}
+			}
+			else {
+				mes "[Ef]";
+				mes "Greetings, "+strcharinfo(0)+".";
+				mes "What are your orders?";
+				next;
+				switch(select("Increase Stronghold Defense:Situational Briefing:Cancel")) {
+				case 1:
+					if ($agit_sc01[5] == 0) {
+						if (getgdskilllv(.@GID,10002) == 0) {
+							mes "[Ef]";
+							mes "I'm sorry, but the Guardian";
+							mes "Stones aren't powerful enough";
+							mes "to summon Guardians yet. We";
+							mes "need to accumulate more";
+							mes "knowledge before they can";
+							mes "summon any Guardians.";
+							close;
+						}
+						else {
+							mes "[Ef]";
+							mes "I shall endeavor to summon";
+							mes "a Guardian through a Guardian";
+							mes "Stone. However, keep in mind";
+							mes "that this will not work if the";
+							mes "Guardian Stone is destroyed.";
+							setarray $agit_sc01[5],1;
+							if ($agit_sc01[0] == 0) {
+								donpcevent "#sch01_gard01::OnEnable";
+							}
+							if ($agit_sc01[1] == 0) {
+								donpcevent "#sch01_gard02::OnEnable";
+							}
+							close;
+						}
+					}
+					else {
+						mes "[Ef]";
+						mes "You've already commanded";
+						mes "me to summon a Guardian";
+						mes "to defend the stronghold.";
+						close;
+					}
+				case 2:
+					mes "[Ef]";
+					mes "Our defense status is...";
+					if ($agit_sc01[0] == 1) {
+						mes "1st Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc01[0] == 2) {
+						mes "1st Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc01[1] == 1) {
+						mes "2nd Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc01[1] == 2) {
+						mes "2nd Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc01[2] == 1) {
+						mes "1st Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc01[2] == 2) {
+						mes "1st Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc01[3] == 1) {
+						mes "2nd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc01[3] == 2) {
+						mes "2nd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc01[4] == 1) {
+						mes "3rd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc01[4] == 2) {
+						mes "3rd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "3rd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					close;
+				case 3:
+					mes "[Ef]";
+					mes "I'll be standing by,";
+					mes "awaiting your orders.";
+					close;
+				}
+			}
+		}
+	}
+	else {
+		mes "[Ef]";
+		mes "Who are you? Scoundrel!";
+		mes "Leave this stronghold now!";
+		close;
+	}
+
+OnInit:
+	setarray $agit_sc01[0],0,0,0,0,0,0;
+	end;
+}
+
+schg_cas01,1,1,0	script	#sch01_gard01	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas01",3);
+	guardian "schg_cas01",111,18,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //0;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas01",109,44,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //1;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas01",109,44,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas01",65,22,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //2;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas01",109,44,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas01",65,22,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas01",110,40,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //3;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas01",109,44,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas01",65,22,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas01",110,40,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //3;
+		guardian "schg_cas01",88,20,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //4;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas01",108,32,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //1;
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",64,40,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //5;
+	mapannounce "schg_cas01","The 1st Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",47,43,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //6;
+	mapannounce "schg_cas01","The 2nd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer1800000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",109,48,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //7;
+	mapannounce "schg_cas01","The 3rd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer2700000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",111,18,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //8;
+	mapannounce "schg_cas01","The 4th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer3600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",112,32,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //9;
+	mapannounce "schg_cas01","The 5th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas01",120,37,"Guardian Soldier",1899,"#sch01_gard01::OnGuardianDied"; //10;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas01","#sch01_gard01::OnGuardianDied";
+	end;
+}
+
+schg_cas01,1,2,0	script	#sch01_gard02	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas01",3);
+	guardian "schg_cas01",130,22,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //11;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas01",187,15,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //12;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas01",129,47,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas01",151,18,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //13;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas01",129,47,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas01",151,18,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas01",187,15,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //14;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas01",129,47,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas01",151,18,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas01",187,15,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //14;
+		guardian "schg_cas01",128,42,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //15;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas01",128,42,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //12;
+	}
+	initnpctimer;
+	end;
+
+OnTimer600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",152,43,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //16;
+	end;
+
+OnTimer1200000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",187,15,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //17;
+	end;
+
+OnTimer2100000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",128,42,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //18;
+	end;
+
+OnTimer3000000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",130,22,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //19;
+	end;
+
+OnTimer3900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas01",130,28,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //20;
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas01",151,18,"Guardian Soldier",1899,"#sch01_gard02::OnGuardianDied"; //21;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas01","#sch01_gard02::OnGuardianDied";
+	end;
+}
+
+schg_cas01,1,3,0	script	#sch01_df01	-1,{
+OnEnable:
+	guardian "schg_cas01",27,35,"1st Guardian Stone",1907,"#sch01_df01::OnGuardianStoneDied"; //22;
+	end;
+
+OnDisable:
+	killmonster "schg_cas01","#sch01_df01::OnGuardianStoneDied";
+	setarray $agit_sc01[0],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 1st Guardian Stone is Destroyed
+	setarray $agit_sc01[0],1;
+	if (($agit_sc01[0] == 1) || ($agit_sc01[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc01[1] == 1) || ($agit_sc01[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas01","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch01_RL00::OnDisable";
+		donpcevent "#sch01_gard01::Onreset";
+	}
+	else {
+		mapannounce "schg_cas01","The 1st Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch01_gard01::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "1st Guardian Stone#sch01::OnEnable";
+	setarray $agit_sc01[0],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas01,27,36,0	script	1st Guardian Stone#sch01	844,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"1st Guardian Stone#sch01" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch01" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"1st Guardian Stone#sch01" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch01" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 3:
+							specialeffect 56; //"1st Guardian Stone#sch01" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch01" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc01[0] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "already completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch01_df01::OnEnable";
+							specialeffect 135; //"1st Guardian Stone#sch01" EF_ICECRASH
+							disablenpc "1st Guardian Stone#sch01";
+							setarray $agit_sc01[0],0;
+							set .@df_all,$agit_sc01[0]+$agit_sc01[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas01","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch01_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas01","The 1st Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc01[5] == 1) {
+								donpcevent "#sch01_gard01::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "1st Guardian Stone#sch01";
+	end;
+
+OnEnable:
+	enablenpc "1st Guardian Stone#sch01";
+	specialeffect 247; //"1st Guardian Stone#sch01" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "1st Guardian Stone#sch01";
+	end;
+}
+
+schg_cas01,1,4,0	script	#sch01_df02	-1,{
+OnEnable:
+	guardian "schg_cas01",207,75,"2nd Guardian Stone",1908,"#sch01_df02::OnGuardianStoneDied"; //23;
+	end;
+
+OnDisable:
+	killmonster "schg_cas01","#sch01_df02::OnGuardianStoneDied";
+	setarray $agit_sc01[1],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 2nd Guardian Stone is Destroyed
+	setarray $agit_sc01[1],1;
+	if (($agit_sc01[0] == 1) || ($agit_sc01[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc01[1] == 1) || ($agit_sc01[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas01","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch01_RL00::OnDisable";
+		donpcevent "#sch01_gard02::Onreset";
+	}
+	else {
+		mapannounce "schg_cas01","The 2nd Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch01_gard02::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "2nd Guardian Stone#sch01::OnEnable";
+	setarray $agit_sc01[1],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas01,208,75,0	script	2nd Guardian Stone#sch01	844,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"2nd Guardian Stone#sch01" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch01" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"2nd Guardian Stone#sch01" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch01" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 3:
+							specialeffect 56; //"2nd Guardian Stone#sch01" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch01" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc01[1] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "successfully completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch01_df02::OnEnable";
+							specialeffect 135; //"2nd Guardian Stone#sch01" EF_ICECRASH
+							disablenpc "2nd Guardian Stone#sch01";
+							setarray $agit_sc01[1],0;
+							set .@df_all,$agit_sc01[0]+$agit_sc01[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas01","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch01_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas01","The 2nd Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc01[5] == 1) {
+								donpcevent "#sch01_gard02::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "2nd Guardian Stone#sch01";
+	end;
+
+OnEnable:
+	enablenpc "2nd Guardian Stone#sch01";
+	specialeffect 247; //"2nd Guardian Stone#sch01" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "2nd Guardian Stone#sch01";
+	end;
+}
+
+// Barrier Summoners
+schg_cas01,2,1,0	script	#sch01_RL00	-1,{
+OnEnable:
+	setcell "schg_cas01",114,48,126,48,cell_walkable,0;
+	setcell "schg_cas01",114,48,126,48,cell_shootable,0;
+	guardian "schg_cas01",115,49," ",1905,"#sch01_RL00::OnBarrierDestroyed"; //24;
+	guardian "schg_cas01",117,49," ",1905,"#sch01_RL00::OnBarrierDestroyed"; //25;
+	guardian "schg_cas01",119,49," ",1905,"#sch01_RL00::OnBarrierDestroyed"; //26;
+	guardian "schg_cas01",121,49," ",1905,"#sch01_RL00::OnBarrierDestroyed"; //27;
+	guardian "schg_cas01",123,49," ",1905,"#sch01_RL00::OnBarrierDestroyed"; //28;
+	guardian "schg_cas01",125,49," ",1905,"#sch01_RL00::OnBarrierDestroyed"; //29;
+	end;
+
+OnDisable:
+	setcell "schg_cas01",114,48,126,48,cell_walkable,1;
+	setcell "schg_cas01",114,48,126,48,cell_shootable,1;
+	killmonster "schg_cas01","#sch01_RL00::OnBarrierDestroyed";
+	end;
+
+OnBarrierDestroyed:
+	end;
+}
+
+schg_cas01,2,2,0	script	#sch01_RL01	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas01",114,51,126,51,cell_walkable,0;
+	guardian "schg_cas01",115,50," ",1905,"#sch01_RL01::OnBarrierDestroyed"; //30;
+	guardian "schg_cas01",117,50," ",1905,"#sch01_RL01::OnBarrierDestroyed"; //31;
+	guardian "schg_cas01",119,50," ",1905,"#sch01_RL01::OnBarrierDestroyed"; //32;
+	guardian "schg_cas01",121,50," ",1905,"#sch01_RL01::OnBarrierDestroyed"; //33;
+	guardian "schg_cas01",123,50," ",1905,"#sch01_RL01::OnBarrierDestroyed"; //34;
+	guardian "schg_cas01",125,50," ",1905,"#sch01_RL01::OnBarrierDestroyed"; //35;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc01[2],1;
+		mapannounce "schg_cas01","The 1st Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas01",114,51,126,51,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas01",114,51,126,51,cell_walkable,1;
+	killmonster "schg_cas01","#sch01_RL01::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas01,2,3,0	script	#sch01_RL02	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas01",114,154,126,154,cell_walkable,0;
+	guardian "schg_cas01",115,153," ",1905,"#sch01_RL02::OnBarrierDestroyed"; //36;
+	guardian "schg_cas01",117,153," ",1905,"#sch01_RL02::OnBarrierDestroyed"; //37;
+	guardian "schg_cas01",119,153," ",1905,"#sch01_RL02::OnBarrierDestroyed"; //38;
+	guardian "schg_cas01",121,153," ",1905,"#sch01_RL02::OnBarrierDestroyed"; //39;
+	guardian "schg_cas01",123,153," ",1905,"#sch01_RL02::OnBarrierDestroyed"; //40;
+	guardian "schg_cas01",125,153," ",1905,"#sch01_RL02::OnBarrierDestroyed"; //41;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc01[3],1;
+		mapannounce "schg_cas01","The 2nd Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas01",114,154,126,154,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas01",114,154,126,154,cell_walkable,1;
+	killmonster "schg_cas01","#sch01_RL02::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas01,2,4,0	script	#sch01_RL03	-1,{
+OnEnable:
+	set .MyMobCount,4;
+	setcell "schg_cas01",116,241,126,241,cell_walkable,0;
+	guardian "schg_cas01",116,240," ",1905,"#sch01_RL03::OnBarrierDestroyed"; //42;
+	guardian "schg_cas01",118,240," ",1905,"#sch01_RL03::OnBarrierDestroyed"; //43;
+	guardian "schg_cas01",120,240," ",1905,"#sch01_RL03::OnBarrierDestroyed"; //44;
+	guardian "schg_cas01",122,240," ",1905,"#sch01_RL03::OnBarrierDestroyed"; //45;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc01[4],1;
+		mapannounce "schg_cas01","The 3rd Fortress Gate is destroyed!",bc_map,"0x00ff00";
+		setcell "schg_cas01",116,241,126,241,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas01",116,241,126,241,cell_walkable,1;
+	killmonster "schg_cas01","#sch01_RL03::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas01,124,52,0	script	Control Device01#sch01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc01[2] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon,";
+									mes "but it's not working very well.^FFFFFF ^3355FF You'll have to try something else.";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch01_RL01::OnEnable";
+							disablenpc "Control Device01#sch01";
+							mapannounce "schg_cas01","The 1st Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc01[2],0;
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "Control Device01#sch01";
+	end;
+
+OnEnable:
+	enablenpc "Control Device01#sch01";
+	end;
+
+OnDisable:
+	disablenpc "Control Device01#sch01";
+	end;
+}
+
+schg_cas01,128,157,0	script	Control Device02#sch01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc01[3] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch01_RL02::OnEnable";
+							disablenpc "Control Device02#sch01";
+							mapannounce "schg_cas01","The 2nd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc01[3],0; //Global Variable
+							setarray $agit_sc01[2],2; //Global Variable
+							donpcevent "Control Device01#sch01::OnEnable";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "Control Device02#sch01";
+	end;
+
+OnEnable:
+	enablenpc "Control Device02#sch01";
+	end;
+
+OnDisable:
+	disablenpc "Control Device02#sch01";
+	end;
+}
+
+schg_cas01,109,247,0	script	Control Device03#sch01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc01[4] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch01_RL03::OnEnable";
+							disablenpc "Control Device03#sch01";
+							mapannounce "schg_cas01","The 3rd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc01[4],0;
+							setarray $agit_sc01[3],2;
+							donpcevent "Control Device02#sch01::OnEnable";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "Control Device03#sch01";
+	end;
+
+OnEnable:
+	enablenpc "Control Device03#sch01";
+	end;
+
+OnDisable:
+	disablenpc "Control Device03#sch01";
+	end;
+}
+
+// Link Flags
+schg_cas01,106,302,0	script	LF-01#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("First Gate House:Second Gate House:Cancel")) {
+		case 1:
+			warp "schg_cas01",19,26;
+			end;
+		case 2:
+			warp "schg_cas01",219,90;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,109,302,0	script	LF-02#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 1-1:Defense Area 1-2:Cancel")) {
+		case 1:
+			warp "schg_cas01",89,43;
+			end;
+		case 2:
+			warp "schg_cas01",141,45;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,112,302,0	script	LF-03#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 2-1:Defense Area 2-2:Cancel")) {
+		case 1:
+			warp "schg_cas01",137,54;
+			end;
+		case 2:
+			warp "schg_cas01",102,54;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,115,302,0	script	LF-04#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 2-3:Defense Area 2-4:Cancel")) {
+		case 1:
+			warp "schg_cas01",94,147;
+			end;
+		case 2:
+			warp "schg_cas01",163,140;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,118,302,0	script	LF-05#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 2-3:Defense Area 2-4:Cancel")) {
+		case 1:
+			warp "schg_cas01",87,220;
+			end;
+		case 2:
+			warp "schg_cas01",151,220;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,121,302,0	script	LF-06#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 3-1:Defense Area 3-2:Cancel")) {
+		case 1:
+			warp "schg_cas01",100,242;
+			end;
+		case 2:
+			warp "schg_cas01",136,242;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,124,302,0	script	LF-07#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Center 1 Area:Center 2 Area:Cancel")) {
+		case 1:
+			warp "schg_cas01",120,168;
+			end;
+		case 2:
+			warp "schg_cas01",119,211;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,127,302,0	script	LF-08#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Area 1-1:Area 2-1:Area 3-1:Cancel")) {
+		case 1:
+			warp "schg_cas01",89,43;
+			end;
+		case 2:
+			warp "schg_cas01",94,147;
+			end;
+		case 3:
+			warp "schg_cas01",100,242;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,130,302,0	script	LF-09#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Area 1-2:Area 2-3:Area 3-2:Cancel")) {
+		case 1:
+			warp "schg_cas01",141,45;
+			end;
+		case 2:
+			warp "schg_cas01",163,140;
+			end;
+		case 3:
+			warp "schg_cas01",136,243;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,133,302,0	script	LF-10#schg_cas01	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to the";
+		mes "Convenience Facility for";
+		mes "guild members?^000000";
+		switch(select("Go to Convenience Facility:Cancel")) {
+		case 1:
+			warp "schg_cas01",275,244;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,17,45,0	script	Himinn#LF_sc01_1::LF_sc01_1	111,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to";
+		mes "the Emperium Center?^000000";
+		switch(select("Teleport:Cancel")) {
+		case 1:
+			warp "schg_cas01",120,290;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas01,207,95,0	duplicate(LF_sc01_1)	Himinn#LF_sc01_2	111
+
+schg_cas01,111,46,4	script	Himinn#LF_sc01_3::LF_sc01_2	722,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to";
+		mes "the Emperium Center?^000000";
+		switch(select("Teleport:Cancel")) {
+		case 1:
+			warp "schg_cas01",120,290;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+
+OnRecvCastleSc01:
+	FlagEmblem GetCastleData("schg_cas01",1);
+	end;
+}
+
+schg_cas01,129,46,4	duplicate(LF_sc01_2)	Himinn#LF_sc01_4	722
+schg_cas01,99,77,0	duplicate(LF_sc01_1)	Himinn#LF_sc01_5	111
+schg_cas01,140,77,0	duplicate(LF_sc01_1)	Himinn#LF_sc01_6	111
+schg_cas01,109,150,4	duplicate(LF_sc01_2)	Himinn#LF_sc01_7	722
+schg_cas01,130,150,4	duplicate(LF_sc01_2)	Himinn#LF_sc01_8	722
+schg_cas01,112,212,0	duplicate(LF_sc01_1)	Himinn#LF_sc01_9	111
+schg_cas01,127,212,0	duplicate(LF_sc01_1)	Himinn#LF_sc01_10	111
+schg_cas01,113,238,0	duplicate(LF_sc01_1)	Himinn#LF_sc01_11	111
+schg_cas01,126,238,0	duplicate(LF_sc01_1)	Himinn#LF_sc01_12	111
+schg_cas01,95,247,0	duplicate(LF_sc01_1)	Himinn#LF_sc01_13	111
+schg_cas01,144,247,0	duplicate(LF_sc01_1)	Himinn#LF_sc01_14	111
+
+// Guild Manager
+schg_cas01,247,305,3	script	Steward#sch01	55,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (.@GID == 0) {
+		mes "[ Steward ]";
+		mes "I await for the master";
+		mes "whom destiny will choose";
+		mes "for me. Do you think you";
+		mes "have to courage and strength";
+		mes "to conquer this stronghold?";
+		close;
+	}
+	if (getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)) {
+		mes "[ Steward ]";
+		mes "Hmpf. Your threats don't";
+		mes "scare me! Guardians, drive";
+		mes "this infidel away from here!";
+		mes "I will always be loyal to the";
+		mes "master of this stronghold,";
+		MES "the one and only^FF0000" + getguildmaster(.@GID) + "^000000.";
+		close;
+	}
+	mes "[ Steward ]";
+	mes "Ah, Master ^FF0000" + getguildmaster(.@GID) + "^000000...";
+	mes "How shall I serve you today?";
+	mes "Was there an aspect of this";
+	mes "stronghold's maintenance";
+	mes "you wanted to discuss?";
+	next;
+	switch(select("Stronghold Briefing:Invest in Commercial Growth:Invest in Defense growth:Hire/Fire Storage Staff:Go to Master's room")) {
+	case 1:
+		mes "[ Steward ]";
+		mes "The Commercial Growth";
+		mes "Level of the stronghold is ^0000ff" + GetCastleData("schg_cas01",2) + ".";
+		if (GetCastleData("schg_cas01",4) > 0) {
+			mes "Last time, you invested in";
+			mes "Commercial Growth " + GetCastleData("schg_cas01",4) + ".";
+		}
+		next;
+		mes "[ Steward ]";
+		mes "Our stronghold's";
+		mes "safeguard level is " + GetCastleData("schg_cas01",3) + ".";
+		if (GetCastleData("schg_cas01",5) > 0) {
+			mes "Last time, you invested";
+			mes "in defense " + GetCastleData("schg_cas01",5) + " times.";
+		}
+		mes " ";
+		mes "That is all, master.";
+		close;
+	case 2:
+		set .@Economy,GetCastleData("schg_cas01",2);
+		if(.@Economy < 8) set .@eco_invest,10000;
+		if(.@Economy >= 8) set .@eco_invest,20000;
+		if(.@Economy >= 16) set .@eco_invest,40000;
+		if(.@Economy >= 25) set .@eco_invest,80000;
+		if(.@Economy >= 34) set .@eco_invest,160000;
+		if(.@Economy >= 44) set .@eco_invest,320000;
+		if(.@Economy >= 54) set .@eco_invest,640000;
+		if(.@Economy >= 65) set .@eco_invest,1280000;
+		if(.@Economy >= 76) set .@eco_invest,2560000;
+		if(.@Economy >= 88) set .@eco_invest,5120000;
+		mes "[ Steward ]";
+		mes "Raising the stronghold's";
+		mes "commercial growth will";
+		mes "increase the quantity of";
+		mes "goods produced for the guild.";
+		mes "Investing in commercial growth";
+		mes "will help the guild's future.";
+		next;
+		mes "[ Steward ]";
+		mes "You can make one investment";
+		mes "each day, but if you can make";
+		mes "two investments if you pay";
+		mes "more zeny: this will speed";
+		mes "up commercial development,";
+		mes "but can be quite expensive.";
+		next;
+		if (.@Economy == 100) {
+			mes "[ Steward ]";
+			mes "However, our stronghold's";
+			mes "commerical growth level is";
+			mes "at 100%. It's not possible to";
+			mes "develop commercial growth";
+			mes "any further than that.";
+			close;
+		}
+		if (GetCastleData("schg_cas01",4) == 2) {
+			mes "[ Steward ]";
+			mes "You've already made two";
+			mes "investments today, so you'll";
+			mes "have to wait until tomorrow";
+			mes "to make another investment.";
+			close;
+		}
+		if (GetCastleData("schg_cas01",4) == 0) {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000 zeny";
+			mes "to make an investment";
+			mes "Will you invest in this";
+			mes "stronghold's commerical";
+			mes "development now?";
+		}
+		else {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000";
+			mes "more zeny to make a second";
+			mes "investment today. Will you";
+			mes "invest one more time?";
+		}
+		next;
+		switch(select("Invest in Commercial Growth:Cancel")) {
+		case 1:
+			if (Zeny < .@eco_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				end;
+			}
+			set zeny,zeny-.@eco_invest;
+			SetCastleData "schg_cas01",4,GetCastleData("schg_cas01",4)+1;
+			SetCastleData "schg_cas01",2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. We can expect";
+			mes "to see the results of this";
+			mes "investment by tomorrow.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 3:
+		set .@Defence,GetCastleData("schg_cas01",3);
+		if(.@Defence < 8) set .@def_invest,20000;
+		if(.@Defence >= 8) set .@def_invest,40000;
+		if(.@Defence >= 16) set .@def_invest,80000;
+		if(.@Defence >= 25) set .@def_invest,160000;
+		if(.@Defence >= 34) set .@def_invest,320000;
+		if(.@Defence >= 44) set .@def_invest,640000;
+		if(.@Defence >= 54) set .@def_invest,1280000;
+		if(.@Defence >= 65) set .@def_invest,2560000;
+		if(.@Defence >= 76) set .@def_invest,5120000;
+		if(.@Defence >= 88) set .@def_invest,10240000;
+		mes "[ Steward ]";
+		mes "Investing in our stronghold's";
+		mes "defense will enhance the";
+		mes "durability of our Guardians";
+		mes "and the Emperium. We'll need";
+		mes "every advantage to protect";
+		mes "ourselves from our enemies.";
+		next;
+		mes "[ Steward ]";
+		mes "You can invest in defense";
+		mes "once per day, but if you pay";
+		mes "more zeny, you can invest";
+		mes "a maximum of two times daily.";
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas01",3) == 100) {
+			mes "The Defense Level of this";
+			mes "stronghold is 100%, and";
+			mes "cannot be increased further.";
+			close;
+		}
+		if (GetCastleData("schg_cas01",5) == 2) {
+			mes "Master, you've already";
+			mes "invested in Defense twice";
+			mes "today. You'll need to wait";
+			mes "until tomorrow if you really";
+			mes "want to increase our defenses.";
+			close;
+		}
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas01",5) == 0) {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses.";
+			mes "Will you invest now?";
+		}
+		else {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses";
+			mes "a second time today.";
+			mes "Will you invest now?";
+		}
+		next;
+		switch(select("Invest in Defense:Cancel")) {
+		case 1:
+			if (Zeny < .@def_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				close;
+			}
+			set zeny,zeny-.@def_invest;
+			SetCastleData "schg_cas01",5,GetCastleData("schg_cas01",5)+1;
+			SetCastleData "schg_cas01",3,.@Defence+1;
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. Increasing";
+			mes "the frequency of treasure";
+			mes "procured by the guild will";
+			mes "definitely help us all.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 4:
+		if (GetCastleData("schg_cas01",9) == 1) {
+			mes "[ Steward ]";
+			mes "Do you wish to dismiss";
+			mes "the Kafra Employee that";
+			mes "we've hired for the guild?";
+			next;
+			switch(select("Dismiss:Cancel")) {
+			case 1:
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "Master, please reconsider!";
+				mes "I've been working very hard";
+				mes "for the success of the guild!";
+				mes "I'll try harder to serve the";
+				mes "guild members of this";
+				mes "stronghold, I promise!";
+				next;
+				switch(select("Dismiss:Cancel")) {
+				case 1:
+					mes "[ Hired Kafra Employee ]";
+					mes "Why?! What have I done";
+					mes "to deserve this? Waaah~!";
+					next;
+					cutin "kafra_01",255;
+					break;
+				case 2:
+					mes "[ Hired Kafra Employee ]";
+					mes "Thank you, Master!";
+					mes "I'll obey your every";
+					mes "command as best I can!";
+					mes "You won't regret this!";
+					close;
+				}
+				break;
+			case 2:
+				mes "[ Steward ]";
+				mes "She works very hard,";
+				mes "in my opinion. It was in";
+				mes "all of our best interests to";
+				mes "allow her to stay with us.";
+				close;
+			}
+			disablenpc "Kafra Employee#schg_cas01";
+			SetCastleData "schg_cas01",9,0;
+			mes "[ Steward ]";
+			mes "That Kafra Employee";
+			mes "has been dismissed.";
+			mes "Were really dissatisfied";
+			mes "by the quality of her service?";
+			close;
+		}
+		else {
+			mes "[ Steward ]";
+			mes "Will you hire a";
+			mes "Kafra Employee to serve";
+			mes "our stronghold? You must";
+			mes "pay ^FF000010,000 zeny^000000 to hire one.";
+			next;
+			switch(select("Hire:Cancel")) {
+			case 1:
+				if (getgdskilllv(.@GID,10001) == 0) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "you have not yet attained";
+					mes "the ^FF0000Contract with Kafra^000000";
+					mes "guild skill.";
+					close;
+				}
+				if (Zeny < 10000) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "we do not have enough";
+					mes "funds to pay the contract fee.";
+					close;
+				}
+				set zeny,zeny-10000;
+				enablenpc "Kafra Employee#sch01";
+				SetCastleData "schg_cas01",9,1;
+				mes "[ Steward ]";
+				mes "Very well. We have formed";
+				mes "a contract with the Kafra";
+				mes "Head Office, and hired a";
+				mes "Kafra Employee for our";
+				mes "stronghold. Here she is~";
+				next;
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "How do you do? I've";
+				mes "been dispatched by the";
+				mes "Kafra Head Office to";
+				mes "serve your guild's needs.";
+				mes "I'll do my best to follow";
+				mes "your every command, Master.";
+				next;
+				cutin "kafra_01",255;
+				mes "[ Steward ]";
+				mes "Our contract will expire";
+				mes "after one month, so we must";
+				mes "pay additional fees to keep";
+				mes "this Kafra Employee in";
+				mes "the service of our guild.";
+				close;
+			case 2:
+				mes "[ Steward ]";
+				mes "As you command, Master.";
+				mes "However, I suggest hiring";
+				mes "a Kafra Employee as soon";
+				mes "as possible since our guild";
+				mes "would greatly benefit from";
+				mes "the convenient Kafra services.";
+				close;
+			}
+		}
+	case 5:
+		mes "[ Steward ]";
+		mes "Do you wish to enter the";
+		mes "Guild Treasure Room?";
+		mes "Only you, the Guild Master,";
+		mes "are permitted to enter.";
+		next;
+		mes "[ Steward ]";
+		mes "Please remember to open";
+		mes "the Treasure Boxes at the";
+		mes "proper time. Otherwise, the";
+		mes "treasure may disappear if";
+		mes "something unexpected happens.";
+		next;
+		switch(select("Go to Treasure Room:Cancel")) {
+		case 1:
+			mes "[ Steward ]";
+			mes "Allow me to guide you";
+			mes "on the secret path to";
+			mes "the Treasure Room.";
+			mes "Press the secret switch";
+			mes "when you wish to return here.";
+			close2;
+			warp "schg_cas01",381,381;
+			end;
+		case 2:
+			mes "[ Steward ]";
+			mes "Items in the Treasure Room";
+			mes "are produced once each day.";
+			mes "Therefore, you must obtain";
+			mes "the treasure items everyday.";
+			mes "For the sake of the guild,";
+			mes "prioritize treasure harvesting!";
+			close;
+		}
+	}
+
+Onstop:
+	stopnpctimer;
+	end;
+
+OnStartArena:
+	set .@GID,getcharid(2);
+	// Lower castle Economy
+	set .@Economy,GetCastleData("schg_cas01",2) - 5;
+	if (.@Economy < 0) set .@Economy, 0;
+	SetCastleData "schg_cas04", 2, .@Economy;
+	// Lower Castle Defence
+	set .@Defence,GetCastleData("schg_cas01",3) - 5;
+	if (.@Defence < 0) set .@Defence, 0;
+	SetCastleData "schg_cas01", 3, .@Defence;
+	// Set new owner
+	SetCastleData "schg_cas01",1, .@GID;
+	// Clear castle's data.
+	for( set .@i, 4; .@i <= 9; set .@i, .@i+1 )
+		SetCastleData "schg_cas01", .@i, 0;
+	// Disable Kafra
+	disablenpc "Kafra Employee#sch01";
+
+	set .msg,2;
+	if (.msg == 1) {
+		announce "Fortress [" + GetCastleName("schg_cas01") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch01_02::Onstart";
+	}
+	else if (.msg == 2) {
+		announce "The [" + getguildname(.@gid) + "] conquered the [Nithafjoll 1] stronghold of "+GetCastleName("schg_cas01"),bc_all;
+		mapannounce "schg_cas01","The emperium has been shattered!",bc_map,"0x00FF00";
+		if (agitcheck()) {
+			donpcevent "Manager#sch01_02::Onreset";
+			initnpctimer;
+		}
+		else {
+			donpcevent "Manager#sch01_02::Onreset";
+			stopnpctimer;
+		}
+	}
+	else if (.msg == 0) {
+		announce "Fortress [" + GetCastleName("schg_cas01") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch01_02::Onreset";
+		stopnpctimer;
+		end;
+	}
+	MapRespawnGuildID "schg_cas01",GetCastleData("schg_cas01",1),2;
+	GetCastleData "schg_cas01",0,"::OnRecvCastlesc01";
+	end;
+
+OnTimer10000:
+	donpcevent "Manager#sch01_02::Onchange";
+	mapannounce "schg_cas01","Rebuild this stonghold's Guardian Stones and Fortress Gates to secure your guild's new aquisition!",bc_map,"0x00FF00";
+	end;
+}
+
+// Guild Kafra
+schg_cas01,300,287,5	script	Kafra Employee#sch01	117,{
+	cutin "kafra_01",2;
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (getcharid(2) == .@GID && getgdskilllv(.@GID,10001)) {
+		mes "[Kafra Employee]";
+		mes "Welcome, proud member";
+		mes "of the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild!";
+		mes "The Kafra Corporation is ready";
+		mes "to assist you wherever you go!";
+		next;
+		switch(select("Use Storage:Use Warp Service:Rent Pushcart:Cancel")) {
+		case 1:
+			if (basicskillcheck() && getskilllv(1) < 6) {
+				mes "[Kafra Employee]";
+				mes "I'm so sorry, but you must";
+				mes "have at least Novice Skill";
+				mes "Lv.6 to use the Storage.";
+			}
+			else {
+				openstorage;
+			}
+			break;
+		case 2:
+			mes "[Kafra Employee]";
+			mes "Please tell me your";
+			mes "Warp destination.";
+			next;
+			switch(select("Juno -> 200 z:Cancel")) {
+			case 1:
+				if (Zeny < 200) {
+					mes "[Kafra Employee]";
+					mes "I'm sorry, but you don't";
+					mes "have enough zeny to pay";
+					mes "the warp fee. Would you";
+					mes "please check your funds again?";
+					close2;
+					cutin "kafra_01",255;
+					end;
+				}
+				set zeny,zeny-200;
+				warp "yuno",158,125;
+				end;
+			case 2:
+				cutin "kafra_01",255;
+			}
+			break;
+		case 3:
+			if (BaseClass != Job_Merchant) {
+				mes "[Kafra Employee]";
+				mes "I'm sorry, but the Pushcart";
+				mes "rental service can only be";
+				mes "used by Merchant, Blacksmith,";
+				mes "and Alchemist class characters.";
+			}
+			else if (checkcart() == 1) {
+				mes "[Kafra Employee]";
+				mes "Hm? You've already";
+				mes "rented a Pushcart.";
+			}
+			else {
+				mes "[Kafra Employee]";
+				mes "The Pushcart rental fee";
+				mes "is 800 zeny. Would you";
+				mes "like to rent a Pushcart?";
+				next;
+				switch(select("Rent Pushcart:Cancel")) {
+				case 1:
+					if (Zeny < 800) {
+						mes "[Kafra Employee]";
+						mes "I'm sorry, but you don't";
+						mes "have enough zeny to rent";
+						mes "one of our Pushcarts.";
+						close2;
+						cutin "kafra_01",255;
+						end;
+					}
+					set zeny,zeny-800;
+					setcart;
+					break;
+				case 2:
+					break;
+				}
+			}
+			break;
+		case 4:
+			mes "[Kafra Employee]";
+			mes "Thank you for using the";
+			mes "Kafra Service. Wherever";
+			mes "you go, Kafra will be";
+			mes "there to support you!";
+			close2;
+			cutin "kafra_01",255;
+			end;
+		}
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+	else {
+		mes "[Kafra Employee]";
+		mes "I'm sorry, but I've been";
+		mes "exclusively contracted";
+		mes "to the members of the";
+		mes "^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		mes "You'll have to ask another";
+		mes "Kafra Employee to help you...";
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+
+OnRecvCastlesc01:
+	if (GetCastleData("schg_cas01",1) == 0) {
+		monster "schg_cas01",0,0,"Evil Druid",1117,10;
+		monster "schg_cas01",0,0,"Khalitzburg",1132,4;
+		monster "schg_cas01",0,0,"Abysmal Knight",1219,3;
+		monster "schg_cas01",0,0,"Executioner",1205,1;
+		monster "schg_cas01",0,0,"Penomena",1216,10;
+		monster "schg_cas01",0,0,"Alarm",1193,18;
+		monster "schg_cas01",0,0,"Clock",1269,9;
+		monster "schg_cas01",0,0,"Raydric Archer",1276,12;
+		monster "schg_cas01",0,0,"Wanderer",1208,3;
+		monster "schg_cas01",0,0,"Alice",1275,1;
+		monster "schg_cas01",0,0,"Bloody Knight",1268,2;
+		monster "schg_cas01",0,0,"Dark Lord",1272,2;
+		monster "schg_cas01",0,0,"Tower Keeper",1270,4;
+	}
+	if (GetCastleData("schg_cas01",9) < 1) {
+		disablenpc "Kafra Employee#sch01";
+	}
+	end;
+}
+
+schg_cas01,391,391,0	script	 #sch01_switch	111,{
+	mes " ";
+	mes "^3355FFWill you pull";
+	mes "this small lever?^000000";
+	next;
+	switch(select("Pull Lever:Cancel")) {
+	case 1:
+		warp "schg_cas01",275,244;
+		end;
+	case 2:
+		close;
+	}
+}
+
+sch_gld,290,90,0	script	Himinn#flag_sc01_1::Sc01_Flag	722,{
+	set .@GID, GetCastleData("schg_cas01",1);
+	if (.@GID == 0) {
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt declares that";
+		mes "one has yet to claim lordship";
+		mes "over this stronghold. The one";
+		mes "that breaks the Emperium will";
+		mes "be recognized as its new owner.";
+		close;
+	}
+	else {
+		if (getcharid(2) == .@GID) {
+			mes "[ Ringing Voice ]";
+			mes "Courageous one,";
+			mes "do you wish to return";
+			mes "to your stronghold?";
+			next;
+			switch(select("Return to the Stronghold:Cancel")) {
+			case 1:
+				set .@GID, GetCastleData("schg_cas01",1);
+				if (getcharid(2) == .@GID) {
+					warp "schg_cas01",120,290;
+					end;
+				}
+				close;
+			case 2:
+				close;
+			}
+		}
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt decrees that";
+		mes "this stronghold is owned";
+		mes "by the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		next;
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "^FF0000" + GetGuildMaster(.@GID) + "^000000 is";
+		mes "Guild Master of ^FF0000" + GetGuildName(.@GID) + "^000000.";
+		mes "Any that object must claim this";
+		mes "stronghold through strength of";
+		mes "steel and magic during the";
+		mes "appointed Guild Siege times.";
+		close;
+	}
+
+OnRecvCastlesc01:
+	FlagEmblem GetCastleData("schg_cas01",1);
+	end;
+}
+
+sch_gld,297,90,0	duplicate(Sc01_Flag)	Himinn#flag_sc01_2	722

+ 2802 - 0
npc/guild2/schg_cas02.txt

@@ -0,0 +1,2802 @@
+//===== eAthena Script =======================================
+//= War of Emperium Second Edition
+//===== By: ==================================================
+//= L0ne_W0lf
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= eAthena SVN
+//===== Description: =========================================
+//= WoE SE Schwaltzvalt Castle 2
+//===== Additional Comments: =================================
+//= 1.0 First Version [L0ne_W0lf]
+//============================================================
+
+schg_cas02,1,1,0	script	Manager#sch02_02	111,{
+	end;
+
+OnInterIfInitOnce:
+	GetCastleData "schg_cas02",0,"::OnRecvCastleSc02";
+	end;
+
+OnRecvCastlesc02:
+	RequestGuildInfo GetCastleData("schg_cas02",1);
+	if (GetCastleData("schg_cas02",1) == 0) {
+		donpcevent "Manager#sch02_02::Onstart";
+	}
+	end;
+
+OnAgitStart:
+	if (agitcheck()) {
+		MapRespawnGuildID "schg_cas02",GetCastleData("schg_cas02",1),2;
+		GvgOn "schg_cas02";
+		donpcevent "Manager#sch02_02::Onstart";
+	}
+	else {
+		donpcevent "#sch02_RL00::OnDisable";
+		donpcevent "#sch02_RL01::OnDisable";
+		donpcevent "#sch02_RL02::OnDisable";
+		donpcevent "#sch02_RL03::OnDisable";
+	}
+	end;
+
+OnAgitEnd:
+	GvgOff "schg_cas02";
+	if (GetCastleData("schg_cas02",1)) {
+		KillMonster "schg_cas02","Steward#sch02::OnStartArena";
+		donpcevent "Manager#sch02_02::Onreset";
+	}
+	end;
+
+Onstart:
+	// 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians
+	// Settings for all but Summon Guardians
+	// 0 = Okay; 1 = Destroyed; 2 = Repairing
+	// Summon Guardians
+	// 0 = Do not Summon; 1 = Summon
+	if (GetCastleData("schg_cas02",1)) {
+		setarray $agit_sc02[0],0,0,0,0,0,0;
+		donpcevent "#sch02_df01::OnEnable";
+		donpcevent "#sch02_df02::OnEnable";
+		donpcevent "#sch02_RL00::OnEnable";
+		donpcevent "#sch02_RL01::OnEnable";
+		donpcevent "#sch02_RL02::OnEnable";
+		donpcevent "#sch02_RL03::OnEnable";
+	}
+	monster "schg_cas02",162,193,"Emperium",1288,1,"Steward#sch02::OnStartArena";
+	end;
+
+Onreset:
+	donpcevent "#sch02_df01::OnDisable";
+	donpcevent "#sch02_df02::OnDisable";
+	donpcevent "#sch02_gard01::Onreset";
+	donpcevent "#sch02_gard02::Onreset";
+	donpcevent "#sch02_RL00::OnDisable";
+	donpcevent "#sch02_RL01::OnDisable";
+	donpcevent "#sch02_RL02::OnDisable";
+	donpcevent "#sch02_RL03::OnDisable";
+	donpcevent "1st Guardian Stone#sch02::OnDisable";
+	donpcevent "2nd Guardian Stone#sch02::OnDisable";
+	donpcevent "Control Device01#sch02::OnDisable";
+	donpcevent "Control Device02#sch02::OnDisable";
+	donpcevent "Control Device03#sch02::OnDisable";
+	if (agitcheck()) {
+		setarray $agit_sc02[0],0,0,1,1,1,0;
+	}
+	end;
+
+Onchange:
+	setarray $agit_sc02[0],2,2,1,1,2,0;
+	monster "schg_cas02",162,193,"Emperium",1288,1,"Steward#sch02::OnStartArena";
+	donpcevent "Control Device03#sch02::OnEnable";
+	donpcevent "1st Guardian Stone#sch02::OnEnable";
+	donpcevent "2nd Guardian Stone#sch02::OnEnable";
+	end;
+
+OnClock0001:
+	set .@Treasure,GetCastleData("schg_cas02",2)/5+4;
+	if (.@Treasure) {
+		monster "schg_cas02",249,378,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 2) end;
+		monster "schg_cas02",250,378,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 3) end;
+		monster "schg_cas02",251,378,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 4) end;
+		monster "schg_cas02",252,378,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 5) end;
+		monster "schg_cas02",253,378,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 6) end;
+		monster "schg_cas02",246,376,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 7) end;
+		monster "schg_cas02",247,376,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 8) end;
+		monster "schg_cas02",248,376,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 9) end;
+		monster "schg_cas02",249,376,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 10) end;
+		monster "schg_cas02",250,376,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 11) end;
+		monster "schg_cas02",250,374,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 12) end;
+		monster "schg_cas02",251,374,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 13) end;
+		monster "schg_cas02",252,374,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 14) end;
+		monster "schg_cas02",253,374,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 15) end;
+		monster "schg_cas02",246,372,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 16) end;
+		monster "schg_cas02",247,372,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 17) end;
+		monster "schg_cas02",248,372,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 18) end;
+		monster "schg_cas02",249,372,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 19) end;
+		monster "schg_cas02",250,372,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 20) end;
+		monster "schg_cas02",249,370,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 21) end;
+		monster "schg_cas02",250,370,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 22) end;
+		monster "schg_cas02",251,370,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 23) end;
+		monster "schg_cas02",252,270,"Treasure Chest",1939,1,"Manager#sch02_02::OnTreasureDied";
+		if (.@Treasure < 24) end;
+		monster "schg_cas02",253,370,"Treasure Chest",1324,1,"Manager#sch02_02::OnTreasureDied";
+	}
+	end;
+
+OnTreasureDied:
+	end;
+}
+
+schg_cas02,140,184,3	script	Endeef#sch02_01	868,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (.@GID == 0) {
+		mes "[Endeef]";
+		mes "Great job. Now, all you";
+		mes "need to do is destroy this";
+		mes "Emperium to gain ownership";
+		mes "over this stronghold.";
+		close;
+	}
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) != getguildmaster(.@GID)) {
+			mes "[Endeef]";
+			mes "As guardian of this";
+			mes "stronghold, I answer only";
+			mes "to the master of the guild";
+			mes "that controls this place.";
+			close;
+		}
+		else {
+			if (agitcheck() == 0) {
+				mes "[Endeef]";
+				mes "I am Endeef, guardian of";
+				mes "this stronghold. For now,";
+				mes "all is quiet in this place.";
+				next;
+				switch(select("Converse:Cancel")) {
+				case 1:
+					mes "[Endeef]";
+					mes "Do you have any questions";
+					mes "about this stronghold?";
+					next;
+					switch(select("Guardian Stones:Fortress Gates:Link Flags:Battle Strategy:Cancel")) {
+					case 1:
+						mes "[Endeef]";
+						mes "There is one Emperium";
+						mes "and two Guardian Stones in";
+						mes "each fortress. These stones";
+						mes "are the first line of defense,";
+						mes "and must be destroyed before";
+						mes "enemies can even enter.";
+						next;
+						mes "[Endeef]";
+						mes "The stones are located in";
+						mes "^4D4DFFGate Houses^000000 which must be";
+						mes "protected to prevent enemies";
+						mes "from reaching the Emperium.";
+						mes "Guardian Stones can ^4D4DFFrecall";
+						mes "your Guardians^000000 for protection.";
+						next;
+						mes "[Endeef]";
+						mes "Fortresses with higher levels";
+						mes "of defense can summon more";
+						mes "Guardians: this is why it is";
+						mes "so important for guilds to";
+						mes "invest in Defense Growth.";
+						next;
+						mes "[Endeef]";
+						mes "Guardian Stones that have";
+						mes "been destroyed can be revived";
+						mes "after a certain time, but one of^FFFFFF ^000000 the guild members must give";
+						mes "me the order. I can also report^FFFFFF ^000000 the status of the Guardian Stones.";
+						close;
+					case 2:
+						mes "[Endeef]";
+						mes "^4D4DFFFortress Gates^000000 are the second ^FFFFFF ^000000 line of guild stronghold defense,";
+						mes "and are protected by extra barricades activated by the Guardian Stones.";
+						mes "These gates are located in three different parts of the fortress.";
+						next;
+						mes "[Endeef]";
+						mes "Barricades are protected by";
+						mes "Guardian Stones, and are";
+						mes "restored when the Guardian";
+						mes "Stones are retrieved. However,";
+						mes "it is not as easy to restore";
+						mes "destroyed Fortress Gates.";
+						next;
+						mes "[Endeef]";
+						mes "Fortress Gates can only be";
+						mes "restored when the ^4D4DFFguild";
+						mes "master of a stronghold";
+						mes "changes^000000, or if ^4D4DFFrestoration";
+						mes "is requested by the guild";
+						mes "master of the stronghold^000000.";
+						close;
+					case 3:
+						mes "[Endeef]";
+						mes "Strongholds have many";
+						mes "Link Flags that allow you";
+						mes "to access vital areas within";
+						mes "restrictions placed by the";
+						mes "Barricades. Usually, ^4D4DFFFlag 1";
+						mes "links to the Gate House^000000.";
+						next;
+						mes "[Endeef]";
+						mes "Many flags link directly to";
+						mes "the flag near the Emperium.";
+						mes "The final numbered flag is";
+						mes "linked to the Convenience";
+						mes "Facility of the stronghold's";
+						mes "owner. Keep this in mind.";
+						close;
+					case 4:
+						mes "[Endeef]";
+						mes "Strategy? It would be better";
+						mes "to develop your battle plan to";
+						mes "exploit your guild's advantages";
+						mes "and your enemies' weaknesses.";
+						mes "Use the Gate Houses and Barricades, and rebuild as quickly as you can!";
+						close;
+					case 5:
+						mes "[Endeef]";
+						mes "You have no questions";
+						mes "to ask of me? Well, I'm";
+						mes "here to serve your needs.";
+						close;
+					}
+				case 2:
+					mes "[Endeef]";
+					mes "I'm always here, so";
+					mes "feel free to request my";
+					mes "assistance whenever";
+					mes "the need arises.";
+					close;
+				}
+			}
+			else {
+				mes "[Endeef]";
+				mes "Greetings, "+strcharinfo(0)+".";
+				mes "What are your orders?";
+				next;
+				switch(select("Increase Stronghold Defense:Situational Briefing:Cancel")) {
+				case 1:
+					if ($agit_sc02[5] == 0) {
+						if (getgdskilllv(.@GID,10002) == 0) {
+							mes "[Endeef]";
+							mes "I'm sorry, but the Guardian";
+							mes "Stones aren't powerful enough";
+							mes "to summon Guardians yet. We";
+							mes "need to accumulate more";
+							mes "knowledge before they can";
+							mes "summon any Guardians.";
+							close;
+						}
+						else {
+							mes "[Endeef]";
+							mes "I shall endeavor to summon";
+							mes "a Guardian through a Guardian";
+							mes "Stone. However, keep in mind";
+							mes "that this will not work if the";
+							mes "Guardian Stone is destroyed.";
+							setarray $agit_sc02[5],1;
+							if ($agit_sc02[0] == 0) {
+								donpcevent "#sch02_gard01::OnEnable";
+							}
+							if ($agit_sc02[1] == 0) {
+								donpcevent "#sch02_gard02::OnEnable";
+							}
+							close;
+						}
+					}
+					else {
+						mes "[Endeef]";
+						mes "You've already commanded";
+						mes "me to summon a Guardian";
+						mes "to defend the stronghold.";
+						close;
+					}
+				case 2:
+					mes "[Endeef]";
+					mes "Our defense status is...";
+					if ($agit_sc02[0] == 1) {
+						mes "1st Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc02[0] == 2) {
+						mes "1st Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc02[1] == 1) {
+						mes "2nd Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc02[1] == 2) {
+						mes "2nd Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc02[2] == 1) {
+						mes "1st Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc02[2] == 2) {
+						mes "1st Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc02[3] == 1) {
+						mes "2nd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc02[3] == 2) {
+						mes "2nd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc02[4] == 1) {
+						mes "3rd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc02[4] == 2) {
+						mes "3rd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "3rd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					close;
+				case 3:
+					mes "[Endeef]";
+					mes "I'll be standing by,";
+					mes "awaiting your orders.";
+					close;
+				}
+			}
+		}
+	}
+	else {
+		mes "[Endeef]";
+		mes "Who are you? Scoundrel!";
+		mes "Leave this stronghold now!";
+		close;
+	}
+
+OnInit:
+	setarray $agit_sc02[0],0,0,0,0,0,0;
+	end;
+}
+
+schg_cas02,1,1,0	script	#sch02_gard01	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas02",3);
+	guardian "schg_cas02",326,83,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //0;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //2;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas02",296,82,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //3;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas02",296,82,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //3;
+		guardian "schg_cas02",285,40,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //4;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //1;
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",236,41,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //5;
+	mapannounce "schg_cas02","The 1st Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",285,40,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //6;
+	mapannounce "schg_cas02","The 2nd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer1800000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",296,82,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //7;
+	mapannounce "schg_cas02","The 3rd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer2700000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //8;
+	mapannounce "schg_cas02","The 4th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer3600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",337,95,"Guardian Soldier",1899,"#sch02_gard01::OnGuardianDied"; //9;
+	mapannounce "schg_cas02","The 5th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas02",334,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //10;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas02","#sch02_gard01::OnGuardianDied";
+	end;
+}
+
+schg_cas02,1,2,0	script	#sch02_gard02	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas02",3);
+	guardian "schg_cas02",359,85,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //11;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas02",337,154,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //13;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas02",337,154,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas02",317,183,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //14;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas02",337,154,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas02",317,183,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //14;
+		guardian "schg_cas02",307,222,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //15;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas02",307,222,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //12;
+	}
+	initnpctimer;
+	end;
+
+OnTimer600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",300,119,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //16;
+	end;
+
+OnTimer1200000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",337,154,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //17;
+	end;
+
+OnTimer2100000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",317,183,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //18;
+	end;
+
+OnTimer3000000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",307,222,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //19;
+	end;
+
+OnTimer3900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas02",359,85,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //20;
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas02",236,41,"Guardian Soldier",1899,"#sch02_gard02::OnGuardianDied"; //21;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas02","#sch02_gard02::OnGuardianDied";
+	end;
+}
+
+schg_cas02,1,3,0	script	#sch02_df01	-1,{
+OnEnable:
+	guardian "schg_cas02",231,58,"1st Guardian Stone",1907,"#sch02_df01::OnGuardianStoneDied"; //22;
+	end;
+
+OnDisable:
+	killmonster "schg_cas02","#sch02_df01::OnGuardianStoneDied";
+	setarray $agit_sc02[0],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 1st Guardian Stone is Destroyed
+	setarray $agit_sc02[0],1;
+	if (($agit_sc02[0] == 1) || ($agit_sc02[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc02[1] == 1) || ($agit_sc02[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas02","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch02_RL00::OnDisable";
+		donpcevent "#sch02_gard01::Onreset";
+	}
+	else {
+		mapannounce "schg_cas02","The 1st Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch02_gard01::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "1st Guardian Stone#sch02::OnEnable";
+	setarray $agit_sc02[0],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas02,231,57,0	script	1st Guardian Stone#sch02	844,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"1st Guardian Stone#sch02" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch02" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"1st Guardian Stone#sch02" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch02" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 3:
+							specialeffect 56; //"1st Guardian Stone#sch02" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch02" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc02[0] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "already completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch02_df01::OnEnable";
+							specialeffect 135; //"1st Guardian Stone#sch02" EF_ICECRASH
+							disablenpc "1st Guardian Stone#sch02";
+							setarray $agit_sc02[0],0;
+							set .@df_all,$agit_sc02[0]+$agit_sc02[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas02","The Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch02_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas02","The 1st Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc02[5] == 1) {
+								donpcevent "#sch02_gard01::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "1st Guardian Stone#sch02";
+	end;
+
+OnEnable:
+	enablenpc "1st Guardian Stone#sch02";
+	specialeffect 247; //"1st Guardian Stone#sch02" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "1st Guardian Stone#sch02";
+	end;
+}
+
+schg_cas02,1,4,0	script	#sch02_df02	-1,{
+OnEnable:
+	guardian "schg_cas02",335,230,"2nd Guardian Stone",1908,"#sch02_df02::OnGuardianStoneDied"; //23;
+	end;
+
+OnDisable:
+	killmonster "schg_cas02","#sch02_df02::OnGuardianStoneDied";
+	setarray $agit_sc02[1],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 2nd Guardian Stone is Destroyed
+	setarray $agit_sc02[1],1;
+	if (($agit_sc02[0] == 1) || ($agit_sc02[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc02[1] == 1) || ($agit_sc02[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas02","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch02_RL00::OnDisable";
+		donpcevent "#sch02_gard02::Onreset";
+	}
+	else {
+		mapannounce "schg_cas02","The 2nd Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch02_gard02::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "2nd Guardian Stone#sch02::OnEnable";
+	setarray $agit_sc02[1],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas02,335,231,0	script	2nd Guardian Stone#sch02	844,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"2nd Guardian Stone#sch02" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch02" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"2nd Guardian Stone#sch02" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch02" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 3:
+							specialeffect 56; //"2nd Guardian Stone#sch02" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch02" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc02[1] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "successfully completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch02_df02::OnEnable";
+							specialeffect 135; //"2nd Guardian Stone#sch02" EF_ICECRASH
+							disablenpc "2nd Guardian Stone#sch02";
+							setarray $agit_sc02[1],0;
+							set .@df_all,$agit_sc02[0]+$agit_sc02[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas02","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch02_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas02","The 2nd Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc02[5] == 1) {
+								donpcevent "#sch02_gard02::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "2nd Guardian Stone#sch02";
+	end;
+
+OnEnable:
+	enablenpc "2nd Guardian Stone#sch02";
+	specialeffect 247; //"2nd Guardian Stone#sch02" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "2nd Guardian Stone#sch02";
+	end;
+}
+
+schg_cas02,2,1,0	script	#sch02_RL00	-1,{
+OnEnable:
+	setcell "schg_cas02",290,98,209,105,cell_walkable,0;
+	setcell "schg_cas02",290,98,209,105,cell_shootable,0;
+	guardian "schg_cas02",290,98," ",1905,"#sch02_RL00::OnBarrierDestroyed"; //24;
+	guardian "schg_cas02",290,100," ",1905,"#sch02_RL00::OnBarrierDestroyed"; //25;
+	guardian "schg_cas02",290,102," ",1905,"#sch02_RL00::OnBarrierDestroyed"; //26;
+	guardian "schg_cas02",290,104," ",1905,"#sch02_RL00::OnBarrierDestroyed"; //27;
+	end;
+
+OnDisable:
+	setcell "schg_cas02",290,98,209,105,cell_walkable,1;
+	setcell "schg_cas02",290,98,209,105,cell_shootable,1;
+	killmonster "schg_cas02","#sch02_RL00::OnBarrierDestroyed";
+	end;
+
+OnBarrierDestroyed:
+	end;
+}
+
+schg_cas02,2,2,0	script	#sch02_RL01	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas02",279,98,279,105,cell_walkable,0;
+	guardian "schg_cas02",280,98," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //28;
+	guardian "schg_cas02",280,100," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //29;
+	guardian "schg_cas02",280,102," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //30;
+	guardian "schg_cas02",281,99," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //31;
+	guardian "schg_cas02",281,101," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //32;
+	guardian "schg_cas02",281,103," ",1905,"#sch02_RL01::OnBarrierDestroyed"; //33;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc02[2],1;
+		mapannounce "schg_cas02","The 1st Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas02",279,98,279,105,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas02",279,98,279,105,cell_walkable,1;
+	killmonster "schg_cas02","#sch02_RL01::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas02,2,3,0	script	#sch02_RL02	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas02",230,213,230,218,cell_walkable,0;
+	guardian "schg_cas02",231,214," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //34;
+	guardian "schg_cas02",231,216," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //35;
+	guardian "schg_cas02",231,218," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //36;
+	guardian "schg_cas02",232,213," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //37;
+	guardian "schg_cas02",232,215," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //38;
+	guardian "schg_cas02",232,217," ",1905,"#sch02_RL02::OnBarrierDestroyed"; //39;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc02[3],1;
+		mapannounce "schg_cas02","The 2nd Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas02",230,213,230,218,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas02",230,213,230,218,cell_walkable,1;
+	killmonster "schg_cas02","#sch02_RL02::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas02,2,4,0	script	#sch02_RL03	-1,{
+OnEnable:
+	set .MyMobCount,4;
+	setcell "schg_cas02",160,141,165,141,cell_walkable,0;
+	guardian "schg_cas02",160,140," ",1905,"#sch02_RL03::OnBarrierDestroyed"; //40;
+	guardian "schg_cas02",162,140," ",1905,"#sch02_RL03::OnBarrierDestroyed"; //41;
+	guardian "schg_cas02",164,140," ",1905,"#sch02_RL03::OnBarrierDestroyed"; //42;
+	guardian "schg_cas02",166,140," ",1905,"#sch02_RL03::OnBarrierDestroyed"; //43;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc02[4],1;
+		mapannounce "schg_cas02","The 3rd Fortress Gate is destroyed!",bc_map,"0x00ff00";
+		setcell "schg_cas02",160,141,165,141,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas02",160,141,165,141,cell_walkable,1;
+	killmonster "schg_cas02","#sch02_RL03::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas02,288,97,0	script	Control Device01#sch02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc02[2] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon,";
+									mes "but it's not working very well.^FFFFFF ^3355FF You'll have to try something else.";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch02_RL01::OnEnable";
+							disablenpc "Control Device01#sch02";
+							mapannounce "schg_cas02","The 1st Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc02[2],0;
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "Control Device01#sch02";
+	end;
+
+OnEnable:
+	enablenpc "Control Device01#sch02";
+	end;
+
+OnDisable:
+	disablenpc "Control Device01#sch02";
+	end;
+}
+
+schg_cas02,230,209,0	script	Control Device02#sch02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc02[3] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch02_RL02::OnEnable";
+							disablenpc "Control Device02#sch02";
+							mapannounce "schg_cas02","The 2nd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc02[3],0; //Global Variable
+							setarray $agit_sc02[2],2; //Global Variable
+							donpcevent "Control Device01#sch02::OnEnable";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "Control Device02#sch02";
+	end;
+
+OnEnable:
+	enablenpc "Control Device02#sch02";
+	end;
+
+OnDisable:
+	disablenpc "Control Device02#sch02";
+	end;
+}
+
+schg_cas02,159,143,0	script	Control Device03#sch02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc02[4] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close;
+							donpcevent "#sch02_RL03::OnEnable";
+							disablenpc "Control Device03#sch02";
+							mapannounce "schg_cas02","The 3rd Fortress Gate has been reconstructed!!",bc_map,"0x00ff00";
+							setarray $agit_sc02[4],0;
+							setarray $agit_sc02[3],2;
+							donpcevent "Control Device02#sch02::OnDevice02#sch02_dlrp02";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "Control Device03#sch02";
+	end;
+
+OnEnable:
+	enablenpc "Control Device03#sch02";
+	end;
+
+OnDisable:
+	disablenpc "Control Device03#sch02";
+	end;
+}
+
+// Link Flags
+schg_cas02,143,198,0	script	LF-01#schg_cas02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("First Gate House:Second Gate House:Cancel")) {
+		case 1:
+			warp "schg_cas02",235,44;
+			end;
+		case 2:
+			warp "schg_cas02",302,233;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas02,143,202,0	script	LF-02#schg_cas02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense area 1-1:Defense area 1-2:Cancel")) {
+		case 1:
+			warp "schg_cas02",317,83;
+			end;
+		case 2:
+			warp "schg_cas02",359,83;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas02,143,206,0	script	LF-03#schg_cas02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense area 2-1:Defense area 2-2:Cancel")) {
+		case 1:
+			warp "schg_cas02",283,79;
+			end;
+		case 2:
+			warp "schg_cas02",280,122;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas02,145,208,0	script	LF-04#schg_cas02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense area 3-1:Defense area 3-2:Cancel")) {
+		case 1:
+			warp "schg_cas02",215,110;
+			end;
+		case 2:
+			warp "schg_cas02",255,215;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas02,180,208,0	script	LF-05#schg_cas02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Center 1 Area:Center 2 Area:Cancel")) {
+		case 1:
+			warp "schg_cas02",338,153;
+			end;
+		case 2:
+			warp "schg_cas02",213,226;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas02,182,206,0	script	LF-06#schg_cas02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense area 1-1:Defense area 2-1:Defense area 3-1:Cancel")) {
+		case 1:
+			warp "schg_cas02",317,83;
+			end;
+		case 2:
+			warp "schg_cas02",283,79;
+			end;
+		case 3:
+			warp "schg_cas02",215,110;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas02,182,202,0	script	LF-07#schg_cas02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Area 1-2:Area 2-2:Area 3-2:Cancel")) {
+		case 1:
+			warp "schg_cas02",359,83;
+			end;
+		case 2:
+			warp "schg_cas02",280,122;
+			end;
+		case 3:
+			warp "schg_cas02",255,215;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas02,182,198,0	script	LF-08#schg_cas02	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to the";
+		mes "Convenience Facility for";
+		mes "guild members?^000000";
+		switch(select("Go to Convenience Facility:Cancel")) {
+		case 1:
+			warp "schg_cas02",101,306;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas02,235,222,0	script	Andlangr#LF_sc02_1::LF_sc02_1	111,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to";
+		mes "the Emperium Center?^000000";
+		switch(select("Teleport:Cancel")) {
+		case 1:
+			warp "schg_cas02",136,188;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas02,157,136,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_2	111
+schg_cas02,168,136,4	duplicate(LF_sc02_1)	Andlangr#LF_sc02_3	111
+schg_cas02,320,232,4	duplicate(LF_sc02_1)	Andlangr#LF_sc02_4	111
+schg_cas02,295,109,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_5	111
+schg_cas02,295,92,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_6	111
+schg_cas02,285,90,4	duplicate(LF_sc02_1)	Andlangr#LF_sc02_7	111
+schg_cas02,285,190,4	duplicate(LF_sc02_1)	Andlangr#LF_sc02_8	111
+schg_cas02,238,66,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_9	111
+schg_cas02,230,45,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_10	111
+schg_cas02,233,120,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_11	111
+schg_cas02,247,120,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_12	111
+schg_cas02,261,162,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_13	111
+schg_cas02,244,162,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_14	111
+schg_cas02,235,207,0	duplicate(LF_sc02_1)	Andlangr#LF_sc02_15	111
+
+// Guild Manager
+schg_cas02,105,378,3	script	Steward#sch02	55,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (.@GID == 0) {
+		mes "[ Steward ]";
+		mes "I await for the master";
+		mes "whom destiny will choose";
+		mes "for me. Do you think you";
+		mes "have to courage and strength";
+		mes "to conquer this stronghold?";
+		close;
+	}
+	if (getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)) {
+		mes "[ Steward ]";
+		mes "Hmpf. Your threats don't";
+		mes "scare me! Guardians, drive";
+		mes "this infidel away from here!";
+		mes "I will always be loyal to the";
+		mes "master of this stronghold,";
+		MES "the one and only^FF0000" + getguildmaster(.@GID) + "^000000.";
+		close;
+	}
+	mes "[ Steward ]";
+	mes "Ah, Master ^FF0000" + getguildmaster(.@GID) + "^000000...";
+	mes "How shall I serve you today?";
+	mes "Was there an aspect of this";
+	mes "stronghold's maintenance";
+	mes "you wanted to discuss?";
+	next;
+	switch(select("Stronghold Briefing:Invest in Commercial Growth:Invest in Defense growth:Hire/Fire Storage Staff:Go to Master's room")) {
+	case 1:
+		mes "[ Steward ]";
+		mes "The Commercial Growth";
+		mes "Level of the stronghold is ^0000ff" + GetCastleData("schg_cas02",2) + ".";
+		if (GetCastleData("schg_cas02",4) > 0) {
+			mes "Last time, you invested in";
+			mes "Commercial Growth " + GetCastleData("schg_cas02",4) + ".";
+		}
+		next;
+		mes "[ Steward ]";
+		mes "Our stronghold's";
+		mes "safeguard level is " + GetCastleData("schg_cas02",3) + ".";
+		if (GetCastleData("schg_cas02",5) > 0) {
+			mes "Last time, you invested";
+			mes "in defense " + GetCastleData("schg_cas02",5) + " times.";
+		}
+		mes " ";
+		mes "That is all, master.";
+		close;
+	case 2:
+		set .@Economy,GetCastleData("schg_cas02",2);
+		if(.@Economy < 8) set .@eco_invest,10000;
+		if(.@Economy >= 8) set .@eco_invest,20000;
+		if(.@Economy >= 16) set .@eco_invest,40000;
+		if(.@Economy >= 25) set .@eco_invest,80000;
+		if(.@Economy >= 34) set .@eco_invest,160000;
+		if(.@Economy >= 44) set .@eco_invest,320000;
+		if(.@Economy >= 54) set .@eco_invest,640000;
+		if(.@Economy >= 65) set .@eco_invest,1280000;
+		if(.@Economy >= 76) set .@eco_invest,2560000;
+		if(.@Economy >= 88) set .@eco_invest,5120000;
+		mes "[ Steward ]";
+		mes "Raising the stronghold's";
+		mes "commercial growth will";
+		mes "increase the quantity of";
+		mes "goods produced for the guild.";
+		mes "Investing in commercial growth";
+		mes "will help the guild's future.";
+		next;
+		mes "[ Steward ]";
+		mes "You can make one investment";
+		mes "each day, but if you can make";
+		mes "two investments if you pay";
+		mes "more zeny: this will speed";
+		mes "up commercial development,";
+		mes "but can be quite expensive.";
+		next;
+		if (.@Economy == 100) {
+			mes "[ Steward ]";
+			mes "However, our stronghold's";
+			mes "commerical growth level is";
+			mes "at 100%. It's not possible to";
+			mes "develop commercial growth";
+			mes "any further than that.";
+			close;
+		}
+		if (GetCastleData("schg_cas02",4) == 2) {
+			mes "[ Steward ]";
+			mes "You've already made two";
+			mes "investments today, so you'll";
+			mes "have to wait until tomorrow";
+			mes "to make another investment.";
+			close;
+		}
+		if (GetCastleData("schg_cas02",4) == 0) {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000 zeny";
+			mes "to make an investment";
+			mes "Will you invest in this";
+			mes "stronghold's commerical";
+			mes "development now?";
+		}
+		else {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000";
+			mes "more zeny to make a second";
+			mes "investment today. Will you";
+			mes "invest one more time?";
+		}
+		next;
+		switch(select("Invest in Commercial Growth:Cancel")) {
+		case 1:
+			if (Zeny < .@eco_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				end;
+			}
+			set zeny,zeny-.@eco_invest;
+			SetCastleData "schg_cas02",4,GetCastleData("schg_cas02",4)+1;
+			SetCastleData "schg_cas02",2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. We can expect";
+			mes "to see the results of this";
+			mes "investment by tomorrow.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 3:
+		set .@Defence,GetCastleData("schg_cas02",3);
+		if(.@Defence < 8) set .@def_invest,20000;
+		if(.@Defence >= 8) set .@def_invest,40000;
+		if(.@Defence >= 16) set .@def_invest,80000;
+		if(.@Defence >= 25) set .@def_invest,160000;
+		if(.@Defence >= 34) set .@def_invest,320000;
+		if(.@Defence >= 44) set .@def_invest,640000;
+		if(.@Defence >= 54) set .@def_invest,1280000;
+		if(.@Defence >= 65) set .@def_invest,2560000;
+		if(.@Defence >= 76) set .@def_invest,5120000;
+		if(.@Defence >= 88) set .@def_invest,10240000;
+		mes "[ Steward ]";
+		mes "Investing in our stronghold's";
+		mes "defense will enhance the";
+		mes "durability of our Guardians";
+		mes "and the Emperium. We'll need";
+		mes "every advantage to protect";
+		mes "ourselves from our enemies.";
+		next;
+		mes "[ Steward ]";
+		mes "You can invest in defense";
+		mes "once per day, but if you pay";
+		mes "more zeny, you can invest";
+		mes "a maximum of two times daily.";
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas02",3) == 100) {
+			mes "The Defense Level of this";
+			mes "stronghold is 100%, and";
+			mes "cannot be increased further.";
+			close;
+		}
+		if (GetCastleData("schg_cas02",5) == 2) {
+			mes "Master, you've already";
+			mes "invested in Defense twice";
+			mes "today. You'll need to wait";
+			mes "until tomorrow if you really";
+			mes "want to increase our defenses.";
+			close;
+		}
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas02",5) == 0) {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses.";
+			mes "Will you invest now?";
+		}
+		else {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses";
+			mes "a second time today.";
+			mes "Will you invest now?";
+		}
+		next;
+		switch(select("Invest in Defense:Cancel")) {
+		case 1:
+			if (Zeny < .@def_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				close;
+			}
+			set zeny,zeny-.@def_invest;
+			SetCastleData "schg_cas02",5,GetCastleData("schg_cas02",5)+1;
+			SetCastleData "schg_cas02",3,.@Defence+1;
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. Increasing";
+			mes "the frequency of treasure";
+			mes "procured by the guild will";
+			mes "definitely help us all.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 4:
+		if (GetCastleData("schg_cas02",9) == 1) {
+			mes "[ Steward ]";
+			mes "Do you wish to dismiss";
+			mes "the Kafra Employee that";
+			mes "we've hired for the guild?";
+			next;
+			switch(select("Dismiss:Cancel")) {
+			case 1:
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "Master, please reconsider!";
+				mes "I've been working very hard";
+				mes "for the success of the guild!";
+				mes "I'll try harder to serve the";
+				mes "guild members of this";
+				mes "stronghold, I promise!";
+				next;
+				switch(select("Dismiss:Cancel")) {
+				case 1:
+					mes "[ Hired Kafra Employee ]";
+					mes "Why?! What have I done";
+					mes "to deserve this? Waaah~!";
+					next;
+					cutin "kafra_01",255;
+					break;
+				case 2:
+					mes "[ Hired Kafra Employee ]";
+					mes "Thank you, Master!";
+					mes "I'll obey your every";
+					mes "command as best I can!";
+					mes "You won't regret this!";
+					close;
+				}
+				break;
+			case 2:
+				mes "[ Steward ]";
+				mes "She works very hard,";
+				mes "in my opinion. It was in";
+				mes "all of our best interests to";
+				mes "allow her to stay with us.";
+				close;
+			}
+			disablenpc "Kafra Employee#sch02";
+			SetCastleData "schg_cas02",9,0;
+			mes "[ Steward ]";
+			mes "That Kafra Employee";
+			mes "has been dismissed.";
+			mes "Were really dissatisfied";
+			mes "by the quality of her service?";
+			close;
+		}
+		else {
+			mes "[ Steward ]";
+			mes "Will you hire a";
+			mes "Kafra Employee to serve";
+			mes "our stronghold? You must";
+			mes "pay ^FF000010,000 zeny^000000 to hire one.";
+			next;
+			switch(select("Hire:Cancel")) {
+			case 1:
+				if (getgdskilllv(.@GID,10001) == 0) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "you have not yet attained";
+					mes "the ^FF0000Contract with Kafra^000000";
+					mes "guild skill.";
+					close;
+				}
+				if (Zeny < 10000) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "we do not have enough";
+					mes "funds to pay the contract fee.";
+					close;
+				}
+				set zeny,zeny-10000;
+				enablenpc "Kafra Employee#sch02";
+				SetCastleData "schg_cas02",9,1;
+				mes "[ Steward ]";
+				mes "Very well. We have formed";
+				mes "a contract with the Kafra";
+				mes "Head Office, and hired a";
+				mes "Kafra Employee for our";
+				mes "stronghold. Here she is~";
+				next;
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "How do you do? I've";
+				mes "been dispatched by the";
+				mes "Kafra Head Office to";
+				mes "serve your guild's needs.";
+				mes "I'll do my best to follow";
+				mes "your every command, Master.";
+				next;
+				cutin "kafra_01",255;
+				mes "[ Steward ]";
+				mes "Our contract will expire";
+				mes "after one month, so we must";
+				mes "pay additional fees to keep";
+				mes "this Kafra Employee in";
+				mes "the service of our guild.";
+				close;
+			case 2:
+				mes "[ Steward ]";
+				mes "As you command, Master.";
+				mes "However, I suggest hiring";
+				mes "a Kafra Employee as soon";
+				mes "as possible since our guild";
+				mes "would greatly benefit from";
+				mes "the convenient Kafra services.";
+				close;
+			}
+		}
+	case 5:
+		mes "[ Steward ]";
+		mes "Do you wish to enter the";
+		mes "Guild Treasure Room?";
+		mes "Only you, the Guild Master,";
+		mes "are permitted to enter.";
+		next;
+		mes "[ Steward ]";
+		mes "Please remember to open";
+		mes "the Treasure Boxes at the";
+		mes "proper time. Otherwise, the";
+		mes "treasure may disappear if";
+		mes "something unexpected happens.";
+		next;
+		switch(select("Go to Treasure Room:Cancel")) {
+		case 1:
+			mes "[ Steward ]";
+			mes "Allow me to guide you";
+			mes "on the secret path to";
+			mes "the Treasure Room.";
+			mes "Press the secret switch";
+			mes "when you wish to return here.";
+			close2;
+			warp "schg_cas02",249,373;
+			end;
+		case 2:
+			mes "[ Steward ]";
+			mes "Items in the Treasure Room";
+			mes "are produced once each day.";
+			mes "Therefore, you must obtain";
+			mes "the treasure items everyday.";
+			mes "For the sake of the guild,";
+			mes "prioritize treasure harvesting!";
+			close;
+		}
+	}
+
+Onstop:
+	stopnpctimer;
+	end;
+
+OnStartArena:
+	set .@GID,getcharid(2);
+	// Lower castle Economy
+	set .@Economy,GetCastleData("schg_cas02",2) - 5;
+	if (.@Economy < 0) set .@Economy, 0;
+	SetCastleData "schg_cas02", 2, .@Economy;
+	// Lower Castle Defence
+	set .@Defence,GetCastleData("schg_cas02",3) - 5;
+	if (.@Defence < 0) set .@Defence, 0;
+	SetCastleData "schg_cas02", 3, .@Defence;
+	// Set new owner
+	SetCastleData "schg_cas02",1, .@GID;
+	// Clear castle's data.
+	for( set .@i, 4; .@i <= 9; set .@i, .@i+1 )
+		SetCastleData "schg_cas02", .@i, 0;
+	// Disable Kafra
+	disablenpc "Kafra Employee#sch02";
+
+	set .msg,2;
+	if (.msg == 1) {
+		announce "Fortress [" + GetCastleName("schg_cas02") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch02_02::Onstart";
+	}
+	else if (.msg == 2) {
+		announce "The [" + getguildname(.@gid) + "] conquered the [Nithafjoll 2] stronghold of "+GetCastleName("schg_cas02"),bc_all;
+		mapannounce "schg_cas02","The emperium has been shattered!",bc_map,"0x00FF00";
+		if (agitcheck()) {
+			donpcevent "Manager#sch02_02::Onreset";
+			initnpctimer;
+		}
+		else {
+			donpcevent "Manager#sch02_02::Onreset";
+			stopnpctimer;
+		}
+	}
+	else if (.msg == 0) {
+		announce "Fortress [" + GetCastleName("schg_cas02") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch02_02::Onreset";
+		stopnpctimer;
+		end;
+	}
+	MapRespawnGuildID "schg_cas02",GetCastleData("schg_cas02",1),2;
+	GetCastleData "schg_cas02",0,"::OnRecvCastlesc02";
+	end;
+
+OnTimer10000:
+	donpcevent "Manager#sch02_02::Onchange";
+	mapannounce "schg_cas02","Rebuild this stonghold's Guardian Stones and Fortress Gates to secure your guild's new aquisition!",bc_map,"0x00FF00";
+	end;
+}
+
+// Guild Kafra
+schg_cas02,131,365,3	script	Kafra Employee#sch02	117,{
+	cutin "kafra_01",2;
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (getcharid(2) == .@GID && getgdskilllv(.@GID,10001)) {
+		mes "[Kafra Employee]";
+		mes "Welcome, proud member";
+		mes "of the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild!";
+		mes "The Kafra Corporation is ready";
+		mes "to assist you wherever you go!";
+		next;
+		switch(select("Use Storage:Use Warp Service:Rent Pushcart:Cancel")) {
+		case 1:
+			if (basicskillcheck() && getskilllv(1) < 6) {
+				mes "[Kafra Employee]";
+				mes "I'm so sorry, but you must";
+				mes "have at least Novice Skill";
+				mes "Lv.6 to use the Storage.";
+			}
+			else {
+				openstorage;
+			}
+			break;
+		case 2:
+			mes "[Kafra Employee]";
+			mes "Please tell me your";
+			mes "Warp destination.";
+			next;
+			switch(select("Juno -> 200 z:Cancel")) {
+			case 1:
+				if (Zeny < 200) {
+					mes "[Kafra Employee]";
+					mes "I'm sorry, but you don't";
+					mes "have enough zeny to pay";
+					mes "the warp fee. Would you";
+					mes "please check your funds again?";
+					close2;
+					cutin "kafra_01",255;
+					end;
+				}
+				set zeny,zeny-200;
+				warp "yuno",158,125;
+				end;
+			case 2:
+				cutin "kafra_01",255;
+			}
+			break;
+		case 3:
+			if (BaseClass != Job_Merchant) {
+				mes "[Kafra Employee]";
+				mes "I'm sorry, but the Pushcart";
+				mes "rental service can only be";
+				mes "used by Merchant, Blacksmith,";
+				mes "and Alchemist class characters.";
+			}
+			else if (checkcart() == 1) {
+				mes "[Kafra Employee]";
+				mes "Hm? You've already";
+				mes "rented a Pushcart.";
+			}
+			else {
+				mes "[Kafra Employee]";
+				mes "The Pushcart rental fee";
+				mes "is 800 zeny. Would you";
+				mes "like to rent a Pushcart?";
+				next;
+				switch(select("Rent Pushcart:Cancel")) {
+				case 1:
+					if (Zeny < 800) {
+						mes "[Kafra Employee]";
+						mes "I'm sorry, but you don't";
+						mes "have enough zeny to rent";
+						mes "one of our Pushcarts.";
+						close2;
+						cutin "kafra_01",255;
+						end;
+					}
+					set zeny,zeny-800;
+					setcart;
+					break;
+				case 2:
+					break;
+				}
+			}
+			break;
+		case 4:
+			mes "[Kafra Employee]";
+			mes "Thank you for using the";
+			mes "Kafra Service. Wherever";
+			mes "you go, Kafra will be";
+			mes "there to support you!";
+			close2;
+			cutin "kafra_01",255;
+			end;
+		}
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+	else {
+		mes "[Kafra Employee]";
+		mes "I'm sorry, but I've been";
+		mes "exclusively contracted";
+		mes "to the members of the";
+		mes "^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		mes "You'll have to ask another";
+		mes "Kafra Employee to help you...";
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+
+OnRecvCastlesc02:
+	if (GetCastleData("schg_cas02",1) == 0) {
+		monster "schg_cas02",0,0,"Evil Druid",1117,10;
+		monster "schg_cas02",0,0,"Khalitzburg",1132,4;
+		monster "schg_cas02",0,0,"Abysmal Knight",1219,3;
+		monster "schg_cas02",0,0,"Executioner",1205,1;
+		monster "schg_cas02",0,0,"Penomena",1216,10;
+		monster "schg_cas02",0,0,"Alarm",1193,18;
+		monster "schg_cas02",0,0,"Clock",1269,9;
+		monster "schg_cas02",0,0,"Raydric Archer",1276,12;
+		monster "schg_cas02",0,0,"Wanderer",1208,3;
+		monster "schg_cas02",0,0,"Alice",1275,1;
+		monster "schg_cas02",0,0,"Bloody Knight",1268,2;
+		monster "schg_cas02",0,0,"Dark Lord",1272,2;
+		monster "schg_cas02",0,0,"Tower Keeper",1270,4;
+	}
+	if (GetCastleData("schg_cas02",9) < 1) {
+		disablenpc "Kafra Employee#sch02";
+	}
+	end;
+}
+
+schg_cas02,257,369,0	script	#sc02_switch 	111,{
+	mes " ";
+	mes "^3355FFWill you pull";
+	mes "this small lever?^000000";
+	next;
+	switch(select("Pull Lever:Cancel")) {
+	case 1:
+		warp "schg_cas02",339,79;
+		end;
+	case 2:
+		close;
+	}
+}
+
+sch_gld,296,247,4	script	Andlangr#flag_sc02_1::Sc02_Flag	722,{
+	set .@GID, GetCastleData("schg_cas02",1);
+	if (.@GID == 0) {
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt declares that";
+		mes "one has yet to claim lordship";
+		mes "over this stronghold. The one";
+		mes "that breaks the Emperium will";
+		mes "be recognized as its new owner.";
+		close;
+	}
+	else {
+		if (getcharid(2) == .@GID) {
+			mes "[ Ringing Voice ]";
+			mes "Courageous one,";
+			mes "do you wish to return";
+			mes "to your stronghold?";
+			next;
+			switch(select("Return to the Stronghold:Cancel")) {
+			case 1:
+				set .@GID, GetCastleData("schg_cas02",1);
+				if (getcharid(2) == .@GID) {
+					warp "schg_cas02",136,188;
+					end;
+				}
+				close;
+			case 2:
+				close;
+			}
+		}
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt decrees that";
+		mes "this stronghold is owned";
+		mes "by the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		next;
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "^FF0000" + GetGuildMaster(.@GID) + "^000000 is";
+		mes "Guild Master of ^FF0000" + GetGuildName(.@GID) + "^000000.";
+		mes "Any that object must claim this";
+		mes "stronghold through strength of";
+		mes "steel and magic during the";
+		mes "appointed Guild Siege times.";
+		close;
+	}
+
+OnRecvCastlesc02:
+	FlagEmblem GetCastleData("schg_cas02",1);
+	end;
+}
+
+sch_gld,280,247,4	duplicate(Sc02_Flag)	Andlangr#flag_sc02_2	722

+ 2858 - 0
npc/guild2/schg_cas03.txt

@@ -0,0 +1,2858 @@
+//===== eAthena Script =======================================
+//= War of Emperium Second Edition
+//===== By: ==================================================
+//= L0ne_W0lf
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= eAthena SVN
+//===== Description: =========================================
+//= WoE SE Schwaltzvalt Castle 3
+//===== Additional Comments: =================================
+//= 1.0 First Version [L0ne_W0lf]
+//============================================================
+
+schg_cas03,1,1,0	script	manager#sch03_02	111,{
+	end;
+
+OnInterIfInitOnce:
+	GetCastleData "schg_cas03",0,"::OnRecvCastleSc03";
+	end;
+
+OnRecvCastlesc03:
+	RequestGuildInfo GetCastleData("schg_cas03",1);
+	if (GetCastleData("schg_cas03",1) == 0) {
+		donpcevent "Manager#sch03_02::Onstart";
+	}
+	end;
+
+OnAgitStart:
+	if (agitcheck()) {
+		MapRespawnGuildID "schg_cas03",GetCastleData("schg_cas03",1),2;
+		GvgOn "schg_cas03";
+		donpcevent "manager#sch03_02::Onstart";
+	}
+	else {
+		donpcevent "#sch03_RL00::OnDisable";
+		donpcevent "#sch03_RL01::OnDisable";
+		donpcevent "#sch03_RL02::OnDisable";
+		donpcevent "#sch03_RL03::OnDisable";
+	}
+	end;
+
+OnAgitEnd:
+	GvgOff "schg_cas03";
+	if (GetCastleData("schg_cas03",1)) {
+		KillMonster "schg_cas03","Steward#sch03::OnStartArena";
+		donpcevent "Manager#sch03_02::Onreset";
+	}
+	end;
+
+Onstart:
+	// 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians
+	// Settings for all but Summon Guardians
+	// 0 = Okay; 1 = Destroyed; 2 = Repairing
+	// Summon Guardians
+	// 0 = Do not Summon; 1 = Summon
+	if (GetCastleData("schg_cas03",1)) {
+		setarray $agit_sc03[0],0,0,0,0,0,0;
+		donpcevent "#sch03_df01::OnEnable";
+		donpcevent "#sch03_df02::OnEnable";
+		donpcevent "#sch03_RL00::OnEnable";
+		donpcevent "#sch03_RL01::OnEnable";
+		donpcevent "#sch03_RL02::OnEnable";
+		donpcevent "#sch03_RL03::OnEnable";
+	}
+	monster "schg_cas03",338,202,"Emperium",1288,1,"Steward#sch03::OnStartArena";
+	end;
+
+Onreset:
+	donpcevent "#sch03_df01::OnDisable";
+	donpcevent "#sch03_df02::OnDisable";
+	donpcevent "#sch03_gard01::Onreset";
+	donpcevent "#sch03_gard02::Onreset";
+	donpcevent "#sch03_RL00::OnDisable";
+	donpcevent "#sch03_RL01::OnDisable";
+	donpcevent "#sch03_RL02::OnDisable";
+	donpcevent "#sch03_RL03::OnDisable";
+	donpcevent "1st Guardian Stone#sch03::OnDisable";
+	donpcevent "2nd Guardian Stone#sch03::OnDisable";
+	donpcevent "control device01#sch03::OnDisable";
+	donpcevent "control device02#sch03::OnDisable";
+	donpcevent "control device03#sch03::OnDisable";
+	if (agitcheck()) {
+		setarray $agit_sc03[0],0,0,1,1,1,0;
+	}
+	end;
+
+Onchange:
+	setarray $agit_sc03[0],2,2,1,1,2,0;
+	monster "schg_cas03",338,202,"Emperium",1288,1,"Steward#sch03::OnStartArena";
+	donpcevent "control device03#sch03::OnEnable";
+	donpcevent "1st Guardian Stone#sch03::OnEnable";
+	donpcevent "2nd Guardian Stone#sch03::OnEnable";
+	end;
+
+OnClock0001:
+	set .@Treasure,GetCastleData("schg_cas03",2)/5+4;
+	if (.@Treasure) {
+		monster "schg_cas03",189,21,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 2) end;
+		monster "schg_cas03",190,21,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 3) end;
+		monster "schg_cas03",191,21,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 4) end;
+		monster "schg_cas03",192,21,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 5) end;
+		monster "schg_cas03",193,21,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 6) end;
+		monster "schg_cas03",194,21,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 7) end;
+		monster "schg_cas03",189,19,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 8) end;
+		monster "schg_cas03",190,19,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 9) end;
+		monster "schg_cas03",191,19,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 10) end;
+		monster "schg_cas03",192,19,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 11) end;
+		monster "schg_cas03",193,19,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 12) end;
+		monster "schg_cas03",194,19,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 13) end;
+		monster "schg_cas03",189,17,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 14) end;
+		monster "schg_cas03",190,17,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 15) end;
+		monster "schg_cas03",191,17,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 16) end;
+		monster "schg_cas03",192,17,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 17) end;
+		monster "schg_cas03",193,17,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 18) end;
+		monster "schg_cas03",194,17,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 19) end;
+		monster "schg_cas03",189,15,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 20) end;
+		monster "schg_cas03",190,15,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 21) end;
+		monster "schg_cas03",191,15,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 22) end;
+		monster "schg_cas03",192,15,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 23) end;
+		monster "schg_cas03",193,15,"Treasure Chest",1939,1,"Manager#sch03_02::OnTreasureDied";
+		if (.@Treasure < 24) end;
+		monster "schg_cas03",194,15,"Treasure Chest",1324,1,"Manager#sch03_02::OnTreasureDied";
+	}
+	end;
+
+OnTreasureDied:
+	end;
+}
+
+schg_cas03,287,226,5	script	Elzee#sch03_01	868,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (.@GID == 0) {
+		mes "[Elzee]";
+		mes "Great job. Now, all you";
+		mes "need to do is destroy this";
+		mes "Emperium to gain ownership";
+		mes "over this stronghold.";
+		close;
+	}
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) != getguildmaster(.@GID)) {
+			mes "[Elzee]";
+			mes "As guardian of this";
+			mes "stronghold, I answer only";
+			mes "to the master of the guild";
+			mes "that controls this place.";
+			close;
+		}
+		else {
+			if (agitcheck() == 0) {
+				mes "[Elzee]";
+				mes "I am Elzee, guardian of";
+				mes "this stronghold. For now,";
+				mes "all is quiet in this place.";
+				next;
+				switch(select("Converse:Cancel")) {
+				case 1:
+					mes "[Elzee]";
+					mes "Do you have any questions";
+					mes "about this stronghold?";
+					next;
+					switch(select("Guardian Stones:Fortress Gates:Link Flags:Battle Strategy:Cancel")) {
+					case 1:
+						mes "[Elzee]";
+						mes "There is one Emperium";
+						mes "and two Guardian Stones in";
+						mes "each fortress. These stones";
+						mes "are the first line of defense,";
+						mes "and must be destroyed before";
+						mes "enemies can even enter.";
+						next;
+						mes "[Elzee]";
+						mes "The stones are located in";
+						mes "^4D4DFFGate Houses^000000 which must be";
+						mes "protected to prevent enemies";
+						mes "from reaching the Emperium.";
+						mes "Guardian Stones can ^4D4DFFrecall";
+						mes "your Guardians^000000 for protection.";
+						next;
+						mes "[Elzee]";
+						mes "Fortresses with higher levels";
+						mes "of defense can summon more";
+						mes "Guardians: this is why it is";
+						mes "so important for guilds to";
+						mes "invest in Defense Growth.";
+						next;
+						mes "[Elzee]";
+						mes "Guardian Stones that have";
+						mes "been destroyed can be revived";
+						mes "after a certain time, but one of^FFFFFF ^000000 the guild members must give";
+						mes "me the order. I can also report^FFFFFF ^000000 the status of the Guardian Stones.";
+						close;
+					case 2:
+						mes "[Elzee]";
+						mes "^4D4DFFFortress Gates^000000 are the second ^FFFFFF ^000000 line of guild stronghold defense,";
+						mes "and are protected by extra barricades activated by the Guardian Stones.";
+						mes "These gates are located in three different parts of the fortress.";
+						next;
+						mes "[Elzee]";
+						mes "Barricades are protected by";
+						mes "Guardian Stones, and are";
+						mes "restored when the Guardian";
+						mes "Stones are retrieved. However,";
+						mes "it is not as easy to restore";
+						mes "destroyed Fortress Gates.";
+						next;
+						mes "[Elzee]";
+						mes "Fortress Gates can only be";
+						mes "restored when the ^4D4DFFguild";
+						mes "master of a stronghold";
+						mes "changes^000000, or if ^4D4DFFrestoration";
+						mes "is requested by the guild";
+						mes "master of the stronghold^000000.";
+						close;
+					case 3:
+						mes "[Elzee]";
+						mes "Strongholds have many";
+						mes "Link Flags that allow you";
+						mes "to access vital areas within";
+						mes "restrictions placed by the";
+						mes "Barricades. Usually, ^4D4DFFFlag 1";
+						mes "links to the Gate House^000000.";
+						next;
+						mes "[Elzee]";
+						mes "Many flags link directly to";
+						mes "the flag near the Emperium.";
+						mes "The final numbered flag is";
+						mes "linked to the Convenience";
+						mes "Facility of the stronghold's";
+						mes "owner. Keep this in mind.";
+						close;
+					case 4:
+						mes "[Elzee]";
+						mes "Strategy? It would be better";
+						mes "to develop your battle plan to";
+						mes "exploit your guild's advantages";
+						mes "and your enemies' weaknesses.";
+						mes "Use the Gate Houses and Barricades, and rebuild as quickly as you can!";
+						close;
+					case 5:
+						mes "[Elzee]";
+						mes "You have no questions";
+						mes "to ask of me? Well, I'm";
+						mes "here to serve your needs.";
+						close;
+					}
+				case 2:
+					mes "[Elzee]";
+					mes "I'm always here, so";
+					mes "feel free to request my";
+					mes "assistance whenever";
+					mes "the need arises.";
+					close;
+				}
+			}
+			else {
+				mes "[Elzee]";
+				mes "Greetings, "+strcharinfo(0)+".";
+				mes "What are your orders?";
+				next;
+				switch(select("Increase Stronghold Defense:Situational Briefing:Cancel")) {
+				case 1:
+					if ($agit_sc03[5] == 0) {
+						if (getgdskilllv(.@GID,10002) == 0) {
+							mes "[Elzee]";
+							mes "I'm sorry, but the Guardian";
+							mes "Stones aren't powerful enough";
+							mes "to summon Guardians yet. We";
+							mes "need to accumulate more";
+							mes "knowledge before they can";
+							mes "summon any Guardians.";
+							close;
+						}
+						else {
+							mes "[Elzee]";
+							mes "I shall endeavor to summon";
+							mes "a Guardian through a Guardian";
+							mes "Stone. However, keep in mind";
+							mes "that this will not work if the";
+							mes "Guardian Stone is destroyed.";
+							setarray $agit_sc03[5],1;
+							if ($agit_sc03[0] == 0) {
+								donpcevent "#sch03_gard01::OnEnable";
+							}
+							if ($agit_sc03[1] == 0) {
+								donpcevent "#sch03_gard02::OnEnable";
+							}
+							close;
+						}
+					}
+					else {
+						mes "[Elzee]";
+						mes "You've already commanded";
+						mes "me to summon a Guardian";
+						mes "to defend the stronghold.";
+						close;
+					}
+				case 2:
+					mes "[Elzee]";
+					mes "Our defense status is...";
+					if ($agit_sc03[0] == 1) {
+						mes "1st Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc03[0] == 2) {
+						mes "1st Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc03[1] == 1) {
+						mes "2nd Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc03[1] == 2) {
+						mes "2nd Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc03[2] == 1) {
+						mes "1st Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc03[2] == 2) {
+						mes "1st Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc03[3] == 1) {
+						mes "2nd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc03[3] == 2) {
+						mes "2nd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc03[4] == 1) {
+						mes "3rd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc03[4] == 2) {
+						mes "3rd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "3rd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					close;
+				case 3:
+					mes "[Elzee]";
+					mes "I'll be standing by,";
+					mes "awaiting your orders.";
+					close;
+				}
+			}
+		}
+	}
+	else {
+		mes "[Elzee]";
+		mes "Who are you? Scoundrel!";
+		mes "Leave this stronghold now!";
+		close;
+	}
+
+OnInit:
+	setarray $agit_sc03[0],0,0,0,0,0,0;
+	end;
+}
+
+schg_cas03,1,1,0	script	#sch03_gard01	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas03",3);
+	guardian "schg_cas03",323,308,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //0;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas03",273,309,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //1;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas03",273,309,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas03",288,306,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //2;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas03",273,309,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas03",288,306,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas03",306,326,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //3;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas03",273,309,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas03",288,306,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas03",306,326,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //3;
+		guardian "schg_cas03",323,308,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //4;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas03",306,325,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //1;
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",323,308,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //5;
+	mapannounce "schg_cas03","The 1st Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",273,309,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //6;
+	mapannounce "schg_cas03","The 2nd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer1800000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",288,306,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //7;
+	mapannounce "schg_cas03","The 3rd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer2700000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",306,325,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //8;
+	mapannounce "schg_cas03","The 4th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer3600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",273,309,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //9;
+	mapannounce "schg_cas03","The 5th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas03",120,37,"Guardian",1899,"#sch03_gard01::OnGuardianDied"; //10;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas03","#sch03_gard01::OnGuardianDied";
+	end;
+}
+
+schg_cas03,1,2,0	script	#sch03_gard02	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas03",3);
+	guardian "schg_cas03",338,309,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //11;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas03",364,305,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //12;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas03",364,305,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas03",365,261,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //13;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas03",364,305,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas03",365,261,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas03",317,318,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //14;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas03",364,305,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas03",365,261,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas03",317,318,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //14;
+		guardian "schg_cas03",338,310,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //15;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas03",364,305,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //12;
+	}
+	initnpctimer;
+	end;
+
+OnTimer600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",338,309,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //16;
+	end;
+
+OnTimer1200000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",364,305,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //17;
+	end;
+
+OnTimer2100000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",365,261,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //18;
+	end;
+
+OnTimer3000000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",317,318,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //19;
+	end;
+
+OnTimer3900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas03",364,305,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //20;
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas03",329,314,"Guardian",1899,"#sch03_gard02::OnGuardianDied"; //21;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas03","#sch02_gard03::OnGuardianDied";
+	end;
+}
+
+schg_cas03,1,3,0	script	#sch03_df01	-1,{
+OnEnable:
+	guardian "schg_cas03",242,309,"1st Guardian Stone",1907,"#sch03_df01::OnGuardianStoneDied"; //22;
+	end;
+
+OnDisable:
+	killmonster "schg_cas03","#sch03_df01::OnGuardianStoneDied";
+	setarray $agit_sc03[0],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 1st Guardian Stone is Destroyed
+	setarray $agit_sc03[0],1;
+	if (($agit_sc03[0] == 1) || ($agit_sc03[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc03[1] == 1) || ($agit_sc03[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas03","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch03_RL00::OnDisable";
+		donpcevent "#sch03_gard01::Onreset";
+	}
+	else {
+		mapannounce "schg_cas03","The 1st Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch03_gard01::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "1st Guardian Stone#sch03::OnEnable";
+	setarray $agit_sc03[0],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas03,242,309,0	script	1st Guardian Stone#sch03	844,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"1st Guardian Stone#sch03" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch03" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"1st Guardian Stone#sch03" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch03" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 3:
+							specialeffect 56; //"1st Guardian Stone#sch03" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch03" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc03[0] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "already completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch03_df01::OnEnable";
+							specialeffect 135; //"1st Guardian Stone#sch03" EF_ICECRASH
+							disablenpc "1st Guardian Stone#sch03";
+							setarray $agit_sc03[0],0;
+							set .@df_all,$agit_sc03[0]+$agit_sc03[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas03","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch03_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas03","The 1st Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc03[5] == 1) {
+								donpcevent "#sch03_gard01::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "1st Guardian Stone#sch03";
+	end;
+
+OnEnable:
+	enablenpc "1st Guardian Stone#sch03";
+	specialeffect 247; //"1st Guardian Stone#sch03" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "1st Guardian Stone#sch03";
+	end;
+}
+
+schg_cas03,1,4,0	script	#sch03_df02	-1,{
+OnEnable:
+	guardian "schg_cas03",376,251,"2nd Guardian Stone",1908,"#sch03_df02::OnGuardianStoneDied"; //23;
+	end;
+
+OnDisable:
+	killmonster "schg_cas03","#sch03_df02::OnGuardianStoneDied";
+	setarray $agit_sc03[1],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 2nd Guardian Stone is Destroyed
+	setarray $agit_sc03[1],1;
+	if (($agit_sc03[0] == 1) || ($agit_sc03[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc03[1] == 1) || ($agit_sc03[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas03","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch03_RL00::OnDisable";
+		donpcevent "#sch03_gard02::Onreset";
+	}
+	else {
+		mapannounce "schg_cas03","The 2nd Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch03_gard02::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "2nd Guardian Stone#sch03::OnGuardian";
+	setarray $agit_sc03[1],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas03,376,250,0	script	2nd Guardian Stone#sch03	844,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"2nd Guardian Stone#sch03" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch03" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"2nd Guardian Stone#sch03" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch03" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 4:
+							specialeffect 56; //"2nd Guardian Stone#sch03" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "You placed the Yellow Gemstone.";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch03" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc03[1] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "successfully completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch03_df02::OnEnable";
+							specialeffect 135; //"2nd Guardian Stone#sch03" EF_ICECRASH
+							disablenpc "2nd Guardian Stone#sch03";
+							setarray $agit_sc03[1],0;
+							set .@df_all,$agit_sc03[0]+$agit_sc03[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas03","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch03_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas03","The 2nd Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc03[5] == 1) {
+								donpcevent "#sch03_gard02::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "2nd Guardian Stone#sch03";
+	end;
+
+OnEnable:
+	enablenpc "2nd Guardian Stone#sch03";
+	specialeffect 247; //"2nd Guardian Stone#sch03" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "2nd Guardian Stone#sch03";
+	end;
+}
+
+schg_cas03,2,1,0	script	#sch03_RL00	-1,{
+OnEnable:
+	setcell "schg_cas03",326,301,331,301,cell_walkable,0;
+	setcell "schg_cas03",326,301,331,301,cell_shootable,0;
+	guardian "schg_cas03",326,300," ",1905,"#sch03_RL00::OnBarrierDestroyed"; //24;
+	guardian "schg_cas03",328,300," ",1905,"#sch03_RL00::OnBarrierDestroyed"; //25;
+	guardian "schg_cas03",330,300," ",1905,"#sch03_RL00::OnBarrierDestroyed"; //26;
+	end;
+
+OnDisable:
+	setcell "schg_cas03",326,301,331,301,cell_walkable,1;
+	setcell "schg_cas03",326,301,331,301,cell_shootable,1;
+	killmonster "schg_cas03","#sch03_RL00::OnBarrierDestroyed";
+	end;
+
+OnBarrierDestroyed:
+	end;
+}
+
+schg_cas03,2,2,0	script	#sch03_RL01	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas03",325,227,332,227,cell_walkable,0;
+	guardian "schg_cas03",326,278," ",1905,"#sch03_RL01::OnBarrierDestroyed"; //27;
+	guardian "schg_cas03",328,278," ",1905,"#sch03_RL01::OnBarrierDestroyed"; //28;
+	guardian "schg_cas03",330,278," ",1905,"#sch03_RL01::OnBarrierDestroyed"; //29;
+	guardian "schg_cas03",327,279," ",1905,"#sch03_RL01::OnBarrierDestroyed"; //30;
+	guardian "schg_cas03",329,279," ",1905,"#sch03_RL01::OnBarrierDestroyed"; //31;
+	guardian "schg_cas03",331,279," ",1905,"#sch03_RL01::OnBarrierDestroyed"; //32;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc03[2],1;
+		mapannounce "schg_cas03","The 1st Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas03",325,227,332,227,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas03",325,227,332,227,cell_walkable,1;
+	killmonster "schg_cas03","#sch03_RL01::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas03,2,3,0	script	#sch03_RL02	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas03",200,230,200,237,cell_walkable,0;
+	guardian "schg_cas03",201,231," ",1905,"#sch03_RL02::OnBarrierDestroyed"; //33;
+	guardian "schg_cas03",201,233," ",1905,"#sch03_RL02::OnBarrierDestroyed"; //34;
+	guardian "schg_cas03",201,235," ",1905,"#sch03_RL02::OnBarrierDestroyed"; //35;
+	guardian "schg_cas03",202,232," ",1905,"#sch03_RL02::OnBarrierDestroyed"; //36;
+	guardian "schg_cas03",202,234," ",1905,"#sch03_RL02::OnBarrierDestroyed"; //37;
+	guardian "schg_cas03",202,236," ",1905,"#sch03_RL02::OnBarrierDestroyed"; //38;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc03[3],1;
+		mapannounce "schg_cas03","The 2nd Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas03",200,230,200,237,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas03",200,230,200,237,cell_walkable,1;
+	killmonster "schg_cas03","#sch03_RL02::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas03,2,4,0	script	#sch03_RL03	-1,{
+OnEnable:
+	set .MyMobCount,4;
+	setcell "schg_cas03",285,198,285,205,cell_walkable,0;
+	guardian "schg_cas03",284,199," ",1905,"#sch03_RL03::OnBarrierDestroyed"; //39;
+	guardian "schg_cas03",284,201," ",1905,"#sch03_RL03::OnBarrierDestroyed"; //40;
+	guardian "schg_cas03",284,203," ",1905,"#sch03_RL03::OnBarrierDestroyed"; //41;
+	guardian "schg_cas03",284,205," ",1905,"#sch03_RL03::OnBarrierDestroyed"; //42;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc03[4],1;
+		mapannounce "schg_cas03","The 3rd Fortress Gate is destroyed!",bc_map,"0x00ff00";
+		setcell "schg_cas03",285,198,285,205,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas03",285,198,285,205,cell_walkable,1;
+	killmonster "schg_cas03","#sch03_RL03::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas03,335,298,0	script	control device01#sch03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc02[2] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon,";
+									mes "but it's not working very well.^FFFFFF ^3355FF You'll have to try something else.";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch03_RL01::OnEnable";
+							disablenpc "control device01#sch03";
+							mapannounce "schg_cas03","The 1st Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc02[2],0;
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "control device01#sch03";
+	end;
+
+OnEnable:
+	enablenpc "control device01#sch03";
+	end;
+
+OnDisable:
+	disablenpc "control device01#sch03";
+	end;
+}
+
+schg_cas03,200,227,0	script	control device02#sch03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc02[3] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch03_RL02::OnEnable";
+							disablenpc "control device02#sch03";
+							mapannounce "schg_cas03","The 2nd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc02[3],0; //Global Variable
+							setarray $agit_sc02[2],2; //Global Variable
+							donpcevent "control device01#sch03::OnEnable";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "control device02#sch03";
+	end;
+
+OnEnable:
+	enablenpc "control device02#sch03";
+	end;
+
+OnDisable:
+	disablenpc "control device02#sch03";
+	end;
+}
+
+schg_cas03,273,205,0	script	control device03#sch03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc02[4] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close;
+							donpcevent "#sch03_RL03::OnEnable";
+							disablenpc "control device03#sch03";
+							mapannounce "schg_cas03","The 3rd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc03[4],0;
+							setarray $agit_sc03[3],2;
+							donpcevent "control device02#sch03::OnEnable";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "control device03#sch03";
+	end;
+
+OnEnable:
+	enablenpc "control device03#sch03";
+	end;
+
+OnDisable:
+	disablenpc "control device03#sch03";
+	end;
+}
+
+// Link Flags
+schg_cas03,346,211,0	script	LF-01#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("First Gate House:Second Gate House:Cancel")) {
+		case 1:
+			warp "schg_cas03",262,323;
+			end;
+		case 2:
+			warp "schg_cas03",378,263;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,346,207,0	script	LF-02#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Center 1 Area:Cancel")) {
+		case 1:
+			warp "schg_cas03",306,320;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,346,203,0	script	LF-03#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense area 2-1:Defense area 2-2:Cancel")) {
+		case 1:
+			warp "schg_cas03",309,292;
+			end;
+		case 2:
+			warp "schg_cas03",348,292;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,346,199,0	script	LF-04#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Center 2 Area:Cancel")) {
+		case 1:
+			warp "schg_cas03",266,263;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,346,195,0	script	LF-05#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense area 3-1:Defense area 3-2:Cancel")) {
+		case 1:
+			warp "schg_cas03",226,220;
+			end;
+		case 2:
+			warp "schg_cas03",185,249;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,346,191,0	script	LF-06#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Center 3 Area:Cancel")) {
+		case 1:
+			warp "schg_cas03",271,226;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,301,213,0	script	LF-07#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Gate House Fork:Cancel")) {
+		case 1:
+			warp "schg_cas03",262,323;
+			end;
+		case 2:
+			warp "schg_cas03",378,263;
+			end;
+		case 3:
+			warp "schg_cas03",306,320;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,301,209,0	script	LF-08#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Area 2-1:Area 2-2:Center 2 Area:Cancel")) {
+		case 1:
+			warp "schg_cas03",309,292;
+			end;
+		case 2:
+			warp "schg_cas03",348,292;
+			end;
+		case 3:
+			warp "schg_cas03",226,263;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,301,194,0	script	LF-09#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Area 3-1:Area 3-2:Center 3 Area:Cancel")) {
+		case 1:
+			warp "schg_cas03",226,220;
+			end;
+		case 2:
+			warp "schg_cas03",185,249;
+			end;
+		case 3:
+			warp "schg_cas03",271,226;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,301,190,0	script	LF-10#schg_cas03	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to the";
+		mes "Convenience Facility for";
+		mes "guild members?^000000";
+		switch(select("Go to Convenience Facility:Cancel")) {
+		case 1:
+			warp "schg_cas03",57,13;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,335,305,0	script	Vidblainn#LF_sc03_1::LF_sc03_1	111,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to";
+		mes "the Emperium Center?^000000";
+		switch(select("Teleport:Cancel")) {
+		case 1:
+			warp "schg_cas03",308,202;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas03,322,305,0	duplicate(LF_sc03_1)	Vidblainn#LF_sc03_2	111
+schg_cas03,352,248,0	duplicate(LF_sc03_1)	Vidblainn#LF_sc03_3	111
+schg_cas03,320,283,0	duplicate(LF_sc03_1)	Vidblainn#LF_sc03_4	111
+schg_cas03,337,283,0	duplicate(LF_sc03_1)	Vidblainn#LF_sc03_5	111
+schg_cas03,233,320,0	duplicate(LF_sc03_1)	Vidblainn#LF_sc03_6	111
+schg_cas03,207,239,0	duplicate(LF_sc03_1)	Vidblainn#LF_sc03_7	111
+schg_cas03,207,228,0	duplicate(LF_sc03_1)	Vidblainn#LF_sc03_8	111
+schg_cas03,266,206,0	duplicate(LF_sc03_1)	Vidblainn#LF_sc03_9	111
+schg_cas03,266,197,0	duplicate(LF_sc03_1)	Vidblainn#LF_sc03_10	111
+
+schg_cas03,283,206,2	script	Vidblainn#LF_sc03_11::LF_sc03_2	722,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to";
+		mes "the Emperium Center?^000000";
+		switch(select("Teleport:Cancel")) {
+		case 1:
+			warp "schg_cas03",308,202;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+
+OnRecvCastlesc03:
+	FlagEmblem GetCastleData("schg_cas03",1);
+	end;
+}
+
+schg_cas03,283,197,2	duplicate(LF_sc03_2)	Vidblainn#LF_sc03_12	722
+schg_cas03,332,323,6	duplicate(LF_sc03_2)	Vidblainn#LF_sc03_13	722
+schg_cas03,343,323,2	duplicate(LF_sc03_2)	Vidblainn#LF_sc03_14	722
+
+// Guild Manager
+schg_cas03,88,90,3	script	Steward#sch03	55,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (.@GID == 0) {
+		mes "[ Steward ]";
+		mes "I await for the master";
+		mes "whom destiny will choose";
+		mes "for me. Do you think you";
+		mes "have to courage and strength";
+		mes "to conquer this stronghold?";
+		close;
+	}
+	if (getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)) {
+		mes "[ Steward ]";
+		mes "Hmpf. Your threats don't";
+		mes "scare me! Guardians, drive";
+		mes "this infidel away from here!";
+		mes "I will always be loyal to the";
+		mes "master of this stronghold,";
+		MES "the one and only^FF0000" + getguildmaster(.@GID) + "^000000.";
+		close;
+	}
+	mes "[ Steward ]";
+	mes "Ah, Master ^FF0000" + getguildmaster(.@GID) + "^000000...";
+	mes "How shall I serve you today?";
+	mes "Was there an aspect of this";
+	mes "stronghold's maintenance";
+	mes "you wanted to discuss?";
+	next;
+	switch(select("Stronghold Briefing:Invest in Commercial Growth:Invest in Defense growth:Hire/Fire Storage Staff:Go to Master's room")) {
+	case 1:
+		mes "[ Steward ]";
+		mes "The Commercial Growth";
+		mes "Level of the stronghold is ^0000ff" + GetCastleData("schg_cas03",2) + ".";
+		if (GetCastleData("schg_cas03",4) > 0) {
+			mes "Last time, you invested in";
+			mes "Commercial Growth " + GetCastleData("schg_cas03",4) + ".";
+		}
+		next;
+		mes "[ Steward ]";
+		mes "Our stronghold's";
+		mes "safeguard level is " + GetCastleData("schg_cas03",3) + ".";
+		if (GetCastleData("schg_cas03",5) > 0) {
+			mes "Last time, you invested";
+			mes "in defense " + GetCastleData("schg_cas03",5) + " times.";
+		}
+		mes " ";
+		mes "That is all, master.";
+		close;
+	case 2:
+		set .@Economy,GetCastleData("schg_cas03",2);
+		if(.@Economy < 8) set .@eco_invest,10000;
+		if(.@Economy >= 8) set .@eco_invest,20000;
+		if(.@Economy >= 16) set .@eco_invest,40000;
+		if(.@Economy >= 25) set .@eco_invest,80000;
+		if(.@Economy >= 34) set .@eco_invest,160000;
+		if(.@Economy >= 44) set .@eco_invest,320000;
+		if(.@Economy >= 54) set .@eco_invest,640000;
+		if(.@Economy >= 65) set .@eco_invest,1280000;
+		if(.@Economy >= 76) set .@eco_invest,2560000;
+		if(.@Economy >= 88) set .@eco_invest,5120000;
+		mes "[ Steward ]";
+		mes "Raising the stronghold's";
+		mes "commercial growth will";
+		mes "increase the quantity of";
+		mes "goods produced for the guild.";
+		mes "Investing in commercial growth";
+		mes "will help the guild's future.";
+		next;
+		mes "[ Steward ]";
+		mes "You can make one investment";
+		mes "each day, but if you can make";
+		mes "two investments if you pay";
+		mes "more zeny: this will speed";
+		mes "up commercial development,";
+		mes "but can be quite expensive.";
+		next;
+		if (.@Economy == 100) {
+			mes "[ Steward ]";
+			mes "However, our stronghold's";
+			mes "commerical growth level is";
+			mes "at 100%. It's not possible to";
+			mes "develop commercial growth";
+			mes "any further than that.";
+			close;
+		}
+		if (GetCastleData("schg_cas03",4) == 2) {
+			mes "[ Steward ]";
+			mes "You've already made two";
+			mes "investments today, so you'll";
+			mes "have to wait until tomorrow";
+			mes "to make another investment.";
+			close;
+		}
+		if (GetCastleData("schg_cas03",4) == 0) {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000 zeny";
+			mes "to make an investment";
+			mes "Will you invest in this";
+			mes "stronghold's commerical";
+			mes "development now?";
+		}
+		else {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000";
+			mes "more zeny to make a second";
+			mes "investment today. Will you";
+			mes "invest one more time?";
+		}
+		next;
+		switch(select("Invest in Commercial Growth:Cancel")) {
+		case 1:
+			if (Zeny < .@eco_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				end;
+			}
+			set zeny,zeny-.@eco_invest;
+			SetCastleData "schg_cas03",4,GetCastleData("schg_cas03",4)+1;
+			SetCastleData "schg_cas03",2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. We can expect";
+			mes "to see the results of this";
+			mes "investment by tomorrow.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 3:
+		set .@Defence,GetCastleData("schg_cas03",3);
+		if(.@Defence < 8) set .@def_invest,20000;
+		if(.@Defence >= 8) set .@def_invest,40000;
+		if(.@Defence >= 16) set .@def_invest,80000;
+		if(.@Defence >= 25) set .@def_invest,160000;
+		if(.@Defence >= 34) set .@def_invest,320000;
+		if(.@Defence >= 44) set .@def_invest,640000;
+		if(.@Defence >= 54) set .@def_invest,1280000;
+		if(.@Defence >= 65) set .@def_invest,2560000;
+		if(.@Defence >= 76) set .@def_invest,5120000;
+		if(.@Defence >= 88) set .@def_invest,10240000;
+		mes "[ Steward ]";
+		mes "Investing in our stronghold's";
+		mes "defense will enhance the";
+		mes "durability of our Guardians";
+		mes "and the Emperium. We'll need";
+		mes "every advantage to protect";
+		mes "ourselves from our enemies.";
+		next;
+		mes "[ Steward ]";
+		mes "You can invest in defense";
+		mes "once per day, but if you pay";
+		mes "more zeny, you can invest";
+		mes "a maximum of two times daily.";
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas03",3) == 100) {
+			mes "The Defense Level of this";
+			mes "stronghold is 100%, and";
+			mes "cannot be increased further.";
+			close;
+		}
+		if (GetCastleData("schg_cas03",5) == 2) {
+			mes "Master, you've already";
+			mes "invested in Defense twice";
+			mes "today. You'll need to wait";
+			mes "until tomorrow if you really";
+			mes "want to increase our defenses.";
+			close;
+		}
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas03",5) == 0) {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses.";
+			mes "Will you invest now?";
+		}
+		else {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses";
+			mes "a second time today.";
+			mes "Will you invest now?";
+		}
+		next;
+		switch(select("Invest in Defense:Cancel")) {
+		case 1:
+			if (Zeny < .@def_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				close;
+			}
+			set zeny,zeny-.@def_invest;
+			SetCastleData "schg_cas03",5,GetCastleData("schg_cas03",5)+1;
+			SetCastleData "schg_cas03",3,.@Defence+1;
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. Increasing";
+			mes "the frequency of treasure";
+			mes "procured by the guild will";
+			mes "definitely help us all.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 4:
+		if (GetCastleData("schg_cas03",9) == 1) {
+			mes "[ Steward ]";
+			mes "Do you wish to dismiss";
+			mes "the Kafra Employee that";
+			mes "we've hired for the guild?";
+			next;
+			switch(select("Dismiss:Cancel")) {
+			case 1:
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "Master, please reconsider!";
+				mes "I've been working very hard";
+				mes "for the success of the guild!";
+				mes "I'll try harder to serve the";
+				mes "guild members of this";
+				mes "stronghold, I promise!";
+				next;
+				switch(select("Dismiss:Cancel")) {
+				case 1:
+					mes "[ Hired Kafra Employee ]";
+					mes "Why?! What have I done";
+					mes "to deserve this? Waaah~!";
+					next;
+					cutin "kafra_01",255;
+					break;
+				case 2:
+					mes "[ Hired Kafra Employee ]";
+					mes "Thank you, Master!";
+					mes "I'll obey your every";
+					mes "command as best I can!";
+					mes "You won't regret this!";
+					close;
+				}
+				break;
+			case 2:
+				mes "[ Steward ]";
+				mes "She works very hard,";
+				mes "in my opinion. It was in";
+				mes "all of our best interests to";
+				mes "allow her to stay with us.";
+				close;
+			}
+			disablenpc "Kafra Employee#sch03";
+			SetCastleData "schg_cas03",9,0;
+			mes "[ Steward ]";
+			mes "That Kafra Employee";
+			mes "has been dismissed.";
+			mes "Were really dissatisfied";
+			mes "by the quality of her service?";
+			close;
+		}
+		else {
+			mes "[ Steward ]";
+			mes "Will you hire a";
+			mes "Kafra Employee to serve";
+			mes "our stronghold? You must";
+			mes "pay ^FF000010,000 zeny^000000 to hire one.";
+			next;
+			switch(select("Hire:Cancel")) {
+			case 1:
+				if (getgdskilllv(.@GID,10001) == 0) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "you have not yet attained";
+					mes "the ^FF0000Contract with Kafra^000000";
+					mes "guild skill.";
+					close;
+				}
+				if (Zeny < 10000) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "we do not have enough";
+					mes "funds to pay the contract fee.";
+					close;
+				}
+				set zeny,zeny-10000;
+				enablenpc "Kafra Employee#sch03";
+				SetCastleData "schg_cas03",9,1;
+				mes "[ Steward ]";
+				mes "Very well. We have formed";
+				mes "a contract with the Kafra";
+				mes "Head Office, and hired a";
+				mes "Kafra Employee for our";
+				mes "stronghold. Here she is~";
+				next;
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "How do you do? I've";
+				mes "been dispatched by the";
+				mes "Kafra Head Office to";
+				mes "serve your guild's needs.";
+				mes "I'll do my best to follow";
+				mes "your every command, Master.";
+				next;
+				cutin "kafra_01",255;
+				mes "[ Steward ]";
+				mes "Our contract will expire";
+				mes "after one month, so we must";
+				mes "pay additional fees to keep";
+				mes "this Kafra Employee in";
+				mes "the service of our guild.";
+				close;
+			case 2:
+				mes "[ Steward ]";
+				mes "As you command, Master.";
+				mes "However, I suggest hiring";
+				mes "a Kafra Employee as soon";
+				mes "as possible since our guild";
+				mes "would greatly benefit from";
+				mes "the convenient Kafra services.";
+				close;
+			}
+		}
+	case 5:
+		mes "[ Steward ]";
+		mes "Do you wish to enter the";
+		mes "Guild Treasure Room?";
+		mes "Only you, the Guild Master,";
+		mes "are permitted to enter.";
+		next;
+		mes "[ Steward ]";
+		mes "Please remember to open";
+		mes "the Treasure Boxes at the";
+		mes "proper time. Otherwise, the";
+		mes "treasure may disappear if";
+		mes "something unexpected happens.";
+		next;
+		switch(select("Go to Treasure Room:Cancel")) {
+		case 1:
+			mes "[ Steward ]";
+			mes "Allow me to guide you";
+			mes "on the secret path to";
+			mes "the Treasure Room.";
+			mes "Press the secret switch";
+			mes "when you wish to return here.";
+			close2;
+			warp "schg_cas03",190,16;
+			end;
+		case 2:
+			mes "[ Steward ]";
+			mes "Items in the Treasure Room";
+			mes "are produced once each day.";
+			mes "Therefore, you must obtain";
+			mes "the treasure items everyday.";
+			mes "For the sake of the guild,";
+			mes "prioritize treasure harvesting!";
+			close;
+		}
+	}
+
+Onstop:
+	stopnpctimer;
+	end;
+
+OnStartArena:
+	set .@GID,getcharid(2);
+	// Lower castle Economy
+	set .@Economy,GetCastleData("schg_cas03",2) - 5;
+	if (.@Economy < 0) set .@Economy, 0;
+	SetCastleData "schg_cas03", 2, .@Economy;
+	// Lower Castle Defence
+	set .@Defence,GetCastleData("schg_cas03",3) - 5;
+	if (.@Defence < 0) set .@Defence, 0;
+	SetCastleData "schg_cas03", 3, .@Defence;
+	// Set new owner
+	SetCastleData "schg_cas03",1, .@GID;
+	// Clear castle's data.
+	for( set .@i, 4; .@i <= 9; set .@i, .@i+1 )
+		SetCastleData "schg_cas03", .@i, 0;
+	// Disable Kafra
+	disablenpc "Kafra Employee#sch03";
+
+	set .msg,2;
+	if (.msg == 1) {
+		announce "Fortress [" + GetCastleName("schg_cas03") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch01_02::Onstart";
+	}
+	else if (.msg == 2) {
+		announce "The [" + getguildname(.@gid) + "] conquered the [Nithafjoll 3] stronghold of "+GetCastleName("schg_cas03"),bc_all;
+		mapannounce "schg_cas03","The emperium has been shattered!",bc_map,"0x00FF00";
+		if (agitcheck()) {
+			donpcevent "Manager#sch01_02::Onreset";
+			initnpctimer;
+		}
+		else {
+			donpcevent "Manager#sch01_02::Onreset";
+			stopnpctimer;
+		}
+	}
+	else if (.msg == 0) {
+		announce "Fortress [" + GetCastleName("schg_cas03") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch01_02::Onreset";
+		stopnpctimer;
+		end;
+	}
+	MapRespawnGuildID "schg_cas03",GetCastleData("schg_cas03",1),2;
+	GetCastleData "schg_cas03",0,"::OnRecvCastlesc03";
+	end;
+
+OnTimer10000:
+	donpcevent "manager#sch03_02::Onchange";
+	mapannounce "schg_cas03","Rebuild this stonghold's Guardian Stones and Fortress Gates to secure your guild's new aquisition!",bc_map,"0x00FF00";
+	end;
+}
+
+// Guild Kafra
+schg_cas03,50,50,3	script	Kafra Employee#sch03	117,{
+	cutin "kafra_01",2;
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (getcharid(2) == .@GID && getgdskilllv(.@GID,10001)) {
+		mes "[Kafra Employee]";
+		mes "Welcome, proud member";
+		mes "of the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild!";
+		mes "The Kafra Corporation is ready";
+		mes "to assist you wherever you go!";
+		next;
+		switch(select("Use Storage:Use Warp Service:Rent Pushcart:Cancel")) {
+		case 1:
+			if (basicskillcheck() && getskilllv(1) < 6) {
+				mes "[Kafra Employee]";
+				mes "I'm so sorry, but you must";
+				mes "have at least Novice Skill";
+				mes "Lv.6 to use the Storage.";
+			}
+			else {
+				openstorage;
+			}
+			break;
+		case 2:
+			mes "[Kafra Employee]";
+			mes "Please tell me your";
+			mes "Warp destination.";
+			next;
+			switch(select("Juno -> 200 z:Cancel")) {
+			case 1:
+				if (Zeny < 200) {
+					mes "[Kafra Employee]";
+					mes "I'm sorry, but you don't";
+					mes "have enough zeny to pay";
+					mes "the warp fee. Would you";
+					mes "please check your funds again?";
+					close2;
+					cutin "kafra_01",255;
+					end;
+				}
+				set zeny,zeny-200;
+				warp "yuno",158,125;
+				end;
+			case 2:
+				cutin "kafra_01",255;
+			}
+			break;
+		case 3:
+			if (BaseClass != Job_Merchant) {
+				mes "[Kafra Employee]";
+				mes "I'm sorry, but the Pushcart";
+				mes "rental service can only be";
+				mes "used by Merchant, Blacksmith,";
+				mes "and Alchemist class characters.";
+			}
+			else if (checkcart() == 1) {
+				mes "[Kafra Employee]";
+				mes "Hm? You've already";
+				mes "rented a Pushcart.";
+			}
+			else {
+				mes "[Kafra Employee]";
+				mes "The Pushcart rental fee";
+				mes "is 800 zeny. Would you";
+				mes "like to rent a Pushcart?";
+				next;
+				switch(select("Rent Pushcart:Cancel")) {
+				case 1:
+					if (Zeny < 800) {
+						mes "[Kafra Employee]";
+						mes "I'm sorry, but you don't";
+						mes "have enough zeny to rent";
+						mes "one of our Pushcarts.";
+						close2;
+						cutin "kafra_01",255;
+						end;
+					}
+					set zeny,zeny-800;
+					setcart;
+					break;
+				case 2:
+					break;
+				}
+			}
+			break;
+		case 4:
+			mes "[Kafra Employee]";
+			mes "Thank you for using the";
+			mes "Kafra Service. Wherever";
+			mes "you go, Kafra will be";
+			mes "there to support you!";
+			close2;
+			cutin "kafra_01",255;
+			end;
+		}
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+	else {
+		mes "[Kafra Employee]";
+		mes "I'm sorry, but I've been";
+		mes "exclusively contracted";
+		mes "to the members of the";
+		mes "^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		mes "You'll have to ask another";
+		mes "Kafra Employee to help you...";
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+
+OnRecvCastlesc03:
+	if (GetCastleData("schg_cas03",1) == 0) {
+		monster "schg_cas03",0,0,"Evil Druid",1117,10;
+		monster "schg_cas03",0,0,"Khalitzburg",1132,4;
+		monster "schg_cas03",0,0,"Abysmal Knight",1219,3;
+		monster "schg_cas03",0,0,"Executioner",1205,1;
+		monster "schg_cas03",0,0,"Penomena",1216,10;
+		monster "schg_cas03",0,0,"Alarm",1193,18;
+		monster "schg_cas03",0,0,"Clock",1269,9;
+		monster "schg_cas03",0,0,"Raydric Archer",1276,12;
+		monster "schg_cas03",0,0,"Wanderer",1208,3;
+		monster "schg_cas03",0,0,"Alice",1275,1;
+		monster "schg_cas03",0,0,"Bloody Knight",1268,2;
+		monster "schg_cas03",0,0,"Dark Lord",1272,2;
+		monster "schg_cas03",0,0,"Tower Keeper",1270,4;
+	}
+	if (GetCastleData("schg_cas03",9) < 1) {
+		disablenpc "Kafra Employee#sch03";
+	}
+	end;
+}
+
+schg_cas03,199,25,0	script	#sch03_switch	111,{
+	mes " ";
+	mes "^3355FFWill you pull";
+	mes "this small lever?^000000";
+	next;
+	switch(select("Pull Lever:Cancel")) {
+	case 1:
+		warp "schg_cas03",57,13;
+		end;
+	case 2:
+		close;
+	}
+}
+
+sch_gld,91,191,0	script	Vidblainn#flag_sc03_1::Sc03_Flag	722,{
+	set .@GID, GetCastleData("schg_cas03",1);
+	if (.@GID == 0) {
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt declares that";
+		mes "one has yet to claim lordship";
+		mes "over this stronghold. The one";
+		mes "that breaks the Emperium will";
+		mes "be recognized as its new owner.";
+		close;
+	}
+	else {
+		if (getcharid(2) == .@GID) {
+			mes "[ Ringing Voice ]";
+			mes "Courageous one,";
+			mes "do you wish to return";
+			mes "to your stronghold?";
+			next;
+			switch(select("Return to the Stronghold:Cancel")) {
+			case 1:
+				set .@GID, GetCastleData("schg_cas03",1);
+				if (getcharid(2) == .@GID) {
+					warp "schg_cas03",308,202;
+					end;
+				}
+				close;
+			case 2:
+				close;
+			}
+		}
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt decrees that";
+		mes "this stronghold is owned";
+		mes "by the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		next;
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "^FF0000" + GetGuildMaster(.@GID) + "^000000 is";
+		mes "Guild Master of ^FF0000" + GetGuildName(.@GID) + "^000000.";
+		mes "Any that object must claim this";
+		mes "stronghold through strength of";
+		mes "steel and magic during the";
+		mes "appointed Guild Siege times.";
+		close;
+	}
+
+OnRecvCastlesc03:
+	FlagEmblem GetCastleData("schg_cas03",1);
+	end;
+}
+
+sch_gld,104,191,0	duplicate(Sc03_Flag)	Bidblind#flag_sc03_2	722

+ 2868 - 0
npc/guild2/schg_cas04.txt

@@ -0,0 +1,2868 @@
+//===== eAthena Script =======================================
+//= War of Emperium Second Edition
+//===== By: ==================================================
+//= L0ne_W0lf
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= eAthena SVN
+//===== Description: =========================================
+//= WoE SE Schwaltzvalt Castle 4
+//===== Additional Comments: =================================
+//= 1.0 First Version [L0ne_W0lf]
+//============================================================
+
+schg_cas04,1,1,0	script	Manager#sch04_02	111,{
+	end;
+
+OnInterIfInitOnce:
+	GetCastleData "schg_cas04",0,"::OnRecvCastlesc04";
+	end;
+
+OnRecvCastlesc04:
+	RequestGuildInfo GetCastleData("schg_cas04",1);
+	if (GetCastleData("schg_cas04",1) == 0) {
+		donpcevent "Manager#sch04_02::Onstart";
+	}
+	end;
+
+OnAgitStart:
+	if (agitcheck()) {
+		MapRespawnGuildID "schg_cas04",GetCastleData("schg_cas04",1),2;
+		GvgOn "schg_cas04";
+		donpcevent "Manager#sch04_02::Onstart";
+	}
+	else {
+		donpcevent "#sch04_RL00::OnDisable";
+		donpcevent "#sch04_RL01::OnDisable";
+		donpcevent "#sch04_RL02::OnDisable";
+		donpcevent "#sch04_RL03::OnDisable";
+	}
+	end;
+
+OnAgitEnd:
+	GvgOff "schg_cas04";
+	if (GetCastleData("schg_cas04",1)) {
+		KillMonster "schg_cas04","Steward#sch04::OnStartArena";
+		donpcevent "Manager#sch04_02::Onreset";
+	}
+	end;
+
+Onstart:
+	// 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians
+	// Settings for all but Summon Guardians
+	// 0 = Okay; 1 = Destroyed; 2 = Repairing
+	// Summon Guardians
+	// 0 = Do not Summon; 1 = Summon
+	if (GetCastleData("schg_cas04",1)) {
+		setarray $agit_sc04[0],0,0,0,0,0,0;
+		donpcevent "#sch04_df01::OnEnable";
+		donpcevent "#sch04_df02::OnEnable";
+		donpcevent "#sch04_RL00::OnEnable";
+		donpcevent "#sch04_RL01::OnEnable";
+		donpcevent "#sch04_RL02::OnEnable";
+		donpcevent "#sch04_RL03::OnEnable";
+	}
+	monster "schg_cas04",120,272,"Emperium",1288,1,"Steward#sch04::OnStartArena";
+	end;
+
+Onreset:
+	donpcevent "#sch04_df01::OnDisable";
+	donpcevent "#sch04_df02::OnDisable";
+	donpcevent "#sch04_gard01::Onreset";
+	donpcevent "#sch04_gard02::Onreset";
+	donpcevent "#sch04_RL00::OnDisable";
+	donpcevent "#sch04_RL01::OnDisable";
+	donpcevent "#sch04_RL02::OnDisable";
+	donpcevent "#sch04_RL03::OnDisable";
+	donpcevent "1st Guardian Stone#sch04::OnDisable";
+	donpcevent "2nd Guardian Stone#sch04::OnDisable";
+	donpcevent "Control Device01#sch04::OnDisable";
+	donpcevent "Control Device02#sch04::OnDisable";
+	donpcevent "Control Device03#sch04::OnDisable";
+	if (agitcheck()) {
+		setarray $agit_sc04[0],0,0,1,1,1,0;
+	}
+	end;
+
+Onchange:
+	setarray $agit_sc04[0],2,2,1,1,2,0;
+	monster "schg_cas04",120,272,"Emperium",1288,1,"Steward#sch04::OnStartArena";
+	donpcevent "Control Device03#sch04::OnEnable";
+	donpcevent "1st Guardian Stone#sch04::OnEnable";
+	donpcevent "2nd Guardian Stone#sch04::OnEnable";
+	end;
+
+OnClock0001:
+	set .@Treasure,GetCastleData("schg_cas04",2)/5+4;
+	if (.@Treasure) {
+		monster "schg_cas04",388,388,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 2) end;
+		monster "schg_cas04",388,389,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 3) end;
+		monster "schg_cas04",388,390,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 4) end;
+		monster "schg_cas04",387,390,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 5) end;
+		monster "schg_cas04",386,390,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 6) end;
+		monster "schg_cas04",385,390,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 7) end;
+		monster "schg_cas04",384,389,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 8) end;
+		monster "schg_cas04",384,388,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 9) end;
+		monster "schg_cas04",384,387,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 10) end;
+		monster "schg_cas04",384,386,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 11) end;
+		monster "schg_cas04",384,385,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 12) end;
+		monster "schg_cas04",384,384,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 13) end;
+		monster "schg_cas04",385,384,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 14) end;
+		monster "schg_cas04",386,384,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 15) end;
+		monster "schg_cas04",387,384,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 16) end;
+		monster "schg_cas04",388,384,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 17) end;
+		monster "schg_cas04",389,384,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 18) end;
+		monster "schg_cas04",390,384,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 19) end;
+		monster "schg_cas04",390,385,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 20) end;
+		monster "schg_cas04",390,386,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 21) end;
+		monster "schg_cas04",389,386,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 22) end;
+		monster "schg_cas04",388,386,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 23) end;
+		monster "schg_cas04",387,286,"Treasure Chest",1941,1,"Manager#sch04_02::OnTreasureDied";
+		if (.@Treasure < 24) end;
+		monster "schg_cas04",386,386,"Treasure Chest",1324,1,"Manager#sch04_02::OnTreasureDied";
+	}
+	end;
+
+OnTreasureDied:
+	end;
+}
+
+schg_cas04,123,306,3	script	Ef#sch04_01	868,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (.@GID == 0) {
+		mes "[Ef]";
+		mes "Great job. Now, all you";
+		mes "need to do is destroy this";
+		mes "Emperium to gain ownership";
+		mes "over this stronghold.";
+		close;
+	}
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) != getguildmaster(.@GID)) {
+			mes "[Ef]";
+			mes "As guardian of this";
+			mes "stronghold, I answer only";
+			mes "to the master of the guild";
+			mes "that controls this place.";
+			close;
+		}
+		else {
+			if (agitcheck() == 0) {
+				mes "[Ef]";
+				mes "I am Ef, guardian of";
+				mes "this stronghold. For now,";
+				mes "all is quiet in this place.";
+				next;
+				switch(select("Converse:Cancel")) {
+				case 1:
+					mes "[Ef]";
+					mes "Do you have any questions";
+					mes "about this stronghold?";
+					next;
+					switch(select("Guardian Stones:Fortress Gates:Link Flags:Battle Strategy:Cancel")) {
+					case 1:
+						mes "[Ef]";
+						mes "There is one Emperium";
+						mes "and two Guardian Stones in";
+						mes "each fortress. These stones";
+						mes "are the first line of defense,";
+						mes "and must be destroyed before";
+						mes "enemies can even enter.";
+						next;
+						mes "[Ef]";
+						mes "The stones are located in";
+						mes "^4D4DFFGate Houses^000000 which must be";
+						mes "protected to prevent enemies";
+						mes "from reaching the Emperium.";
+						mes "Guardian Stones can ^4D4DFFrecall";
+						mes "your Guardians^000000 for protection.";
+						next;
+						mes "[Ef]";
+						mes "Fortresses with higher levels";
+						mes "of defense can summon more";
+						mes "Guardians: this is why it is";
+						mes "so important for guilds to";
+						mes "invest in Defense Growth.";
+						next;
+						mes "[Ef]";
+						mes "Guardian Stones that have";
+						mes "been destroyed can be revived";
+						mes "after a certain time, but one of^FFFFFF ^000000 the guild members must give";
+						mes "me the order. I can also report^FFFFFF ^000000 the status of the Guardian Stones.";
+						close;
+					case 2:
+						mes "[Ef]";
+						mes "^4D4DFFFortress Gates^000000 are the second ^FFFFFF ^000000 line of guild stronghold defense,";
+						mes "and are protected by extra barricades activated by the Guardian Stones.";
+						mes "These gates are located in three different parts of the fortress.";
+						next;
+						mes "[Ef]";
+						mes "Barricades are protected by";
+						mes "Guardian Stones, and are";
+						mes "restored when the Guardian";
+						mes "Stones are retrieved. However,";
+						mes "it is not as easy to restore";
+						mes "destroyed Fortress Gates.";
+						next;
+						mes "[Ef]";
+						mes "Fortress Gates can only be";
+						mes "restored when the ^4D4DFFguild";
+						mes "master of a stronghold";
+						mes "changes^000000, or if ^4D4DFFrestoration";
+						mes "is requested by the guild";
+						mes "master of the stronghold^000000.";
+						close;
+					case 3:
+						mes "[Ef]";
+						mes "Strongholds have many";
+						mes "Link Flags that allow you";
+						mes "to access vital areas within";
+						mes "restrictions placed by the";
+						mes "Barricades. Usually, ^4D4DFFFlag 1";
+						mes "links to the Gate House^000000.";
+						next;
+						mes "[Ef]";
+						mes "Many flags link directly to";
+						mes "the flag near the Emperium.";
+						mes "The final numbered flag is";
+						mes "linked to the Convenience";
+						mes "Facility of the stronghold's";
+						mes "owner. Keep this in mind.";
+						close;
+					case 4:
+						mes "[Ef]";
+						mes "Strategy? It would be better";
+						mes "to develop your battle plan to";
+						mes "exploit your guild's advantages";
+						mes "and your enemies' weaknesses.";
+						mes "Use the Gate Houses and Barricades, and rebuild as quickly as you can!";
+						close;
+					case 5:
+						mes "[Ef]";
+						mes "You have no questions";
+						mes "to ask of me? Well, I'm";
+						mes "here to serve your needs.";
+						close;
+					}
+				case 2:
+					mes "[Ef]";
+					mes "I'm always here, so";
+					mes "feel free to request my";
+					mes "assistance whenever";
+					mes "the need arises.";
+					close;
+				}
+			}
+			else {
+				mes "[Ef]";
+				mes "Greetings, "+strcharinfo(0)+".";
+				mes "What are your orders?";
+				next;
+				switch(select("Increase Stronghold Defense:Situational Briefing:Cancel")) {
+				case 1:
+					if ($agit_sc04[5] == 0) {
+						if (getgdskilllv(.@GID,10002) == 0) {
+							mes "[Ef]";
+							mes "I'm sorry, but the Guardian";
+							mes "Stones aren't powerful enough";
+							mes "to summon Guardians yet. We";
+							mes "need to accumulate more";
+							mes "knowledge before they can";
+							mes "summon any Guardians.";
+							close;
+						}
+						else {
+							mes "[Ef]";
+							mes "I shall endeavor to summon";
+							mes "a Guardian through a Guardian";
+							mes "Stone. However, keep in mind";
+							mes "that this will not work if the";
+							mes "Guardian Stone is destroyed.";
+							setarray $agit_sc04[5],1;
+							if ($agit_sc04[0] == 0) {
+								donpcevent "#sch04_gard01::OnEnable";
+							}
+							if ($agit_sc04[1] == 0) {
+								donpcevent "#sch04_gard02::OnEnable";
+							}
+							close;
+						}
+					}
+					else {
+						mes "[Ef]";
+						mes "You've already commanded";
+						mes "me to summon a Guardian";
+						mes "to defend the stronghold.";
+						close;
+					}
+				case 2:
+					mes "[Ef]";
+					mes "Our defense status is...";
+					if ($agit_sc04[0] == 1) {
+						mes "1st Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc04[0] == 2) {
+						mes "1st Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc04[1] == 1) {
+						mes "2nd Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc04[1] == 2) {
+						mes "2nd Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc04[2] == 1) {
+						mes "1st Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc04[2] == 2) {
+						mes "1st Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc04[3] == 1) {
+						mes "2nd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc04[3] == 2) {
+						mes "2nd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc04[4] == 1) {
+						mes "3rd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc04[4] == 2) {
+						mes "3rd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "3rd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					close;
+				case 3:
+					mes "[Ef]";
+					mes "I'll be standing by,";
+					mes "awaiting your orders.";
+					close;
+				}
+			}
+		}
+	}
+	else {
+		mes "[Ef]";
+		mes "Who are you? Scoundrel!";
+		mes "Leave this stronghold now!";
+		close;
+	}
+
+OnInit:
+	setarray $agit_sc04[0],0,0,0,0,0,0;
+	end;
+}
+
+schg_cas04,1,1,0	script	#sch04_gard01	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas04",3);
+	guardian "schg_cas04",111,18,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //0;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas04",109,44,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //1;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas04",109,44,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas04",65,22,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //2;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas04",109,44,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas04",65,22,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas04",110,40,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //3;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas04",109,44,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas04",65,22,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas04",110,40,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //3;
+		guardian "schg_cas04",88,20,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //4;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas04",108,32,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //1;
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",64,40,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //5;
+	mapannounce "schg_cas04","The 1st Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",47,43,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //6;
+	mapannounce "schg_cas04","The 2nd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer1800000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",109,48,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //7;
+	mapannounce "schg_cas04","The 3rd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer2700000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",111,18,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //8;
+	mapannounce "schg_cas04","The 4th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer3600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",112,32,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //9;
+	mapannounce "schg_cas04","The 5th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas04",120,37,"Guardian Soldier",1899,"#sch04_gard01::OnGuardianDied"; //10;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas04","#sch04_gard01::OnGuardianDied";
+	end;
+}
+
+schg_cas04,1,2,0	script	#sch04_gard02	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas04",3);
+	guardian "schg_cas04",130,22,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //11;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas04",187,15,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //12;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas04",129,47,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas04",151,18,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //13;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas04",129,47,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas04",151,18,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas04",187,15,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //14;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas04",129,47,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas04",151,18,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas04",187,15,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //14;
+		guardian "schg_cas04",128,42,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //15;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas04",128,42,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //12;
+	}
+	initnpctimer;
+	end;
+
+OnTimer600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",152,43,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //16;
+	end;
+
+OnTimer1200000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",187,15,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //17;
+	end;
+
+OnTimer2100000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",128,42,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //18;
+	end;
+
+OnTimer3000000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",130,22,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //19;
+	end;
+
+OnTimer3900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas04",130,28,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //20;
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas04",151,18,"Guardian Soldier",1899,"#sch04_gard02::OnGuardianDied"; //21;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas04","#sch04_gard02::OnGuardianDied";
+	end;
+}
+
+schg_cas04,1,3,0	script	#sch04_df01	-1,{
+OnEnable:
+	guardian "schg_cas04",27,35,"1st Guardian Stone",1907,"#sch04_df01::OnGuardianStoneDied"; //22;
+	end;
+
+OnDisable:
+	killmonster "schg_cas04","#sch04_df01::OnGuardianStoneDied";
+	setarray $agit_sc04[0],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 1st Guardian Stone is Destroyed
+	setarray $agit_sc04[0],1;
+	if (($agit_sc04[0] == 1) || ($agit_sc04[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc04[1] == 1) || ($agit_sc04[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas04","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch04_RL00::OnDisable";
+		donpcevent "#sch04_gard01::Onreset";
+	}
+	else {
+		mapannounce "schg_cas04","The 1st Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch04_gard01::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "1st Guardian Stone#sch04::OnEnable";
+	setarray $agit_sc04[0],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas04,27,36,0	script	1st Guardian Stone#sch04	844,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"1st Guardian Stone#sch04" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch04" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"1st Guardian Stone#sch04" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch04" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 3:
+							specialeffect 56; //"1st Guardian Stone#sch04" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch04" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc04[0] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "already completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch04_df01::OnEnable";
+							specialeffect 135; //"1st Guardian Stone#sch04" EF_ICECRASH
+							disablenpc "1st Guardian Stone#sch04";
+							setarray $agit_sc04[0],0;
+							set .@df_all,$agit_sc04[0]+$agit_sc04[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas04","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch04_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas04","The 1st Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc04[5] == 1) {
+								donpcevent "#sch04_gard01::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "1st Guardian Stone#sch04";
+	end;
+
+OnEnable:
+	enablenpc "1st Guardian Stone#sch04";
+	specialeffect 247; //"1st Guardian Stone#sch04" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "1st Guardian Stone#sch04";
+	end;
+}
+
+schg_cas04,1,4,0	script	#sch04_df02	-1,{
+OnEnable:
+	guardian "schg_cas04",207,75,"2nd Guardian Stone",1908,"#sch04_df02::OnGuardianStoneDied"; //23;
+	end;
+
+OnDisable:
+	killmonster "schg_cas04","#sch04_df02::OnGuardianStoneDied";
+	setarray $agit_sc04[1],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 2nd Guardian Stone is Destroyed
+	setarray $agit_sc04[1],1;
+	if (($agit_sc04[0] == 1) || ($agit_sc04[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc04[1] == 1) || ($agit_sc04[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas04","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch04_RL00::OnDisable";
+		donpcevent "#sch04_gard02::Onreset";
+	}
+	else {
+		mapannounce "schg_cas04","2nd Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch04_gard02::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "2nd Guardian Stone#sch04::OnEnable";
+	setarray $agit_sc04[1],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas04,208,75,0	script	2nd Guardian Stone#sch04	844,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"2nd Guardian Stone#sch04" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch04" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"2nd Guardian Stone#sch04" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch04" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 3:
+							specialeffect 56; //"2nd Guardian Stone#sch04" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch04" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc04[1] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "successfully completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch04_df02::OnEnable";
+							specialeffect 135; //"2nd Guardian Stone#sch04" EF_ICECRASH
+							disablenpc "2nd Guardian Stone#sch04";
+							setarray $agit_sc04[1],0;
+							set .@df_all,$agit_sc04[0]+$agit_sc04[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas04","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch04_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas04","The 2nd Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc04[5] == 1) {
+								donpcevent "#sch04_gard02::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "2nd Guardian Stone#sch04";
+	end;
+
+OnEnable:
+	enablenpc "2nd Guardian Stone#sch04";
+	specialeffect 247; //"2nd Guardian Stone#sch04" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "2nd Guardian Stone#sch04";
+	end;
+}
+
+// Barrier Summoners
+schg_cas04,2,1,0	script	#sch04_RL00	-1,{
+OnEnable:
+	setcell "schg_cas04",114,48,126,48,cell_walkable,0;
+	setcell "schg_cas04",114,48,126,48,cell_shootable,0;
+	guardian "schg_cas04",115,49," ",1905,"#sch04_RL00::OnBarrierDestroyed"; //24;
+	guardian "schg_cas04",117,49," ",1905,"#sch04_RL00::OnBarrierDestroyed"; //25;
+	guardian "schg_cas04",119,49," ",1905,"#sch04_RL00::OnBarrierDestroyed"; //26;
+	guardian "schg_cas04",121,49," ",1905,"#sch04_RL00::OnBarrierDestroyed"; //27;
+	guardian "schg_cas04",123,49," ",1905,"#sch04_RL00::OnBarrierDestroyed"; //28;
+	guardian "schg_cas04",125,49," ",1905,"#sch04_RL00::OnBarrierDestroyed"; //29;
+	end;
+
+OnDisable:
+	setcell "schg_cas04",114,48,126,48,cell_walkable,1;
+	setcell "schg_cas04",114,48,126,48,cell_shootable,1;
+	killmonster "schg_cas04","#sch04_RL00::OnBarrierDestroyed";
+	end;
+
+OnBarrierDestroyed:
+	end;
+}
+
+schg_cas04,2,2,0	script	#sch04_RL01	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas04",114,51,126,51,cell_walkable,0;
+	guardian "schg_cas04",115,50," ",1905,"#sch04_RL01::OnBarrierDestroyed"; //30;
+	guardian "schg_cas04",117,50," ",1905,"#sch04_RL01::OnBarrierDestroyed"; //31;
+	guardian "schg_cas04",119,50," ",1905,"#sch04_RL01::OnBarrierDestroyed"; //32;
+	guardian "schg_cas04",121,50," ",1905,"#sch04_RL01::OnBarrierDestroyed"; //33;
+	guardian "schg_cas04",123,50," ",1905,"#sch04_RL01::OnBarrierDestroyed"; //34;
+	guardian "schg_cas04",125,50," ",1905,"#sch04_RL01::OnBarrierDestroyed"; //35;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc04[2],1;
+		mapannounce "schg_cas04","The 1st Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas04",114,51,126,51,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas04",114,51,126,51,cell_walkable,1;
+	killmonster "schg_cas04","#sch04_RL01::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas04,2,3,0	script	#sch04_RL02	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas04",114,154,126,154,cell_walkable,0;
+	guardian "schg_cas04",115,153," ",1905,"#sch04_RL02::OnBarrierDestroyed"; //36;
+	guardian "schg_cas04",117,153," ",1905,"#sch04_RL02::OnBarrierDestroyed"; //37;
+	guardian "schg_cas04",119,153," ",1905,"#sch04_RL02::OnBarrierDestroyed"; //38;
+	guardian "schg_cas04",121,153," ",1905,"#sch04_RL02::OnBarrierDestroyed"; //39;
+	guardian "schg_cas04",123,153," ",1905,"#sch04_RL02::OnBarrierDestroyed"; //40;
+	guardian "schg_cas04",125,153," ",1905,"#sch04_RL02::OnBarrierDestroyed"; //41;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc04[3],1;
+		mapannounce "schg_cas04","The 2nd Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas04",114,154,126,154,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas04",114,154,126,154,cell_walkable,1;
+	killmonster "schg_cas04","#sch04_RL02::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas04,2,4,0	script	#sch04_RL03	-1,{
+OnEnable:
+	set .MyMobCount,4;
+	setcell "schg_cas04",116,241,126,241,cell_walkable,0;
+	guardian "schg_cas04",116,240," ",1905,"#sch04_RL03::OnBarrierDestroyed"; //42;
+	guardian "schg_cas04",118,240," ",1905,"#sch04_RL03::OnBarrierDestroyed"; //43;
+	guardian "schg_cas04",120,240," ",1905,"#sch04_RL03::OnBarrierDestroyed"; //44;
+	guardian "schg_cas04",122,240," ",1905,"#sch04_RL03::OnBarrierDestroyed"; //45;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc04[4],1;
+		mapannounce "schg_cas04","The 3rd Fortress Gate is destroyed!",bc_map,"0x00ff00";
+		setcell "schg_cas04",116,241,126,241,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas04",116,241,126,241,cell_walkable,1;
+	killmonster "schg_cas04","#sch04_RL03::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas04,124,52,0	script	Control Device01#sch04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc04[2] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon,";
+									mes "but it's not working very well.^FFFFFF ^3355FF You'll have to try something else.";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch04_RL01::OnEnable";
+							disablenpc "Control Device01#sch04";
+							mapannounce "schg_cas04","The 1st Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc04[2],0;
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "Control Device01#sch04";
+	end;
+
+OnEnable:
+	enablenpc "Control Device01#sch04";
+	end;
+
+OnDisable:
+	disablenpc "Control Device01#sch04";
+	end;
+}
+
+schg_cas04,128,157,0	script	Control Device02#sch04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc04[3] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch04_RL02::OnEnable";
+							disablenpc "Control Device02#sch04";
+							mapannounce "schg_cas04","The 2nd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc04[3],0; //Global Variable
+							setarray $agit_sc04[2],2; //Global Variable
+							donpcevent "Control Device01#sch04::OnEnable";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+	
+OnInit:
+	disablenpc "Control Device02#sch04";
+	end;
+
+OnEnable:
+	enablenpc "Control Device02#sch04";
+	end;
+
+OnDisable:
+	disablenpc "Control Device02#sch04";
+	end;
+}
+
+schg_cas04,109,247,0	script	Control Device03#sch04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc04[4] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch04_RL03::OnEnable";
+							disablenpc "Control Device03#sch04";
+							mapannounce "schg_cas04","The 3rd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc04[4],0;
+							setarray $agit_sc04[3],2;
+							donpcevent "Control Device02#sch04::OnEnable";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+	
+OnInit:
+	disablenpc "Control Device03#sch04";
+	end;
+
+OnEnable:
+	enablenpc "Control Device03#sch04";
+	end;
+
+OnDisable:
+	disablenpc "Control Device03#sch04";
+	end;
+}
+
+// Link Flags
+schg_cas04,106,302,0	script	LF-01#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("First Gate House:Second Gate House:Cancel")) {
+		case 1:
+			warp "schg_cas04",19,26;
+			end;
+		case 2:
+			warp "schg_cas04",219,90;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,109,302,0	script	LF-02#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 1-1:Defense Area 1-2:Cancel")) {
+		case 1:
+			warp "schg_cas04",89,43;
+			end;
+		case 2:
+			warp "schg_cas04",141,45;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,112,302,0	script	LF-03#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 2-1:Defense Area 2-2:Cancel")) {
+		case 1:
+			warp "schg_cas04",137,54;
+			end;
+		case 2:
+			warp "schg_cas04",102,54;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,115,302,0	script	LF-04#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 2-3:Defense Area 2-4:Cancel")) {
+		case 1:
+			warp "schg_cas04",94,147;
+			end;
+		case 2:
+			warp "schg_cas04",163,140;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,118,302,0	script	LF-05#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 2-3:Defense Area 2-4:Cancel")) {
+		case 1:
+			warp "schg_cas04",87,220;
+			break;
+		case 2:
+			warp "schg_cas04",151,220;
+			break;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,121,302,0	script	LF-06#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 3-1:Defense Area 3-2:Cancel")) {
+		case 1:
+			warp "schg_cas04",100,242;
+			end;
+		case 2:
+			warp "schg_cas04",136,242;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,124,302,0	script	LF-07#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Center 1 Area:Center 2 Area:Cancel")) {
+		case 1:
+			warp "schg_cas04",120,168;
+			end;
+		case 2:
+			warp "schg_cas04",119,211;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,127,302,0	script	LF-08#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Area 1-1:Area 2-1:Area 3-1:Cancel")) {
+		case 1:
+			warp "schg_cas04",89,43;
+			end;
+		case 2:
+			warp "schg_cas04",94,147;
+			end;
+		case 3:
+			warp "schg_cas04",100,242;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,130,302,0	script	LF-09#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Area 1-2:Area 2-3:Area 3-2:Cancel")) {
+		case 1:
+			warp "schg_cas04",141,45;
+			end;
+		case 2:
+			warp "schg_cas04",163,140;
+			end;
+		case 3:
+			warp "schg_cas04",136,243;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,133,302,0	script	LF-10#schg_cas04	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to the";
+		mes "Convenience Facility for";
+		mes "guild members?^000000";
+		switch(select("Go to Convenience Facility:Cancel")) {
+		case 1:
+			warp "schg_cas04",275,244;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,17,45,0	script	Hljod#LF_sc04_1::LF_sc04_1	111,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to";
+		mes "the Emperium Center?^000000";
+		switch(select("Teleport:Cancel")) {
+		case 1:
+			warp "schg_cas04",120,290;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas04,207,95,0	duplicate(LF_sc04_1)	Hljod#LF_sc04_2	111
+
+schg_cas04,111,46,4	script	Hljod#LF_sc04_3::LF_sc04_2	722,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to";
+		mes "the Emperium Center?^000000";
+		switch(select("Teleport:Cancel")) {
+		case 1:
+			warp "schg_cas04",120,290;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+
+OnRecvCastlesc04:
+	FlagEmblem GetCastleData("schg_cas04",1);
+	end;
+}
+
+schg_cas04,129,46,4	duplicate(LF_sc04_2)	Hljod#LF_sc04_4	722
+schg_cas04,99,77,0	duplicate(LF_sc04_1)	Hljod#LF_sc04_5	111
+schg_cas04,140,77,0	duplicate(LF_sc04_1)	Hljod#LF_sc04_6	111
+schg_cas04,109,150,4	duplicate(LF_sc04_2)	Hljod#LF_sc04_7	722
+schg_cas04,130,150,4	duplicate(LF_sc04_2)	Hljod#LF_sc04_8	722
+schg_cas04,112,212,0	duplicate(LF_sc04_1)	Hljod#LF_sc04_9	111
+schg_cas04,127,212,0	duplicate(LF_sc04_1)	Hljod#LF_sc04_10	111
+schg_cas04,113,238,0	duplicate(LF_sc04_1)	Hljod#LF_sc04_11	111
+schg_cas04,126,238,0	duplicate(LF_sc04_1)	Hljod#LF_sc04_12	111
+schg_cas04,95,247,0	duplicate(LF_sc04_1)	Hljod#LF_sc04_13	111
+schg_cas04,144,247,0	duplicate(LF_sc04_1)	Hljod#LF_sc04_14	111
+
+// Guild Manager
+schg_cas04,247,305,3	script	Steward#sch04	55,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (.@GID == 0) {
+		mes "[ Steward ]";
+		mes "I await for the master";
+		mes "whom destiny will choose";
+		mes "for me. Do you think you";
+		mes "have to courage and strength";
+		mes "to conquer this stronghold?";
+		close;
+	}
+	if (getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)) {
+		mes "[ Steward ]";
+		mes "Hmpf. Your threats don't";
+		mes "scare me! Guardians, drive";
+		mes "this infidel away from here!";
+		mes "I will always be loyal to the";
+		mes "master of this stronghold,";
+		MES "the one and only^FF0000" + getguildmaster(.@GID) + "^000000.";
+		close;
+	}
+	mes "[ Steward ]";
+	mes "Ah, Master ^FF0000" + getguildmaster(.@GID) + "^000000...";
+	mes "How shall I serve you today?";
+	mes "Was there an aspect of this";
+	mes "stronghold's maintenance";
+	mes "you wanted to discuss?";
+	next;
+	switch(select("Stronghold Briefing:Invest in Commercial Growth:Invest in Defense growth:Hire/Fire Storage Staff:Go to Master's room")) {
+	case 1:
+		mes "[ Steward ]";
+		mes "The Commercial Growth";
+		mes "Level of the stronghold is ^0000ff" + GetCastleData("schg_cas04",2) + ".";
+		if (GetCastleData("schg_cas04",4) > 0) {
+			mes "Last time, you invested in";
+			mes "Commercial Growth " + GetCastleData("schg_cas04",4) + ".";
+		}
+		next;
+		mes "[ Steward ]";
+		mes "Our stronghold's";
+		mes "safeguard level is " + GetCastleData("schg_cas04",3) + ".";
+		if (GetCastleData("schg_cas04",5) > 0) {
+			mes "Last time, you invested";
+			mes "in defense " + GetCastleData("schg_cas04",5) + " times.";
+		}
+		mes " ";
+		mes "That is all, master.";
+		close;
+	case 2:
+		set .@Economy,GetCastleData("schg_cas04",2);
+		if(.@Economy < 8) set .@eco_invest,10000;
+		if(.@Economy >= 8) set .@eco_invest,20000;
+		if(.@Economy >= 16) set .@eco_invest,40000;
+		if(.@Economy >= 25) set .@eco_invest,80000;
+		if(.@Economy >= 34) set .@eco_invest,160000;
+		if(.@Economy >= 44) set .@eco_invest,320000;
+		if(.@Economy >= 54) set .@eco_invest,640000;
+		if(.@Economy >= 65) set .@eco_invest,1280000;
+		if(.@Economy >= 76) set .@eco_invest,2560000;
+		if(.@Economy >= 88) set .@eco_invest,5120000;
+		mes "[ Steward ]";
+		mes "Raising the stronghold's";
+		mes "commercial growth will";
+		mes "increase the quantity of";
+		mes "goods produced for the guild.";
+		mes "Investing in commercial growth";
+		mes "will help the guild's future.";
+		next;
+		mes "[ Steward ]";
+		mes "You can make one investment";
+		mes "each day, but if you can make";
+		mes "two investments if you pay";
+		mes "more zeny: this will speed";
+		mes "up commercial development,";
+		mes "but can be quite expensive.";
+		next;
+		if (.@Economy == 100) {
+			mes "[ Steward ]";
+			mes "However, our stronghold's";
+			mes "commerical growth level is";
+			mes "at 100%. It's not possible to";
+			mes "develop commercial growth";
+			mes "any further than that.";
+			close;
+		}
+		if (GetCastleData("schg_cas04",4) == 2) {
+			mes "[ Steward ]";
+			mes "You've already made two";
+			mes "investments today, so you'll";
+			mes "have to wait until tomorrow";
+			mes "to make another investment.";
+			close;
+		}
+		if (GetCastleData("schg_cas04",4) == 0) {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000 zeny";
+			mes "to make an investment";
+			mes "Will you invest in this";
+			mes "stronghold's commerical";
+			mes "development now?";
+		}
+		else {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000";
+			mes "more zeny to make a second";
+			mes "investment today. Will you";
+			mes "invest one more time?";
+		}
+		next;
+		switch(select("Invest in Commercial Growth:Cancel")) {
+		case 1:
+			if (Zeny < .@eco_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				end;
+			}
+			set zeny,zeny-.@eco_invest;
+			SetCastleData "schg_cas04",4,GetCastleData("schg_cas04",4)+1;
+			SetCastleData "schg_cas04",2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. We can expect";
+			mes "to see the results of this";
+			mes "investment by tomorrow.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 3:
+		set .@Defence,GetCastleData("schg_cas04",3);
+		if(.@Defence < 8) set .@def_invest,20000;
+		if(.@Defence >= 8) set .@def_invest,40000;
+		if(.@Defence >= 16) set .@def_invest,80000;
+		if(.@Defence >= 25) set .@def_invest,160000;
+		if(.@Defence >= 34) set .@def_invest,320000;
+		if(.@Defence >= 44) set .@def_invest,640000;
+		if(.@Defence >= 54) set .@def_invest,1280000;
+		if(.@Defence >= 65) set .@def_invest,2560000;
+		if(.@Defence >= 76) set .@def_invest,5120000;
+		if(.@Defence >= 88) set .@def_invest,10240000;
+		mes "[ Steward ]";
+		mes "Investing in our stronghold's";
+		mes "defense will enhance the";
+		mes "durability of our Guardians";
+		mes "and the Emperium. We'll need";
+		mes "every advantage to protect";
+		mes "ourselves from our enemies.";
+		next;
+		mes "[ Steward ]";
+		mes "You can invest in defense";
+		mes "once per day, but if you pay";
+		mes "more zeny, you can invest";
+		mes "a maximum of two times daily.";
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas04",3) == 100) {
+			mes "The Defense Level of this";
+			mes "stronghold is 100%, and";
+			mes "cannot be increased further.";
+			close;
+		}
+		if (GetCastleData("schg_cas04",5) == 2) {
+			mes "Master, you've already";
+			mes "invested in Defense twice";
+			mes "today. You'll need to wait";
+			mes "until tomorrow if you really";
+			mes "want to increase our defenses.";
+			close;
+		}
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas04",5) == 0) {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses.";
+			mes "Will you invest now?";
+		}
+		else {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses";
+			mes "a second time today.";
+			mes "Will you invest now?";
+		}
+		next;
+		switch(select("Invest in Defense:Cancel")) {
+		case 1:
+			if (Zeny < .@def_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				close;
+			}
+			set zeny,zeny-.@def_invest;
+			SetCastleData "schg_cas04",5,GetCastleData("schg_cas04",5)+1;
+			SetCastleData "schg_cas04",3,.@Defence+1;
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. Increasing";
+			mes "the frequency of treasure";
+			mes "procured by the guild will";
+			mes "definitely help us all.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 4:
+		if (GetCastleData("schg_cas04",9) == 1) {
+			mes "[ Steward ]";
+			mes "Do you wish to dismiss";
+			mes "the Kafra Employee that";
+			mes "we've hired for the guild?";
+			next;
+			switch(select("Dismiss:Cancel")) {
+			case 1:
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "Master, please reconsider!";
+				mes "I've been working very hard";
+				mes "for the success of the guild!";
+				mes "I'll try harder to serve the";
+				mes "guild members of this";
+				mes "stronghold, I promise!";
+				next;
+				switch(select("Dismiss:Cancel")) {
+				case 1:
+					mes "[ Hired Kafra Employee ]";
+					mes "Why?! What have I done";
+					mes "to deserve this? Waaah~!";
+					next;
+					cutin "kafra_01",255;
+					break;
+				case 2:
+					mes "[ Hired Kafra Employee ]";
+					mes "Thank you, Master!";
+					mes "I'll obey your every";
+					mes "command as best I can!";
+					mes "You won't regret this!";
+					close;
+				}
+				break;
+			case 2:
+				mes "[ Steward ]";
+				mes "She works very hard,";
+				mes "in my opinion. It was in";
+				mes "all of our best interests to";
+				mes "allow her to stay with us.";
+				close;
+			}
+			disablenpc "Kafra Employee#sch04";
+			SetCastleData "schg_cas04",9,0;
+			mes "[ Steward ]";
+			mes "That Kafra Employee";
+			mes "has been dismissed.";
+			mes "Were really dissatisfied";
+			mes "by the quality of her service?";
+			close;
+		}
+		else {
+			mes "[ Steward ]";
+			mes "Will you hire a";
+			mes "Kafra Employee to serve";
+			mes "our stronghold? You must";
+			mes "pay ^FF000010,000 zeny^000000 to hire one.";
+			next;
+			switch(select("Hire:Cancel")) {
+			case 1:
+				if (getgdskilllv(.@GID,10001) == 0) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "you have not yet attained";
+					mes "the ^FF0000Contract with Kafra^000000";
+					mes "guild skill.";
+					close;
+				}
+				if (Zeny < 10000) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "we do not have enough";
+					mes "funds to pay the contract fee.";
+					close;
+				}
+				set zeny,zeny-10000;
+				enablenpc "Kafra Employee#sch04";
+				SetCastleData "schg_cas04",9,1;
+				mes "[ Steward ]";
+				mes "Very well. We have formed";
+				mes "a contract with the Kafra";
+				mes "Head Office, and hired a";
+				mes "Kafra Employee for our";
+				mes "stronghold. Here she is~";
+				next;
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "How do you do? I've";
+				mes "been dispatched by the";
+				mes "Kafra Head Office to";
+				mes "serve your guild's needs.";
+				mes "I'll do my best to follow";
+				mes "your every command, Master.";
+				next;
+				cutin "kafra_01",255;
+				mes "[ Steward ]";
+				mes "Our contract will expire";
+				mes "after one month, so we must";
+				mes "pay additional fees to keep";
+				mes "this Kafra Employee in";
+				mes "the service of our guild.";
+				close;
+			case 2:
+				mes "[ Steward ]";
+				mes "As you command, Master.";
+				mes "However, I suggest hiring";
+				mes "a Kafra Employee as soon";
+				mes "as possible since our guild";
+				mes "would greatly benefit from";
+				mes "the convenient Kafra services.";
+				close;
+			}
+		}
+	case 5:
+		mes "[ Steward ]";
+		mes "Do you wish to enter the";
+		mes "Guild Treasure Room?";
+		mes "Only you, the Guild Master,";
+		mes "are permitted to enter.";
+		next;
+		mes "[ Steward ]";
+		mes "Please remember to open";
+		mes "the Treasure Boxes at the";
+		mes "proper time. Otherwise, the";
+		mes "treasure may disappear if";
+		mes "something unexpected happens.";
+		next;
+		switch(select("Go to Treasure Room:Cancel")) {
+		case 1:
+			mes "[ Steward ]";
+			mes "Allow me to guide you";
+			mes "on the secret path to";
+			mes "the Treasure Room.";
+			mes "Press the secret switch";
+			mes "when you wish to return here.";
+			close2;
+			warp "schg_cas04",381,381;
+			end;
+		case 2:
+			mes "[ Steward ]";
+			mes "Items in the Treasure Room";
+			mes "are produced once each day.";
+			mes "Therefore, you must obtain";
+			mes "the treasure items everyday.";
+			mes "For the sake of the guild,";
+			mes "prioritize treasure harvesting!";
+			close;
+		}
+	}
+
+Onstop:
+	stopnpctimer;
+	end;
+
+OnStartArena:
+	set .@GID,getcharid(2);
+	// Lower castle Economy
+	set .@Economy,GetCastleData("schg_cas04",2) - 5;
+	if (.@Economy < 0) set .@Economy, 0;
+	SetCastleData "schg_cas04", 2, .@Economy;
+	// Lower Castle Defence
+	set .@Defence,GetCastleData("schg_cas04",3) - 5;
+	if (.@Defence < 0) set .@Defence, 0;
+	SetCastleData "schg_cas04", 3, .@Defence;
+	// Set new owner
+	SetCastleData "schg_cas04",1, .@GID;
+	// Clear castle's data.
+	for( set .@i, 4; .@i <= 9; set .@i, .@i+1 )
+		SetCastleData "schg_cas04", .@i, 0;
+	// Disable Kafra
+	disablenpc "Kafra Employee#sch04";
+
+	set .msg,2;
+	if (.msg == 1) {
+		announce "Fortress [" + GetCastleName("schg_cas04") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch04_02::Onstart";
+	}
+	else if (.msg == 2) {
+		announce "The [" + getguildname(.@gid) + "] conquered the [Nithafjoll 4] stronghold of "+GetCastleName("schg_cas04"),bc_all;
+		mapannounce "schg_cas04","The emperium has been shattered!",bc_map,"0x00FF00";
+		if (agitcheck()) {
+			donpcevent "Manager#sch04_02::Onreset";
+			initnpctimer;
+		}
+		else {
+			donpcevent "Manager#sch04_02::Onreset";
+			stopnpctimer;
+		}
+	}
+	else if (.msg == 0) {
+		announce "Fortress [" + GetCastleName("schg_cas04") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch04_02::Onreset";
+		stopnpctimer;
+		end;
+	}
+	MapRespawnGuildID "schg_cas04",GetCastleData("schg_cas04",1),2;
+	GetCastleData "schg_cas04",0,"::OnRecvCastlesc04";
+	end;
+
+OnTimer10000:
+	donpcevent "Manager#sch04_02::Onchange";
+	mapannounce "schg_cas04","Rebuild this stonghold's Guardian Stones and Fortress Gates to secure your guild's new aquisition!",bc_map,"0x00FF00";
+	end;
+}
+
+// Guild Kafra
+schg_cas04,300,287,5	script	Kafra Employee#sch04	117,{
+	cutin "kafra_01",2;
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (getcharid(2) == .@GID && getgdskilllv(.@GID,10001)) {
+		mes "[Kafra Employee]";
+		mes "Welcome, proud member";
+		mes "of the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild!";
+		mes "The Kafra Corporation is ready";
+		mes "to assist you wherever you go!";
+		next;
+		switch(select("Use Storage:Use Warp Service:Rent Pushcart:Cancel")) {
+		case 1:
+			if (basicskillcheck() && getskilllv(1) < 6) {
+				mes "[Kafra Employee]";
+				mes "I'm so sorry, but you must";
+				mes "have at least Novice Skill";
+				mes "Lv.6 to use the Storage.";
+			}
+			else {
+				openstorage;
+			}
+			break;
+		case 2:
+			mes "[Kafra Employee]";
+			mes "Please tell me your";
+			mes "Warp destination.";
+			next;
+			switch(select("Juno -> 200 z:Cancel")) {
+			case 1:
+				if (Zeny < 200) {
+					mes "[Kafra Employee]";
+					mes "I'm sorry, but you don't";
+					mes "have enough zeny to pay";
+					mes "the warp fee. Would you";
+					mes "please check your funds again?";
+					close2;
+					cutin "kafra_01",255;
+					end;
+				}
+				set zeny,zeny-200;
+				warp "yuno",158,125;
+				end;
+			case 2:
+				cutin "kafra_01",255;
+			}
+			break;
+		case 3:
+			if (BaseClass != Job_Merchant) {
+				mes "[Kafra Employee]";
+				mes "I'm sorry, but the Pushcart";
+				mes "rental service can only be";
+				mes "used by Merchant, Blacksmith,";
+				mes "and Alchemist class characters.";
+			}
+			else if (checkcart() == 1) {
+				mes "[Kafra Employee]";
+				mes "Hm? You've already";
+				mes "rented a Pushcart.";
+			}
+			else {
+				mes "[Kafra Employee]";
+				mes "The Pushcart rental fee";
+				mes "is 800 zeny. Would you";
+				mes "like to rent a Pushcart?";
+				next;
+				switch(select("Rent Pushcart:Cancel")) {
+				case 1:
+					if (Zeny < 800) {
+						mes "[Kafra Employee]";
+						mes "I'm sorry, but you don't";
+						mes "have enough zeny to rent";
+						mes "one of our Pushcarts.";
+						close2;
+						cutin "kafra_01",255;
+						end;
+					}
+					set zeny,zeny-800;
+					setcart;
+					break;
+				case 2:
+					break;
+				}
+			}
+			break;
+		case 4:
+			mes "[Kafra Employee]";
+			mes "Thank you for using the";
+			mes "Kafra Service. Wherever";
+			mes "you go, Kafra will be";
+			mes "there to support you!";
+			close2;
+			cutin "kafra_01",255;
+			end;
+		}
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+	else {
+		mes "[Kafra Employee]";
+		mes "I'm sorry, but I've been";
+		mes "exclusively contracted";
+		mes "to the members of the";
+		mes "^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		mes "You'll have to ask another";
+		mes "Kafra Employee to help you...";
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+
+OnRecvCastlesc04:
+	if (GetCastleData("schg_cas04",1) == 0) {
+		monster "schg_cas04",0,0,"Evil Druid",1117,10;
+		monster "schg_cas04",0,0,"Khalitzburg",1132,4;
+		monster "schg_cas04",0,0,"Abysmal Knight",1219,3;
+		monster "schg_cas04",0,0,"Executioner",1205,1;
+		monster "schg_cas04",0,0,"Penomena",1216,10;
+		monster "schg_cas04",0,0,"Alarm",1193,18;
+		monster "schg_cas04",0,0,"Clock",1269,9;
+		monster "schg_cas04",0,0,"Raydric Archer",1276,12;
+		monster "schg_cas04",0,0,"Wanderer",1208,3;
+		monster "schg_cas04",0,0,"Alice",1275,1;
+		monster "schg_cas04",0,0,"Bloody Knight",1268,2;
+		monster "schg_cas04",0,0,"Dark Lord",1272,2;
+		monster "schg_cas04",0,0,"Tower Keeper",1270,4;
+	}
+	if (GetCastleData("schg_cas04",9) < 1) {
+		disablenpc "Kafra Employee#sch04";
+	}
+	end;
+}
+
+schg_cas04,391,391,0	script	 #sch04_switch	111,{
+	mes " ";
+	mes "^3355FFWill you pull";
+	mes "this small lever?^000000";
+	next;
+	switch(select("Pull Lever:Cancel")) {
+	case 1:
+		warp "schg_cas04",275,244;
+		end;
+	case 2:
+		close;
+	}
+}
+
+sch_gld,134,97,4	script	Hljod#flag_sc04_1::sc04_Flag	722,{
+	set .@GID, GetCastleData("schg_cas04",1);
+	if (.@GID == 0) {
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt declares that";
+		mes "one has yet to claim lordship";
+		mes "over this stronghold. The one";
+		mes "that breaks the Emperium will";
+		mes "be recognized as its new owner.";
+		close;
+	}
+	else {
+		if (getcharid(2) == .@GID) {
+			mes "[ Ringing Voice ]";
+			mes "Courageous one,";
+			mes "do you wish to return";
+			mes "to your stronghold?";
+			next;
+			switch(select("Return to the Stronghold:Cancel")) {
+			case 1:
+				set .@GID, GetCastleData("schg_cas04",1);
+				if (getcharid(2) == .@GID) {
+					warp "schg_cas04",120,290;
+					end;
+				}
+				close;
+			case 2:
+				close;
+			}
+		}
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt decrees that";
+		mes "this stronghold is owned";
+		mes "by the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		next;
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "^FF0000" + GetGuildMaster(.@GID) + "^000000 is";
+		mes "Guild Master of ^FF0000" + GetGuildName(.@GID) + "^000000.";
+		mes "Any that object must claim this";
+		mes "stronghold through strength of";
+		mes "steel and magic during the";
+		mes "appointed Guild Siege times.";
+		close;
+	}
+
+OnRecvCastlesc04:
+	FlagEmblem GetCastleData("schg_cas04",1);
+	end;
+}
+
+sch_gld,141,97,4	duplicate(sc04_Flag)	Hljod#flag_sc04_2	722

+ 2870 - 0
npc/guild2/schg_cas05.txt

@@ -0,0 +1,2870 @@
+//===== eAthena Script =======================================
+//= War of Emperium Second Edition
+//===== By: ==================================================
+//= L0ne_W0lf
+//===== Current Version: =====================================
+//= 1.0
+//===== Compatible With: =====================================
+//= eAthena SVN
+//===== Description: =========================================
+//= WoE SE Schwaltzvalt Castle 5
+//===== Additional Comments: =================================
+//= 1.0 First Version [L0ne_W0lf]
+//============================================================
+
+schg_cas05,1,1,0	script	Manager#sch05_02	111,{
+	end;
+
+OnInterIfInitOnce:
+	GetCastleData "schg_cas05",0,"::OnRecvCastlesc05";
+	end;
+
+OnRecvCastlesc05:
+	RequestGuildInfo GetCastleData("schg_cas05",1);
+	if (GetCastleData("schg_cas05",1) == 0) {
+		donpcevent "Manager#sch05_02::Onstart";
+	}
+	end;
+
+OnAgitStart:
+	if (agitcheck()) {
+		MapRespawnGuildID "schg_cas05",GetCastleData("schg_cas05",1),2;
+		GvgOn "schg_cas05";
+		donpcevent "Manager#sch05_02::Onstart";
+	}
+	else {
+		donpcevent "#sch05_RL00::OnDisable";
+		donpcevent "#sch05_RL01::OnDisable";
+		donpcevent "#sch05_RL02::OnDisable";
+		donpcevent "#sch05_RL03::OnDisable";
+	}
+	end;
+
+OnAgitEnd:
+	GvgOff "schg_cas05";
+	if (GetCastleData("schg_cas05",1)) {
+		KillMonster "schg_cas05","Steward#sch05::OnStartArena";
+		donpcevent "Manager#sch05_02::Onreset";
+	}
+	end;
+
+Onstart:
+	// 1st Guardian stone, 2nd Guardian stone, Barrier 1, Barrier 2, Barrier 3, Summon Guardians
+	// Settings for all but Summon Guardians
+	// 0 = Okay; 1 = Destroyed; 2 = Repairing
+	// Summon Guardians
+	// 0 = Do not Summon; 1 = Summon
+	if (GetCastleData("schg_cas05",1)) {
+		setarray $agit_sc05[0],0,0,0,0,0,0;
+		donpcevent "#sch05_df01::OnEnable";
+		donpcevent "#sch05_df02::OnEnable";
+		donpcevent "#sch05_RL00::OnEnable";
+		donpcevent "#sch05_RL01::OnEnable";
+		donpcevent "#sch05_RL02::OnEnable";
+		donpcevent "#sch05_RL03::OnEnable";
+	}
+	monster "schg_cas05",120,272,"Emperium",1288,1,"Steward#sch05::OnStartArena";
+	end;
+
+Onreset:
+	donpcevent "#sch05_df01::OnDisable";
+	donpcevent "#sch05_df02::OnDisable";
+	donpcevent "#sch05_gard01::Onreset";
+	donpcevent "#sch05_gard02::Onreset";
+	donpcevent "#sch05_RL00::OnDisable";
+	donpcevent "#sch05_RL01::OnDisable";
+	donpcevent "#sch05_RL02::OnDisable";
+	donpcevent "#sch05_RL03::OnDisable";
+	donpcevent "1st Guardian Stone#sch05::OnDisable";
+	donpcevent "2nd Guardian Stone#sch05::OnDisable";
+	donpcevent "Control Device01#sch05::OnDisable";
+	donpcevent "Control Device02#sch05::OnDisable";
+	donpcevent "Control Device03#sch05::OnDisable";
+	if (agitcheck()) {
+		setarray $agit_sc05[0],0,0,1,1,1,0;
+	}
+	end;
+
+Onchange:
+	setarray $agit_sc05[0],2,2,1,1,2,0;
+	monster "schg_cas05",120,272,"Emperium",1288,1,"Steward#sch05::OnStartArena";
+	donpcevent "Control Device03#sch05::OnEnable";
+	donpcevent "1st Guardian Stone#sch05::OnEnable";
+	donpcevent "2nd Guardian Stone#sch05::OnEnable";
+	end;
+
+OnClock0001:
+	set .@Treasure,GetCastleData("schg_cas05",2)/5+4;
+	if (.@Treasure) {
+		monster "schg_cas05",388,388,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 2) end;
+		monster "schg_cas05",388,389,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 3) end;
+		monster "schg_cas05",388,390,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 4) end;
+		monster "schg_cas05",387,390,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 5) end;
+		monster "schg_cas05",386,390,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 6) end;
+		monster "schg_cas05",385,390,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 7) end;
+		monster "schg_cas05",384,389,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 8) end;
+		monster "schg_cas05",384,388,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 9) end;
+		monster "schg_cas05",384,387,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 10) end;
+		monster "schg_cas05",384,386,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 11) end;
+		monster "schg_cas05",384,385,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 12) end;
+		monster "schg_cas05",384,384,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 13) end;
+		monster "schg_cas05",385,384,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 14) end;
+		monster "schg_cas05",386,384,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 15) end;
+		monster "schg_cas05",387,384,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 16) end;
+		monster "schg_cas05",388,384,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 17) end;
+		monster "schg_cas05",389,384,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 18) end;
+		monster "schg_cas05",390,384,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 19) end;
+		monster "schg_cas05",390,385,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 20) end;
+		monster "schg_cas05",390,386,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 21) end;
+		monster "schg_cas05",389,386,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 22) end;
+		monster "schg_cas05",388,386,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 23) end;
+		monster "schg_cas05",387,286,"Treasure Chest",1942,1,"Manager#sch05_02::OnTreasureDied";
+		if (.@Treasure < 24) end;
+		monster "schg_cas05",386,386,"Treasure Chest",1324,1,"Manager#sch05_02::OnTreasureDied";
+	}
+	end;
+
+OnTreasureDied:
+	end;
+}
+
+schg_cas05,123,306,3	script	Ef#sch05_01	868,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (.@GID == 0) {
+		mes "[Ef]";
+		mes "Great job. Now, all you";
+		mes "need to do is destroy this";
+		mes "Emperium to gain ownership";
+		mes "over this stronghold.";
+		close;
+	}
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) != getguildmaster(.@GID)) {
+			mes "[Ef]";
+			mes "As guardian of this";
+			mes "stronghold, I answer only";
+			mes "to the master of the guild";
+			mes "that controls this place.";
+			close;
+		}
+		else {
+			if (agitcheck() == 0) {
+				mes "[Ef]";
+				mes "I am Ef, guardian of";
+				mes "this stronghold. For now,";
+				mes "all is quiet in this place.";
+				next;
+				switch(select("Converse:Cancel")) {
+				case 1:
+					mes "[Ef]";
+					mes "Do you have any questions";
+					mes "about this stronghold?";
+					next;
+					switch(select("Guardian Stones:Fortress Gates:Link Flags:Battle Strategy:Cancel")) {
+					case 1:
+						mes "[Ef]";
+						mes "There is one Emperium";
+						mes "and two Guardian Stones in";
+						mes "each fortress. These stones";
+						mes "are the first line of defense,";
+						mes "and must be destroyed before";
+						mes "enemies can even enter.";
+						next;
+						mes "[Ef]";
+						mes "The stones are located in";
+						mes "^4D4DFFGate Houses^000000 which must be";
+						mes "protected to prevent enemies";
+						mes "from reaching the Emperium.";
+						mes "Guardian Stones can ^4D4DFFrecall";
+						mes "your Guardians^000000 for protection.";
+						next;
+						mes "[Ef]";
+						mes "Fortresses with higher levels";
+						mes "of defense can summon more";
+						mes "Guardians: this is why it is";
+						mes "so important for guilds to";
+						mes "invest in Defense Growth.";
+						next;
+						mes "[Ef]";
+						mes "Guardian Stones that have";
+						mes "been destroyed can be revived";
+						mes "after a certain time, but one of^FFFFFF ^000000 the guild members must give";
+						mes "me the order. I can also report^FFFFFF ^000000 the status of the Guardian Stones.";
+						close;
+					case 2:
+						mes "[Ef]";
+						mes "^4D4DFFFortress Gates^000000 are the second ^FFFFFF ^000000 line of guild stronghold defense,";
+						mes "and are protected by extra barricades activated by the Guardian Stones.";
+						mes "These gates are located in three different parts of the fortress.";
+						next;
+						mes "[Ef]";
+						mes "Barricades are protected by";
+						mes "Guardian Stones, and are";
+						mes "restored when the Guardian";
+						mes "Stones are retrieved. However,";
+						mes "it is not as easy to restore";
+						mes "destroyed Fortress Gates.";
+						next;
+						mes "[Ef]";
+						mes "Fortress Gates can only be";
+						mes "restored when the ^4D4DFFguild";
+						mes "master of a stronghold";
+						mes "changes^000000, or if ^4D4DFFrestoration";
+						mes "is requested by the guild";
+						mes "master of the stronghold^000000.";
+						close;
+					case 3:
+						mes "[Ef]";
+						mes "Strongholds have many";
+						mes "Link Flags that allow you";
+						mes "to access vital areas within";
+						mes "restrictions placed by the";
+						mes "Barricades. Usually, ^4D4DFFFlag 1";
+						mes "links to the Gate House^000000.";
+						next;
+						mes "[Ef]";
+						mes "Many flags link directly to";
+						mes "the flag near the Emperium.";
+						mes "The final numbered flag is";
+						mes "linked to the Convenience";
+						mes "Facility of the stronghold's";
+						mes "owner. Keep this in mind.";
+						close;
+					case 4:
+						mes "[Ef]";
+						mes "Strategy? It would be better";
+						mes "to develop your battle plan to";
+						mes "exploit your guild's advantages";
+						mes "and your enemies' weaknesses.";
+						mes "Use the Gate Houses and Barricades, and rebuild as quickly as you can!";
+						close;
+					case 5:
+						mes "[Ef]";
+						mes "You have no questions";
+						mes "to ask of me? Well, I'm";
+						mes "here to serve your needs.";
+						close;
+					}
+				case 2:
+					mes "[Ef]";
+					mes "I'm always here, so";
+					mes "feel free to request my";
+					mes "assistance whenever";
+					mes "the need arises.";
+					close;
+				}
+			}
+			else {
+				mes "[Ef]";
+				mes "Greetings, "+strcharinfo(0)+".";
+				mes "What are your orders?";
+				next;
+				switch(select("Increase Stronghold Defense:Situational Briefing:Cancel")) {
+				case 1:
+					if ($agit_sc05[5] == 0) {
+						if (getgdskilllv(.@GID,10002) == 0) {
+							mes "[Ef]";
+							mes "I'm sorry, but the Guardian";
+							mes "Stones aren't powerful enough";
+							mes "to summon Guardians yet. We";
+							mes "need to accumulate more";
+							mes "knowledge before they can";
+							mes "summon any Guardians.";
+							close;
+						}
+						else {
+							mes "[Ef]";
+							mes "I shall endeavor to summon";
+							mes "a Guardian through a Guardian";
+							mes "Stone. However, keep in mind";
+							mes "that this will not work if the";
+							mes "Guardian Stone is destroyed.";
+							setarray $agit_sc05[5],1;
+							if ($agit_sc05[0] == 0) {
+								donpcevent "#sch05_gard01::OnEnable";
+							}
+							if ($agit_sc05[1] == 0) {
+								donpcevent "#sch05_gard02::OnEnable";
+							}
+							close;
+						}
+					}
+					else {
+						mes "[Ef]";
+						mes "You've already commanded";
+						mes "me to summon a Guardian";
+						mes "to defend the stronghold.";
+						close;
+					}
+				case 2:
+					mes "[Ef]";
+					mes "Our defense status is...";
+					if ($agit_sc05[0] == 1) {
+						mes "1st Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc05[0] == 2) {
+						mes "1st Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc05[1] == 1) {
+						mes "2nd Guardian Stone: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc05[1] == 2) {
+						mes "2nd Guardian Stone: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Guardian Stone: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc05[2] == 1) {
+						mes "1st Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc05[2] == 2) {
+						mes "1st Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "1st Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc05[3] == 1) {
+						mes "2nd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc05[3] == 2) {
+						mes "2nd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "2nd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					if ($agit_sc05[4] == 1) {
+						mes "3rd Fortress Gate: ^FF0000Destroyed^000000";
+					}
+					else if ($agit_sc05[4] == 2) {
+						mes "3rd Fortress Gate: ^008000Repairing^000000";
+					}
+					else {
+						mes "3rd Fortress Gate: ^4D4DFFOperational^000000";
+					}
+					close;
+				case 3:
+					mes "[Ef]";
+					mes "I'll be standing by,";
+					mes "awaiting your orders.";
+					close;
+				}
+			}
+		}
+	}
+	else {
+		mes "[Ef]";
+		mes "Who are you? Scoundrel!";
+		mes "Leave this stronghold now!";
+		close;
+	}
+
+OnInit:
+	setarray $agit_sc05[0],0,0,0,0,0,0;
+	end;
+}
+
+schg_cas05,1,1,0	script	#sch05_gard01	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas05",3);
+	guardian "schg_cas05",111,18,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //0;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas05",109,44,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //1;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas05",109,44,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas05",65,22,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //2;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas05",109,44,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas05",65,22,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas05",110,40,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //3;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas05",109,44,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //1;
+		guardian "schg_cas05",65,22,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //2;
+		guardian "schg_cas05",110,40,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //3;
+		guardian "schg_cas05",88,20,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //4;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas05",108,32,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //1;
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",64,40,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //5;
+	mapannounce "schg_cas05","The 1st Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",47,43,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //6;
+	mapannounce "schg_cas05","The 2nd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer1800000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",109,48,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //7;
+	mapannounce "schg_cas05","The 3rd Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer2700000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",111,18,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //8;
+	mapannounce "schg_cas05","The 4th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	end;
+
+OnTimer3600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",112,32,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //9;
+	mapannounce "schg_cas05","The 5th Guardian has been summoned from the Gate House.",bc_map,"0xff4500";
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas05",120,37,"Guardian Soldier",1899,"#sch05_gard01::OnGuardianDied"; //10;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas05","#sch05_gard01::OnGuardianDied";
+	end;
+}
+
+schg_cas05,1,2,0	script	#sch05_gard02	-1,{
+OnEnable:
+	set .@Defence,GetCastleData("schg_cas05",3);
+	guardian "schg_cas05",130,22,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //11;
+	if ((.@Defense > 10) && (.@Defense < 31)) {
+		set .MyMobCount,2;
+		guardian "schg_cas05",187,15,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //12;
+	}
+	else if ((.@Defense > 30) && (.@Defense < 51)) {
+		set .MyMobCount,3;
+		guardian "schg_cas05",129,47,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas05",151,18,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //13;
+	}
+	else if ((.@Defense > 50) && (.@Defense < 71)) {
+		set .MyMobCount,4;
+		guardian "schg_cas05",129,47,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas05",151,18,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas05",187,15,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //14;
+	}
+	else if (.@Defense > 70) {
+		set .MyMobCount,5;
+		guardian "schg_cas05",129,47,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //12;
+		guardian "schg_cas05",151,18,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //13;
+		guardian "schg_cas05",187,15,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //14;
+		guardian "schg_cas05",128,42,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //15;
+	}
+	else {
+		set .MyMobCount,2;
+		guardian "schg_cas05",128,42,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //12;
+	}
+	initnpctimer;
+	end;
+
+OnTimer600000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",152,43,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //16;
+	end;
+
+OnTimer1200000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",187,15,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //17;
+	end;
+
+OnTimer2100000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",128,42,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //18;
+	end;
+
+OnTimer3000000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",130,22,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //19;
+	end;
+
+OnTimer3900000:
+	set .MyMobCount,.MyMobCount+1;
+	guardian "schg_cas05",130,28,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //20;
+	stopnpctimer;
+	end;
+
+OnGuardianDied:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount < 2) {
+		set .MyMobCount,.MyMobCount+1;
+		guardian "schg_cas05",151,18,"Guardian Soldier",1899,"#sch05_gard02::OnGuardianDied"; //21;
+	}
+	end;
+
+Onreset:
+	stopnpctimer;
+	killmonster "schg_cas05","#sch05_gard02::OnGuardianDied";
+	end;
+}
+
+schg_cas05,1,3,0	script	#sch05_df01	-1,{
+OnEnable:
+	guardian "schg_cas05",27,35,"1st Guardian Stone",1907,"#sch05_df01::OnGuardianStoneDied"; //22;
+	end;
+
+OnDisable:
+	killmonster "schg_cas05","#sch05_df01::OnGuardianStoneDied";
+	setarray $agit_sc05[0],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 1st Guardian Stone is Destroyed
+	setarray $agit_sc05[0],1;
+	if (($agit_sc05[0] == 1) || ($agit_sc05[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc05[1] == 1) || ($agit_sc05[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas05","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch05_RL00::OnDisable";
+		donpcevent "#sch05_gard01::Onreset";
+	}
+	else {
+		mapannounce "schg_cas05","The 1st Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch05_gard01::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "1st Guardian Stone#sch05::OnEnable";
+	setarray $agit_sc05[0],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas05,27,36,0	script	1st Guardian Stone#sch05	844,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"1st Guardian Stone#sch05" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch05" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"1st Guardian Stone#sch05" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch05" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 3:
+							specialeffect 56; //"1st Guardian Stone#sch05" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"1st Guardian Stone#sch05" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc05[0] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "already completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch05_df01::OnEnable";
+							specialeffect 135; //"1st Guardian Stone#sch05" EF_ICECRASH
+							disablenpc "1st Guardian Stone#sch05";
+							setarray $agit_sc05[0],0;
+							set .@df_all,$agit_sc05[0]+$agit_sc05[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas05","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch05_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas05","The 1st Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc05[5] == 1) {
+								donpcevent "#sch05_gard01::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "1st Guardian Stone#sch05";
+	end;
+
+OnEnable:
+	enablenpc "1st Guardian Stone#sch05";
+	specialeffect 247; //"1st Guardian Stone#sch05" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "1st Guardian Stone#sch05";
+	end;
+}
+
+schg_cas05,1,4,0	script	#sch05_df02	-1,{
+OnEnable:
+	guardian "schg_cas05",207,75,"2nd Guardian Stone",1908,"#sch05_df02::OnGuardianStoneDied"; //23;
+	end;
+
+OnDisable:
+	killmonster "schg_cas05","#sch05_df02::OnGuardianStoneDied";
+	setarray $agit_sc05[1],1; //Global Variable
+	stopnpctimer;
+	end;
+
+OnGuardianStoneDied:
+	// 2nd Guardian Stone is Destroyed
+	setarray $agit_sc05[1],1;
+	if (($agit_sc05[0] == 1) || ($agit_sc05[0] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (($agit_sc05[1] == 1) || ($agit_sc05[1] == 2)) {
+		set .@destroyed,.@destroyed + 1;
+	}
+	if (.@destroyed == 2) {
+		mapannounce "schg_cas05","All of the Guardian Stones have been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch05_RL00::OnDisable";
+		donpcevent "#sch05_gard02::Onreset";
+	}
+	else {
+		mapannounce "schg_cas05","2nd Guardian Stone has been destroyed!",bc_map,"0x00ff00";
+		donpcevent "#sch05_gard02::Onreset";
+	}
+	initnpctimer;
+	end;
+
+OnTimer300000:
+	donpcevent "2nd Guardian Stone#sch05::OnEnable";
+	setarray $agit_sc05[1],2; //Global Variable
+	stopnpctimer;
+	end;
+}
+
+schg_cas05,208,75,0	script	2nd Guardian Stone#sch05	844,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFYou will need the";
+		mes "following materials to";
+		mes "rebuild a destroyed";
+		mes "Guardian Stone.^000000";
+		next;
+		mes "1 Oridecon";
+		mes "1 Elunium";
+		mes "30 Stones";
+		mes "5 Blue Gemstones";
+		mes "5 Yellow Gemstones";
+		mes "5 Red Gemstones";
+		next;
+		mes "^3355FFDo you want to continue?^000000";
+		switch(select("No:Continue")) {
+		case 1:
+			mes "^3355FFWork canceled.^000000";
+			close;
+		case 2:
+			if ((countitem(984) > 0) && (countitem(985) > 0) && (countitem(7049) > 29) && (countitem(717) > 4) && (countitem(715) > 4) && (countitem(716) > 4)) {
+				mes "^3355FFArrange Stones, Elunium, and";
+				mes "Oridecon, in that order, in the";
+				mes "center. Then you must arrange";
+				mes "the enchanted Gemstones to";
+				mes "rebuild the Guardian Stone.^000000";
+				next;
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFElunium has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFOridecon has been";
+					mes "placed in the center.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFStones have been";
+					mes "placed in the center.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Elunium.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Oridecon.^000000";
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou have lined the";
+					mes "outside of the center";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				switch(select("Elunium:Oridecon:Stone")) {
+				case 1:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Elunium.^000000";
+					next;
+					break;
+				case 2:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Oridecon.^000000";
+					set .@nice,.@nice+10;
+					next;
+					break;
+				case 3:
+					mes "^3355FFYou covered the";
+					mes "rest of the materials";
+					mes "with some Stones.^000000";
+					next;
+					break;
+				}
+				mes "^3355FFNow you need to arrange";
+				mes "the enchanted Gemstones";
+				mes "accordingly. You can identify";
+				mes "their Magic properties by";
+				mes "their casting effect.^000000";
+				next;
+				while(1) {
+					if (.@roof0 > 7) {
+						break;
+					}
+					else {
+						switch(rand(1,3)) {
+						case 1:
+							specialeffect 54; //"2nd Guardian Stone#sch05" EF_BEGINSPELL2
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch05" EF_STEAL
+								next;
+								break;
+							}
+							break;
+						case 2:
+							specialeffect 225; //"2nd Guardian Stone#sch05" EF_VOLCANO
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch05" EF_STEAL
+								next;
+								break;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+							break;
+						case 3:
+							specialeffect 56; //"2nd Guardian Stone#sch05" EF_BEGINSPELL4
+							mes "^3355FFThe Gemstones must";
+							mes "be arranged in the correct";
+							mes "order according to their";
+							mes "magic properties and power.^000000";
+							next;
+							switch(select("Red Gemstone:Yellow Gemstone:Blue Gemstone")) {
+							case 1:
+								mes "^3355FFYou placed the Red Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							case 2:
+								mes "^3355FFYou placed the Yellow Gemstone.^000000";
+								set .@nice,.@nice+10;
+								set .@roof0,.@roof0 + 1;
+								specialeffect 18; //"2nd Guardian Stone#sch05" EF_STEAL
+								next;
+								break;
+							case 3:
+								mes "^3355FFYou placed the Blue Gemstone.";
+								mes "However, the Guardian Stone";
+								mes "Repair System failed because";
+								mes "of a magic power conflict.^000000";
+								close;
+							}
+						}
+					}
+				}
+				if (.@nice > 90) {
+					if ($agit_sc05[1] == 0) {
+						mes "^3355FFThe Guardian Stone";
+						mes "Repair System has";
+						mes "successfully completed.^000000";
+						close;
+					}
+					else {
+						if (agitcheck() == 0) {
+							mes "^3355FFIt is impossible to";
+							mes "rebuild the Guardian";
+							mes "Stone because the";
+							mes "Emperium is not present.^000000";
+							close;
+						}
+						else {
+							mes "^3355FFThe Gemstones have been";
+							mes "arranged, and the Guardian";
+							mes "Stone is successfully repaired.^000000";
+							delitem 984,1; //Oridecon
+							delitem 985,1; //Elunium
+							delitem 7049,30; //Stone
+							delitem 717,5; //Blue_Gemstone
+							delitem 715,5; //Yellow_Gemstone
+							delitem 716,5; //Red_Gemstone
+							close2;
+							donpcevent "#sch05_df02::OnEnable";
+							specialeffect 135; //"2nd Guardian Stone#sch05" EF_ICECRASH
+							disablenpc "2nd Guardian Stone#sch05";
+							setarray $agit_sc05[1],0;
+							set .@df_all,$agit_sc05[0]+$agit_sc05[1];
+							if (.@df_all == 0) {
+								mapannounce "schg_cas05","Both Guardian Stones have been erected, bolstering this stronghold's defenses!",bc_map,"0x00ff00";
+								donpcevent "#sch05_RL00::OnEnable";
+							}
+							else {
+								mapannounce "schg_cas05","The 2nd Guardian Stone has been repaired successfully.",bc_map,"0x00ff00";
+							}
+							if ($agit_sc05[5] == 1) {
+								donpcevent "#sch05_gard02::OnEnable";
+							}
+							end;
+						}
+					}
+				}
+				else {
+					mes "^3355FFAfter all of that work...";
+					mes "It looks like you failed";
+					mes "to fix the Guardian Stone,";
+					mes "and lost some materials.^000000";
+					delitem 7049,10; //Stone
+					delitem 717,2; //Blue_Gemstone
+					delitem 715,2; //Yellow_Gemstone
+					delitem 716,2; //Red_Gemstone
+					close;
+				}
+			}
+			else {
+				mes "^3355FFYou don't have enough";
+				mes "materials to repair";
+				mes "the Guardian Stone.^000000";
+				close;
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "2nd Guardian Stone#sch05";
+	end;
+
+OnEnable:
+	enablenpc "2nd Guardian Stone#sch05";
+	specialeffect 247; //"2nd Guardian Stone#sch05" EF_MAPPILLAR2
+	end;
+
+OnDisable:
+	disablenpc "2nd Guardian Stone#sch05";
+	end;
+}
+
+// Barrier Summoners
+schg_cas05,2,1,0	script	#sch05_RL00	-1,{
+OnEnable:
+	setcell "schg_cas05",114,48,126,48,cell_walkable,0;
+	setcell "schg_cas05",114,48,126,48,cell_shootable,0;
+	guardian "schg_cas05",115,49," ",1905,"#sch05_RL00::OnBarrierDestroyed"; //24;
+	guardian "schg_cas05",117,49," ",1905,"#sch05_RL00::OnBarrierDestroyed"; //25;
+	guardian "schg_cas05",119,49," ",1905,"#sch05_RL00::OnBarrierDestroyed"; //26;
+	guardian "schg_cas05",121,49," ",1905,"#sch05_RL00::OnBarrierDestroyed"; //27;
+	guardian "schg_cas05",123,49," ",1905,"#sch05_RL00::OnBarrierDestroyed"; //28;
+	guardian "schg_cas05",125,49," ",1905,"#sch05_RL00::OnBarrierDestroyed"; //29;
+	end;
+
+OnDisable:
+	setcell "schg_cas05",114,48,126,48,cell_walkable,1;
+	setcell "schg_cas05",114,48,126,48,cell_shootable,1;
+	killmonster "schg_cas05","#sch05_RL00::OnBarrierDestroyed";
+	end;
+
+OnBarrierDestroyed:
+	end;
+}
+
+schg_cas05,2,2,0	script	#sch05_RL01	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas05",114,51,126,51,cell_walkable,0;
+	guardian "schg_cas05",115,50," ",1905,"#sch05_RL01::OnBarrierDestroyed"; //30;
+	guardian "schg_cas05",117,50," ",1905,"#sch05_RL01::OnBarrierDestroyed"; //31;
+	guardian "schg_cas05",119,50," ",1905,"#sch05_RL01::OnBarrierDestroyed"; //32;
+	guardian "schg_cas05",121,50," ",1905,"#sch05_RL01::OnBarrierDestroyed"; //33;
+	guardian "schg_cas05",123,50," ",1905,"#sch05_RL01::OnBarrierDestroyed"; //34;
+	guardian "schg_cas05",125,50," ",1905,"#sch05_RL01::OnBarrierDestroyed"; //35;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc05[2],1;
+		mapannounce "schg_cas05","The 1st Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas05",114,51,126,51,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas05",114,51,126,51,cell_walkable,1;
+	killmonster "schg_cas05","#sch05_RL01::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas05,2,3,0	script	#sch05_RL02	-1,{
+OnEnable:
+	set .MyMobCount,6;
+	setcell "schg_cas05",114,154,126,154,cell_walkable,0;
+	guardian "schg_cas05",115,153," ",1905,"#sch05_RL02::OnBarrierDestroyed"; //36;
+	guardian "schg_cas05",117,153," ",1905,"#sch05_RL02::OnBarrierDestroyed"; //37;
+	guardian "schg_cas05",119,153," ",1905,"#sch05_RL02::OnBarrierDestroyed"; //38;
+	guardian "schg_cas05",121,153," ",1905,"#sch05_RL02::OnBarrierDestroyed"; //39;
+	guardian "schg_cas05",123,153," ",1905,"#sch05_RL02::OnBarrierDestroyed"; //40;
+	guardian "schg_cas05",125,153," ",1905,"#sch05_RL02::OnBarrierDestroyed"; //41;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc05[3],1;
+		mapannounce "schg_cas05","The 2nd Fortress Gate is destroyed.",bc_map,"0x00ff00";
+		setcell "schg_cas05",114,154,126,154,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas05",114,154,126,154,cell_walkable,1;
+	killmonster "schg_cas05","#sch05_RL02::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas05,2,4,0	script	#sch05_RL03	-1,{
+OnEnable:
+	set .MyMobCount,4;
+	setcell "schg_cas05",116,241,126,241,cell_walkable,0;
+	guardian "schg_cas05",116,240," ",1905,"#sch05_RL03::OnBarrierDestroyed"; //42;
+	guardian "schg_cas05",118,240," ",1905,"#sch05_RL03::OnBarrierDestroyed"; //43;
+	guardian "schg_cas05",120,240," ",1905,"#sch05_RL03::OnBarrierDestroyed"; //44;
+	guardian "schg_cas05",122,240," ",1905,"#sch05_RL03::OnBarrierDestroyed"; //45;
+	end;
+
+OnBarrierDestroyed:
+	set .MyMobCount,.MyMobCount-1;
+	if (.MyMobCount == 0) {
+		setarray $agit_sc05[4],1;
+		mapannounce "schg_cas05","The 3rd Fortress Gate is destroyed!",bc_map,"0x00ff00";
+		setcell "schg_cas05",116,241,126,241,cell_walkable,1;
+	}
+	end;
+
+OnDisable:
+	setcell "schg_cas05",116,241,126,241,cell_walkable,1;
+	killmonster "schg_cas05","#sch05_RL03::OnBarrierDestroyed";
+	end;
+}
+
+schg_cas05,124,52,0	script	Control Device01#sch05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc05[2] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon,";
+									mes "but it's not working very well.^FFFFFF ^3355FF You'll have to try something else.";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch05_RL01::OnEnable";
+							disablenpc "Control Device01#sch05";
+							mapannounce "schg_cas05","The 1st Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc05[2],0;
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+
+OnInit:
+	disablenpc "Control Device01#sch05";
+	end;
+
+OnEnable:
+	enablenpc "Control Device01#sch05";
+	end;
+
+OnDisable:
+	disablenpc "Control Device01#sch05";
+	end;
+}
+
+schg_cas05,128,157,0	script	Control Device02#sch05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc05[3] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch05_RL02::OnEnable";
+							disablenpc "Control Device02#sch05";
+							mapannounce "schg_cas05","The 2nd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc05[3],0; //Global Variable
+							setarray $agit_sc05[2],2; //Global Variable
+							donpcevent "Control Device01#sch05::OnEnable";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+	
+OnInit:
+	disablenpc "Control Device02#sch05";
+	end;
+
+OnEnable:
+	enablenpc "Control Device02#sch05";
+	end;
+
+OnDisable:
+	disablenpc "Control Device02#sch05";
+	end;
+}
+
+schg_cas05,109,247,0	script	Control Device03#sch05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		if (strcharinfo(0) == getguildmaster(.@GID)) {
+			if ($agit_sc05[4] == 2) {
+				mes "^3355FFDemolished Fortress";
+				mes "Gates can be repaired,";
+				mes "but you will need to gather";
+				mes "the following materials.^000000";
+				next;
+				mes "^4D4DFF10 Steel^000000,";
+				mes "^4D4DFF30 Trunks^000000,";
+				mes "^4D4DFF5 Oridecon^000000, and";
+				mes "^4D4DFF10 Emveretarcon^000000.";
+				next;
+				select("Continue");
+				if ((countitem(1019) > 29) && (countitem(999) > 9) && (countitem(1011) > 9) && (countitem(984) > 4)) {
+					mes "^3355FFYou will need Trunks to";
+					mes "repair the support frame,";
+					mes "Oridecon to enhance the";
+					mes "gate's endurance, and";
+					mes "Emveretarcon to basically";
+					mes "hold everything together.^000000";
+					next;
+					set .@ro_of01,rand(10,15);
+					while(1) {
+						if (.@ro_of02 == .@ro_of01) {
+							break;
+						}
+						else {
+							switch(rand(1,4)) {
+							case 1:
+								mes "^3355FFThe support frame";
+								mes "is badly damaged:";
+								mes "fixing this part";
+								mes "is a top priority.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFThe frame has been";
+									mes "reinforced with wood.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 2:
+								mes "^3355FFIt looks like the gate's";
+								mes "overall endurance needs to";
+								mes "be reinforced with something.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood";
+									mes "to reinforce the gate.^000000";
+									set .@ro_of02,.@ro_of02 + 1;
+									next;
+									break;
+								case 2:
+									mes "^3355FFYou tried using steel";
+									mes "to reinforce the gate, but";
+									mes "it's not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou hammered the";
+									mes "oridecon: it looks";
+									mes "like this will work.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								}
+								break;
+							case 3:
+								mes "^3355FFThe damage to the gate";
+								mes "has caused all these";
+								mes "cracks. You'll have to";
+								mes "weld them solid somehow.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou used steel to weld";
+									mes "all the cracks: the gate is";
+									mes "is starting to look more solid.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 3:
+									mes "^3355FFYou tried using emveretarcon";
+									mes "to reinforce the gate, but it's";
+									mes "not working well at all.";
+									mes "You'll have to start over.^000000";
+									close;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+								break;
+							case 4:
+								mes "^3355FFNow you need to make";
+								mes "sure that the gate is held";
+								mes "together pretty solidly.^000000";
+								next;
+								switch(select("Trunk:Steel:Emveretarcon:Oridecon")) {
+								case 1:
+									mes "^3355FFYou tried using wood to fix";
+									mes "this problem, but it seems";
+									mes "to have made it worse.";
+									mes "You'll have to start all over.^000000";
+									close;
+								case 2:
+									mes "^3355FFYou tried using steel,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								case 3:
+									mes "^3355FFYou successfully used";
+									mes "the emveretarcon to repair";
+									mes "much of the gate's damage.^000000";
+									set .@rp_temp,.@rp_temp + 1;
+									set .@ro_of02,.@ro_of02 + 1;
+									specialeffect2 101; // EF_REPAIRWEAPON
+									next;
+									break;
+								case 4:
+									mes "^3355FFYou tried using oridecon,";
+									mes "but it's not working very";
+									mes "well. You'll have to try";
+									mes "something else.^000000";
+									close;
+								}
+							}
+						}
+					}
+					mes "^3355FFWell, it looks like";
+					mes "you're just about done";
+					mes "with repairing the gate.^000000";
+					next;
+					if (agitcheck() == 0) {
+						mes "^3355FFUnfortunately, the Fortress";
+						mes "Gate can't be reconstructed:";
+						mes "the Emperium is no longer here.^000000";
+						close;
+					}
+					else {
+						if (.@rp_temp == .@ro_of01) {
+							mes "^3355FFThe Fortress Gate has";
+							mes "been successfully repaired!^000000";
+							delitem 1019,30; //Wooden_Block
+							delitem 999,10; //Steel
+							delitem 1011,10; //Emveretarcon
+							delitem 984,5; //Oridecon
+							close2;
+							donpcevent "#sch05_RL03::OnEnable";
+							disablenpc "Control Device03#sch05";
+							mapannounce "schg_cas05","The 3rd Fortress Gate has been reconstructed!",bc_map,"0x00ff00";
+							setarray $agit_sc05[4],0;
+							setarray $agit_sc05[3],2;
+							donpcevent "Control Device02#sch05::OnEnable";
+							end;
+						}
+						else {
+							mes "^3355FFThe wall has been breached,";
+							mes "and the attempt to repair the";
+							mes "Fortress Gate has failed.";
+							mes "You lost some of your";
+							mes "repair resources...^000000";
+							delitem 984,2; //Oridecon
+							delitem 999,4; //Steel
+							delitem 1019,14; //Wooden_Block
+							delitem 1011,3; //Emveretarcon
+							close;
+						}
+					}
+				}
+				else {
+					mes "^3355FFYou can't attempt to repair";
+					mes "the Fortress Gate if you don't";
+					mes "have all the needed materials.^000000";
+					close;
+				}
+			}
+		}
+	}
+	end;
+	
+OnInit:
+	disablenpc "Control Device03#sch05";
+	end;
+
+OnEnable:
+	enablenpc "Control Device03#sch05";
+	end;
+
+OnDisable:
+	disablenpc "Control Device03#sch05";
+	end;
+}
+
+// Link Flags
+schg_cas05,106,302,0	script	LF-01#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("First Gate House:Second Gate House:Cancel")) {
+		case 1:
+			warp "schg_cas05",19,26;
+			end;
+		case 2:
+			warp "schg_cas05",219,90;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,109,302,0	script	LF-02#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 1-1:Defense Area 1-2:Cancel")) {
+		case 1:
+			warp "schg_cas05",89,43;
+			end;
+		case 2:
+			warp "schg_cas05",141,45;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,112,302,0	script	LF-03#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 2-1:Defense Area 2-2:Cancel")) {
+		case 1:
+			warp "schg_cas05",137,54;
+			end;
+		case 2:
+			warp "schg_cas05",102,54;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,115,302,0	script	LF-04#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 2-3:Defense Area 2-4:Cancel")) {
+		case 1:
+			warp "schg_cas05",94,147;
+			end;
+		case 2:
+			warp "schg_cas05",163,140;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,118,302,0	script	LF-05#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 2-3:Defense Area 2-4:Cancel")) {
+		case 1:
+			warp "schg_cas05",87,220;
+			end;
+		case 2:
+			warp "schg_cas05",151,220;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,121,302,0	script	LF-06#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Defense Area 3-1:Defense Area 3-2:Cancel")) {
+		case 1:
+			warp "schg_cas05",100,242;
+			end;
+		case 2:
+			warp "schg_cas05",136,242;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,124,302,0	script	LF-07#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Center 1 Area:Center 2 Area:Cancel")) {
+		case 1:
+			warp "schg_cas05",120,168;
+			end;
+		case 2:
+			warp "schg_cas05",119,211;
+			end;
+		case 3:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,127,302,0	script	LF-08#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Area 1-1:Area 2-1:Area 3-1:Cancel")) {
+		case 1:
+			warp "schg_cas05",89,43;
+			end;
+		case 2:
+			warp "schg_cas05",94,147;
+			end;
+		case 3:
+			warp "schg_cas05",100,242;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,130,302,0	script	LF-09#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Please";
+		mes "choose a destination";
+		mes "within the stronghold.^000000";
+		switch(select("Area 1-2:Area 2-3:Area 3-2:Cancel")) {
+		case 1:
+			warp "schg_cas05",141,45;
+			end;
+		case 2:
+			warp "schg_cas05",163,140;
+			end;
+		case 3:
+			warp "schg_cas05",136,243;
+			end;
+		case 4:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,133,302,0	script	LF-10#schg_cas05	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to the";
+		mes "Convenience Facility for";
+		mes "guild members?^000000";
+		switch(select("Go to Convenience Facility:Cancel")) {
+		case 1:
+			warp "schg_cas05",275,244;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,17,45,0	script	Skidbladnir#LF_sc05_1::LF_sc05_1	111,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to";
+		mes "the Emperium Center?^000000";
+		switch(select("Teleport:Cancel")) {
+		case 1:
+			warp "schg_cas05",120,290;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+}
+
+schg_cas05,207,95,0	duplicate(LF_sc05_1)	Skidbladnir#LF_sc05_2	111
+
+schg_cas05,111,46,4	script	Skidbladnir#LF_sc05_3::LF_sc05_2	722,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID) {
+		mes "^3355FFThis is the Stronghold";
+		mes "Teleport Service. Would";
+		mes "you like to teleport to";
+		mes "the Emperium Center?^000000";
+		switch(select("Teleport:Cancel")) {
+		case 1:
+			warp "schg_cas05",120,290;
+			end;
+		case 2:
+			close;
+		}
+	}
+	end;
+
+OnRecvCastlesc05:
+	FlagEmblem GetCastleData("schg_cas05",1);
+	end;
+}
+
+schg_cas05,129,46,4	duplicate(LF_sc05_2)	Skidbladnir#LF_sc05_4	722
+schg_cas05,99,77,0	duplicate(LF_sc05_1)	Skidbladnir#LF_sc05_5	111
+schg_cas05,140,77,0	duplicate(LF_sc05_1)	Skidbladnir#LF_sc05_6	111
+schg_cas05,109,150,4	duplicate(LF_sc05_2)	Skidbladnir#LF_sc05_7	722
+schg_cas05,130,150,4	duplicate(LF_sc05_2)	Skidbladnir#LF_sc05_8	722
+schg_cas05,112,212,0	duplicate(LF_sc05_1)	Skidbladnir#LF_sc05_9	111
+schg_cas05,127,212,0	duplicate(LF_sc05_1)	Skidbladnir#LF_sc05_10	111
+schg_cas05,113,238,0	duplicate(LF_sc05_1)	Skidbladnir#LF_sc05_11	111
+schg_cas05,126,238,0	duplicate(LF_sc05_1)	Skidbladnir#LF_sc05_12	111
+schg_cas05,95,247,0	duplicate(LF_sc05_1)	Skidbladnir#LF_sc05_13	111
+schg_cas05,144,247,0	duplicate(LF_sc05_1)	Skidbladnir#LF_sc05_14	111
+
+// Guild Manager
+schg_cas05,247,305,3	script	Steward#sch05	55,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (.@GID == 0) {
+		mes "[ Steward ]";
+		mes "I await for the master";
+		mes "whom destiny will choose";
+		mes "for me. Do you think you";
+		mes "have to courage and strength";
+		mes "to conquer this stronghold?";
+		close;
+	}
+	if (getcharid(2) != .@GID || strcharinfo(0) != getguildmaster(.@GID)) {
+		mes "[ Steward ]";
+		mes "Hmpf. Your threats don't";
+		mes "scare me! Guardians, drive";
+		mes "this infidel away from here!";
+		mes "I will always be loyal to the";
+		mes "master of this stronghold,";
+		MES "the one and only^FF0000" + getguildmaster(.@GID) + "^000000.";
+		close;
+	}
+	mes "[ Steward ]";
+	mes "Ah, Master ^FF0000" + getguildmaster(.@GID) + "^000000...";
+	mes "How shall I serve you today?";
+	mes "Was there an aspect of this";
+	mes "stronghold's maintenance";
+	mes "you wanted to discuss?";
+	next;
+	switch(select("Stronghold Briefing:Invest in Commercial Growth:Invest in Defense growth:Hire/Fire Storage Staff:Go to Master's room")) {
+	case 1:
+		mes "[ Steward ]";
+		mes "The Commercial Growth";
+		mes "Level of the stronghold is ^0000ff" + GetCastleData("schg_cas05",2) + ".";
+		if (GetCastleData("schg_cas05",4) > 0) {
+			mes "Last time, you invested in";
+			mes "Commercial Growth " + GetCastleData("schg_cas05",4) + ".";
+		}
+		next;
+		mes "[ Steward ]";
+		mes "Our stronghold's";
+		mes "safeguard level is " + GetCastleData("schg_cas05",3) + ".";
+		if (GetCastleData("schg_cas05",5) > 0) {
+			mes "Last time, you invested";
+			mes "in defense " + GetCastleData("schg_cas05",5) + " times.";
+		}
+		mes " ";
+		mes "That is all, master.";
+		close;
+	case 2:
+		set .@Economy,GetCastleData("schg_cas05",2);
+		if(.@Economy < 8) set .@eco_invest,10000;
+		if(.@Economy >= 8) set .@eco_invest,20000;
+		if(.@Economy >= 16) set .@eco_invest,40000;
+		if(.@Economy >= 25) set .@eco_invest,80000;
+		if(.@Economy >= 34) set .@eco_invest,160000;
+		if(.@Economy >= 44) set .@eco_invest,320000;
+		if(.@Economy >= 54) set .@eco_invest,640000;
+		if(.@Economy >= 65) set .@eco_invest,1280000;
+		if(.@Economy >= 76) set .@eco_invest,2560000;
+		if(.@Economy >= 88) set .@eco_invest,5120000;
+		mes "[ Steward ]";
+		mes "Raising the stronghold's";
+		mes "commercial growth will";
+		mes "increase the quantity of";
+		mes "goods produced for the guild.";
+		mes "Investing in commercial growth";
+		mes "will help the guild's future.";
+		next;
+		mes "[ Steward ]";
+		mes "You can make one investment";
+		mes "each day, but if you can make";
+		mes "two investments if you pay";
+		mes "more zeny: this will speed";
+		mes "up commercial development,";
+		mes "but can be quite expensive.";
+		next;
+		if (.@Economy == 100) {
+			mes "[ Steward ]";
+			mes "However, our stronghold's";
+			mes "commerical growth level is";
+			mes "at 100%. It's not possible to";
+			mes "develop commercial growth";
+			mes "any further than that.";
+			close;
+		}
+		if (GetCastleData("schg_cas05",4) == 2) {
+			mes "[ Steward ]";
+			mes "You've already made two";
+			mes "investments today, so you'll";
+			mes "have to wait until tomorrow";
+			mes "to make another investment.";
+			close;
+		}
+		if (GetCastleData("schg_cas05",4) == 0) {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000 zeny";
+			mes "to make an investment";
+			mes "Will you invest in this";
+			mes "stronghold's commerical";
+			mes "development now?";
+		}
+		else {
+			mes "[ Steward ]";
+			mes "You must pay ^FF0000" + .@eco_invest + "^000000";
+			mes "more zeny to make a second";
+			mes "investment today. Will you";
+			mes "invest one more time?";
+		}
+		next;
+		switch(select("Invest in Commercial Growth:Cancel")) {
+		case 1:
+			if (Zeny < .@eco_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				end;
+			}
+			set zeny,zeny-.@eco_invest;
+			SetCastleData "schg_cas05",4,GetCastleData("schg_cas05",4)+1;
+			SetCastleData "schg_cas05",2,.@Economy + 1 + (.@Economy<99 && rand(2) && getgdskilllv(.@GID,10014));
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. We can expect";
+			mes "to see the results of this";
+			mes "investment by tomorrow.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 3:
+		set .@Defence,GetCastleData("schg_cas05",3);
+		if(.@Defence < 8) set .@def_invest,20000;
+		if(.@Defence >= 8) set .@def_invest,40000;
+		if(.@Defence >= 16) set .@def_invest,80000;
+		if(.@Defence >= 25) set .@def_invest,160000;
+		if(.@Defence >= 34) set .@def_invest,320000;
+		if(.@Defence >= 44) set .@def_invest,640000;
+		if(.@Defence >= 54) set .@def_invest,1280000;
+		if(.@Defence >= 65) set .@def_invest,2560000;
+		if(.@Defence >= 76) set .@def_invest,5120000;
+		if(.@Defence >= 88) set .@def_invest,10240000;
+		mes "[ Steward ]";
+		mes "Investing in our stronghold's";
+		mes "defense will enhance the";
+		mes "durability of our Guardians";
+		mes "and the Emperium. We'll need";
+		mes "every advantage to protect";
+		mes "ourselves from our enemies.";
+		next;
+		mes "[ Steward ]";
+		mes "You can invest in defense";
+		mes "once per day, but if you pay";
+		mes "more zeny, you can invest";
+		mes "a maximum of two times daily.";
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas05",3) == 100) {
+			mes "The Defense Level of this";
+			mes "stronghold is 100%, and";
+			mes "cannot be increased further.";
+			close;
+		}
+		if (GetCastleData("schg_cas05",5) == 2) {
+			mes "Master, you've already";
+			mes "invested in Defense twice";
+			mes "today. You'll need to wait";
+			mes "until tomorrow if you really";
+			mes "want to increase our defenses.";
+			close;
+		}
+		next;
+		mes "[ Steward ]";
+		if (GetCastleData("schg_cas05",5) == 0) {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses.";
+			mes "Will you invest now?";
+		}
+		else {
+			mes "We need ^FF0000" + .@def_invest + "^000000";
+			mes "zeny to invest in our";
+			mes "stronghold's defenses";
+			mes "a second time today.";
+			mes "Will you invest now?";
+		}
+		next;
+		switch(select("Invest in Defense:Cancel")) {
+		case 1:
+			if (Zeny < .@def_invest) {
+				mes "[ Steward ]";
+				mes "I'm sorry, Master, but";
+				mes "you do not have enough";
+				mes "zeny to make an investment";
+				mes "for the guild today.";
+				close;
+			}
+			set zeny,zeny-.@def_invest;
+			SetCastleData "schg_cas05",5,GetCastleData("schg_cas05",5)+1;
+			SetCastleData "schg_cas05",3,.@Defence+1;
+			mes "[ Steward ]";
+			mes "A wise use of the guild's";
+			mes "funds, Master. Increasing";
+			mes "the frequency of treasure";
+			mes "procured by the guild will";
+			mes "definitely help us all.";
+			close;
+		case 2:
+			mes "[ Steward ]";
+			mes "As you command, Master.";
+			close;
+		}
+	case 4:
+		if (GetCastleData("schg_cas05",9) == 1) {
+			mes "[ Steward ]";
+			mes "Do you wish to dismiss";
+			mes "the Kafra Employee that";
+			mes "we've hired for the guild?";
+			next;
+			switch(select("Dismiss:Cancel")) {
+			case 1:
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "Master, please reconsider!";
+				mes "I've been working very hard";
+				mes "for the success of the guild!";
+				mes "I'll try harder to serve the";
+				mes "guild members of this";
+				mes "stronghold, I promise!";
+				next;
+				switch(select("Dismiss:Cancel")) {
+				case 1:
+					mes "[ Hired Kafra Employee ]";
+					mes "Why?! What have I done";
+					mes "to deserve this? Waaah~!";
+					next;
+					cutin "kafra_01",255;
+					break;
+				case 2:
+					mes "[ Hired Kafra Employee ]";
+					mes "Thank you, Master!";
+					mes "I'll obey your every";
+					mes "command as best I can!";
+					mes "You won't regret this!";
+					close;
+				}
+				break;
+			case 2:
+				mes "[ Steward ]";
+				mes "She works very hard,";
+				mes "in my opinion. It was in";
+				mes "all of our best interests to";
+				mes "allow her to stay with us.";
+				close;
+			}
+			disablenpc "Kafra Employee#sch05";
+			SetCastleData "schg_cas05",9,0;
+			mes "[ Steward ]";
+			mes "That Kafra Employee";
+			mes "has been dismissed.";
+			mes "Were really dissatisfied";
+			mes "by the quality of her service?";
+			close;
+		}
+		else {
+			mes "[ Steward ]";
+			mes "Will you hire a";
+			mes "Kafra Employee to serve";
+			mes "our stronghold? You must";
+			mes "pay ^FF000010,000 zeny^000000 to hire one.";
+			next;
+			switch(select("Hire:Cancel")) {
+			case 1:
+				if (getgdskilllv(.@GID,10001) == 0) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "you have not yet attained";
+					mes "the ^FF0000Contract with Kafra^000000";
+					mes "guild skill.";
+					close;
+				}
+				if (Zeny < 10000) {
+					mes "[ Steward ]";
+					mes "Master, we cannot hire a";
+					mes "Kafra Employee because";
+					mes "we do not have enough";
+					mes "funds to pay the contract fee.";
+					close;
+				}
+				set zeny,zeny-10000;
+				enablenpc "Kafra Employee#sch05";
+				SetCastleData "schg_cas05",9,1;
+				mes "[ Steward ]";
+				mes "Very well. We have formed";
+				mes "a contract with the Kafra";
+				mes "Head Office, and hired a";
+				mes "Kafra Employee for our";
+				mes "stronghold. Here she is~";
+				next;
+				cutin "kafra_01",2;
+				mes "[ Hired Kafra Employee ]";
+				mes "How do you do? I've";
+				mes "been dispatched by the";
+				mes "Kafra Head Office to";
+				mes "serve your guild's needs.";
+				mes "I'll do my best to follow";
+				mes "your every command, Master.";
+				next;
+				cutin "kafra_01",255;
+				mes "[ Steward ]";
+				mes "Our contract will expire";
+				mes "after one month, so we must";
+				mes "pay additional fees to keep";
+				mes "this Kafra Employee in";
+				mes "the service of our guild.";
+				close;
+			case 2:
+				mes "[ Steward ]";
+				mes "As you command, Master.";
+				mes "However, I suggest hiring";
+				mes "a Kafra Employee as soon";
+				mes "as possible since our guild";
+				mes "would greatly benefit from";
+				mes "the convenient Kafra services.";
+				close;
+			}
+		}
+	case 5:
+		mes "[ Steward ]";
+		mes "Do you wish to enter the";
+		mes "Guild Treasure Room?";
+		mes "Only you, the Guild Master,";
+		mes "are permitted to enter.";
+		next;
+		mes "[ Steward ]";
+		mes "Please remember to open";
+		mes "the Treasure Boxes at the";
+		mes "proper time. Otherwise, the";
+		mes "treasure may disappear if";
+		mes "something unexpected happens.";
+		next;
+		switch(select("Go to Treasure Room:Cancel")) {
+		case 1:
+			mes "[ Steward ]";
+			mes "Allow me to guide you";
+			mes "on the secret path to";
+			mes "the Treasure Room.";
+			mes "Press the secret switch";
+			mes "when you wish to return here.";
+			close2;
+			warp "schg_cas05",381,381;
+			end;
+		case 2:
+			mes "[ Steward ]";
+			mes "Items in the Treasure Room";
+			mes "are produced once each day.";
+			mes "Therefore, you must obtain";
+			mes "the treasure items everyday.";
+			mes "For the sake of the guild,";
+			mes "prioritize treasure harvesting!";
+			close;
+		}
+	}
+
+Onstop:
+	stopnpctimer;
+	end;
+
+OnStartArena:
+	set .@GID,getcharid(2);
+	// Lower castle Economy
+	set .@Economy,GetCastleData("schg_cas05",2) - 5;
+	if (.@Economy < 0) set .@Economy, 0;
+	SetCastleData "schg_cas05", 2, .@Economy;
+	// Lower Castle Defence
+	set .@Defence,GetCastleData("schg_cas05",3) - 5;
+	if (.@Defence < 0) set .@Defence, 0;
+	SetCastleData "schg_cas05", 3, .@Defence;
+	// Set new owner
+	SetCastleData "schg_cas05",1, .@GID;
+	// Clear castle's data.
+	for( set .@i, 4; .@i <= 9; set .@i, .@i+1 )
+		SetCastleData "schg_cas05", .@i, 0;
+	// Disable Kafra
+	disablenpc "Kafra Employee#sch05";
+
+	set .msg,2;
+	if (.msg == 1) {
+		announce "Fortress [" + GetCastleName("schg_cas05") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch05_02::Onstart";
+	}
+	else if (.msg == 2) {
+		announce "The [" + getguildname(.@gid) + "] conquered the [Nithafjoll 5] stronghold of "+GetCastleName("schg_cas05"),bc_all;
+		mapannounce "schg_cas05","The emperium has been shattered!",bc_map,"0x00FF00";
+		if (agitcheck()) {
+			donpcevent "Manager#sch05_02::Onreset";
+			initnpctimer;
+		}
+		else {
+			donpcevent "Manager#sch05_02::Onreset";
+			stopnpctimer;
+		}
+	}
+	else if (.msg == 0) {
+		announce "Fortress [" + GetCastleName("schg_cas05") + "]'s 'Nithafjoll' was captured by [" + getguildname(.@gid) + "] Guild.",bc_all;
+		donpcevent "Manager#sch05_02::Onreset";
+		stopnpctimer;
+		end;
+	}
+	MapRespawnGuildID "schg_cas05",GetCastleData("schg_cas05",1),2;
+	GetCastleData "schg_cas05",0,"::OnRecvCastlesc05";
+	end;
+
+OnTimer10000:
+	donpcevent "Manager#sch05_02::Onchange";
+	mapannounce "schg_cas05","Rebuild this stonghold's Guardian Stones and Fortress Gates to secure your guild's new aquisition!",bc_map,"0x00FF00";
+	end;
+}
+
+// Guild Kafra
+schg_cas05,300,287,5	script	Kafra Employee#sch05	117,{
+	cutin "kafra_01",2;
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (getcharid(2) == .@GID && getgdskilllv(.@GID,10001)) {
+		mes "[Kafra Employee]";
+		mes "Welcome, proud member";
+		mes "of the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild!";
+		mes "The Kafra Corporation is ready";
+		mes "to assist you wherever you go!";
+		next;
+		switch(select("Use Storage:Use Warp Service:Rent Pushcart:Cancel")) {
+		case 1:
+			if (basicskillcheck() && getskilllv(1) < 6) {
+				mes "[Kafra Employee]";
+				mes "I'm so sorry, but you must";
+				mes "have at least Novice Skill";
+				mes "Lv.6 to use the Storage.";
+			}
+			else {
+				openstorage;
+			}
+			break;
+		case 2:
+			mes "[Kafra Employee]";
+			mes "Please tell me your";
+			mes "Warp destination.";
+			next;
+			switch(select("Juno -> 200 z:Cancel")) {
+			case 1:
+				if (Zeny < 200) {
+					mes "[Kafra Employee]";
+					mes "I'm sorry, but you don't";
+					mes "have enough zeny to pay";
+					mes "the warp fee. Would you";
+					mes "please check your funds again?";
+					close2;
+					cutin "kafra_01",255;
+					end;
+				}
+				set zeny,zeny-200;
+				warp "yuno",158,125;
+				end;
+			case 2:
+				cutin "kafra_01",255;
+			}
+			break;
+		case 3:
+			if (BaseClass != Job_Merchant) {
+				mes "[Kafra Employee]";
+				mes "I'm sorry, but the Pushcart";
+				mes "rental service can only be";
+				mes "used by Merchant, Blacksmith,";
+				mes "and Alchemist class characters.";
+			}
+			else if (checkcart() == 1) {
+				mes "[Kafra Employee]";
+				mes "Hm? You've already";
+				mes "rented a Pushcart.";
+			}
+			else {
+				mes "[Kafra Employee]";
+				mes "The Pushcart rental fee";
+				mes "is 800 zeny. Would you";
+				mes "like to rent a Pushcart?";
+				next;
+				switch(select("Rent Pushcart:Cancel")) {
+				case 1:
+					if (Zeny < 800) {
+						mes "[Kafra Employee]";
+						mes "I'm sorry, but you don't";
+						mes "have enough zeny to rent";
+						mes "one of our Pushcarts.";
+						close2;
+						cutin "kafra_01",255;
+						end;
+					}
+					set zeny,zeny-800;
+					setcart;
+					break;
+				case 2:
+					break;
+				}
+			}
+			break;
+		case 4:
+			mes "[Kafra Employee]";
+			mes "Thank you for using the";
+			mes "Kafra Service. Wherever";
+			mes "you go, Kafra will be";
+			mes "there to support you!";
+			close2;
+			cutin "kafra_01",255;
+			end;
+		}
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+	else {
+		mes "[Kafra Employee]";
+		mes "I'm sorry, but I've been";
+		mes "exclusively contracted";
+		mes "to the members of the";
+		mes "^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		mes "You'll have to ask another";
+		mes "Kafra Employee to help you...";
+		close2;
+		cutin "kafra_01",255;
+		end;
+	}
+
+OnRecvCastlesc05:
+	if (GetCastleData("schg_cas05",1) == 0) {
+		monster "schg_cas05",0,0,"Evil Druid",1117,10;
+		monster "schg_cas05",0,0,"Khalitzburg",1132,4;
+		monster "schg_cas05",0,0,"Abysmal Knight",1219,3;
+		monster "schg_cas05",0,0,"Executioner",1205,1;
+		monster "schg_cas05",0,0,"Penomena",1216,10;
+		monster "schg_cas05",0,0,"Alarm",1193,18;
+		monster "schg_cas05",0,0,"Clock",1269,9;
+		monster "schg_cas05",0,0,"Raydric Archer",1276,12;
+		monster "schg_cas05",0,0,"Wanderer",1208,3;
+		monster "schg_cas05",0,0,"Alice",1275,1;
+		monster "schg_cas05",0,0,"Bloody Knight",1268,2;
+		monster "schg_cas05",0,0,"Dark Lord",1272,2;
+		monster "schg_cas05",0,0,"Tower Keeper",1270,4;
+		disablenpc "Kafra Employee#sch05";
+	}
+	end;
+}
+
+schg_cas05,391,391,0	script	 #sch05_switch	111,{
+	mes " ";
+	mes "^3355FFWill you pull";
+	mes "this small lever?^000000";
+	next;
+	switch(select("Pull Lever:Cancel")) {
+	case 1:
+		warp "schg_cas05",275,244;
+		end;
+	case 2:
+		close;
+	}
+}
+
+sch_gld,101,284,4	script	Skidbladnir#flag_sc05_1::sc05_Flag	722,{
+	set .@GID, GetCastleData("schg_cas05",1);
+	if (.@GID == 0) {
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt declares that";
+		mes "one has yet to claim lordship";
+		mes "over this stronghold. The one";
+		mes "that breaks the Emperium will";
+		mes "be recognized as its new owner.";
+		close;
+	}
+	else {
+		if (getcharid(2) == .@GID) {
+			mes "[ Ringing Voice ]";
+			mes "Courageous one,";
+			mes "do you wish to return";
+			mes "to your stronghold?";
+			next;
+			switch(select("Return to the Stronghold:Cancel")) {
+			case 1:
+				set .@GID, GetCastleData("schg_cas05",1);
+				if (getcharid(2) == .@GID) {
+					warp "schg_cas05",120,290;
+					end;
+				}
+				close;
+			case 2:
+				close;
+			}
+		}
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "The Holy Kingdom of";
+		mes "Schwaltzvalt decrees that";
+		mes "this stronghold is owned";
+		mes "by the ^FF0000" + GetGuildName(.@GID) + "^000000 Guild.";
+		next;
+		mes "[ Schwaltzvalt Royal Edict ]";
+		mes "^FF0000" + GetGuildMaster(.@GID) + "^000000 is";
+		mes "Guild Master of ^FF0000" + GetGuildName(.@GID) + "^000000.";
+		mes "Any that object must claim this";
+		mes "stronghold through strength of";
+		mes "steel and magic during the";
+		mes "appointed Guild Siege times.";
+		close;
+	}
+
+OnRecvCastlesc05:
+	FlagEmblem GetCastleData("schg_cas05",1);
+	end;
+}
+
+sch_gld,91,284,4	duplicate(sc05_Flag)	Skidbladnir#flag_sc05_2	722
+
+sch_gld,66,320,6	duplicate(sc05_Flag)	Skidbladnir#flag_sc05_3	722
+
+sch_gld,66,310,6	duplicate(sc05_Flag)	Skidbladnir#flag_sc05_4	722

+ 25 - 5
npc/scripts_guild.conf

@@ -1,7 +1,9 @@
 // --------------------------------------------------------------
 // -                         Guild Wars                         -
 // --------------------------------------------------------------
-// -- Guild Wars: General
+// --------------------------------------------------------------
+// ----------------------- War of Emperium ----------------------
+// General Functions
 npc: npc/guild/gldfunc_manager.txt
 npc: npc/guild/gldfunc_dunsw.txt
 npc: npc/guild/gldfunc_flag.txt
@@ -9,7 +11,7 @@ npc: npc/guild/gldfunc_treasure.txt
 npc: npc/guild/gldfunc_kafra.txt
 npc: npc/guild/gldfunc_ev_agit.txt
 npc: npc/guild/ev_agit_event.txt
-// -- Guild Wars: Al De Baran
+// Al De Baran
 npc: npc/guild/aldeg/aldeg_ev_agit.txt
 npc: npc/guild/aldeg/aldeg_flags.txt
 npc: npc/guild/aldeg/aldeg_managers.txt
@@ -17,7 +19,7 @@ npc: npc/guild/aldeg/aldeg_kafras.txt
 npc: npc/guild/aldeg/aldeg_treas.txt
 npc: npc/guild/aldeg/aldeg_dunsw.txt
 npc: npc/guild/aldeg/aldeg_guardians.txt
-// -- Guild Wars: Geffen
+// Geffen
 npc: npc/guild/gefg/gefg_ev_agit.txt
 npc: npc/guild/gefg/gefg_flags.txt
 npc: npc/guild/gefg/gefg_managers.txt
@@ -25,7 +27,7 @@ npc: npc/guild/gefg/gefg_kafras.txt
 npc: npc/guild/gefg/gefg_treas.txt
 npc: npc/guild/gefg/gefg_dunsw.txt
 npc: npc/guild/gefg/gefg_guardians.txt
-// -- Guild Wars: Payon
+// Payon
 npc: npc/guild/payg/payg_ev_agit.txt
 npc: npc/guild/payg/payg_flags.txt
 npc: npc/guild/payg/payg_managers.txt
@@ -33,7 +35,7 @@ npc: npc/guild/payg/payg_kafras.txt
 npc: npc/guild/payg/payg_dunsw.txt
 npc: npc/guild/payg/payg_treas.txt
 npc: npc/guild/payg/payg_guardians.txt
-// -- Guild Wars: Prontera
+// Prontera
 npc: npc/guild/prtg/prtg_ev_agit.txt
 npc: npc/guild/prtg/prtg_flags.txt
 npc: npc/guild/prtg/prtg_managers.txt
@@ -42,3 +44,21 @@ npc: npc/guild/prtg/prtg_dunsw.txt
 npc: npc/guild/prtg/prtg_treas.txt
 npc: npc/guild/prtg/prtg_guardians.txt
 // --------------------------------------------------------------
+// --------------- War of Emperium Second Edition ---------------
+// WoE SE scripts in their purest form, unoptomized.
+// To disable any single castle, comment it out.
+// --------------------------------------------------------------
+// Town Flags
+npc: npc/guild2/guild_flags.txt
+// Arunafeltz
+npc: npc/guild2/arug_cas01.txt
+npc: npc/guild2/arug_cas02.txt
+npc: npc/guild2/arug_cas03.txt
+npc: npc/guild2/arug_cas04.txt
+npc: npc/guild2/arug_cas05.txt
+// Schwaltzvalt
+npc: npc/guild2/schg_cas01.txt
+npc: npc/guild2/schg_cas02.txt
+npc: npc/guild2/schg_cas03.txt
+npc: npc/guild2/schg_cas04.txt
+npc: npc/guild2/schg_cas05.txt