//===== rAthena Script ======================================= 
//= Orc's Memory
//===== By: ================================================== 
//= L0ne_W0lf
//===== Current Version: ===================================== 
//= 1.7
//===== Compatible With: ===================================== 
//= rAthena SVN
//===== Description: ========================================= 
//= [Official Conversion]
//= Relive the memory of an orc.
//===== Additional Comments: ================================= 
//= 1.0 First version. [L0ne_W0lf]
//= 1.1 First round of bugfixes. (bugreport:3928) [L0ne_W0lf]
//=     Fixed some npcs calling wrong events. 
//=     Fixed Depraved Orc Spirit spawn point
//=     Fixed an NPC that was never being enabled.
//= 1.1a Second round from bugreport. (bugreport:3928) [L0ne_W0lf]
//=     Fixed first warp never enabling, issue not seen
//=     because of a local source mod.
//=     Corrected the IDs for the а Spirit and
//=     Ů q, copy/paste fail.
//=     Changed spawn point for dungeon according to spawn
//=     point on iRO.
//= 1.2 More bugfixes, mostly typos. :O (bugreport:3944) [L0ne_W0lf]
//=     Fixed some varaibles (types/values) as well.
//= 1.3 Disabled an exploit related to the orc hero spawn. [L0ne_W0lf]
//=     Corrected the variable type for party leader name.
//= 1.4 Fixed donpcevent calling non-existant npc. (bugreport:4039) [L0ne_W0lf]
//= 1.5 Fixed a checkquest condition never setting quest. [L0ne_W0lf]
//= 1.6 Added 'instance_check_party' command to the script for proper checking if
//=     the invoking party meets the requirements to join the Memorial Dungeon.
//= 1.7 Instance system rewrite. [Euphy]
//============================================================ 

// Entrance
//============================================================
gef_fild10,242,202,0	script	Ѻ۵Ƭ	406,{

	set .@party_id,getcharid(1);
	set .@p_name$,getpartyname(.@party_id);
	set .@md_name$,"Orc's Memory";

	if (!instance_check_party(.@party_id,1,30,80)) {
		mes "Only users between Levels ^ff000030 ~ 80^000000 can enter this Dungeon.";
		close;
	}

	set .@orctime,checkquest(12059,PLAYTIME);
	if (.@orctime == -1) {
		if (getcharid(0) == getpartyleader(.@party_id,2)) {
			mes "ѾȷˣҪԤԼ"+.@md_name$+"?";
			next;
			switch(select(""+.@md_name$+"Թ:Թ:ȡ")) {
			case 1:
				if (instance_create(.@md_name$) < 0) {
					mes ": "+.@p_name$;
					mes "ӳ: "+strcharinfo(0);
					mes "^0000ff"+.@md_name$+" ^000000 - ԤԼʧ";
					close;
				}
				mes "^0000ff"+.@md_name$+"^000000- ׼ԤԼˣ";
				mes "ԤԼ֮ٴNPCԻѡ'Թ'ɽ";
				close;
			case 2:
				callsub L_Enter,0;
			case 3:
				close;
			}
		}
		if(select(.@md_name$ + " Enter the Memorial Dungeon:Cancel") == 2)
			end;
		callsub L_Enter,1;
	} else if (.@orctime == 0 || .@orctime == 1) {
		mes "You can enter the Dungeon if it has been generated.";
		next;
		if(select("Enter the Dungeon "+.@md_name$+":Cancel") == 2)
			close;
		callsub L_Enter,0;
	} else if (.@orctime == 2) {
		mes "^0000ffAll records and after-effects related to the Orc's Memory Dungeon are deleted. You can now regenerate or re-enter the dungeon.^000000";
		erasequest 12059;
		close;
	}
	mes "1ϵĶٴս";
	close;
L_Enter:
	switch(instance_enter("Orc's Memory")) {
	case 3:
		mes "δ֪Ĵ";
		close;
	case 2:
		mes "Թ Orc's Memory ڣ";
		mes "ʱƵԵʣԹѱɾСʱٴγԡ";
		close;
	case 1:
		mes "Թ Orc's Memory ڣ";
		mes "ӳĿǰδɼԹ";
		close;
	case 0:
		mapannounce "gef_fild10",.@p_name$+"  "+strcharinfo(0)+" ԱҪ Orc's Memory ",bc_map,"0x00ff99";
		if (checkquest(12059) == -1) setquest 12059;
		//warp "1@orcs",179,15;
		if (getarg(0) == 0) close;
		else end;
	}

}

gef_fild10,238,202,6	script	Ŀѧ#orc	865,{
	if (BaseLevel < 50) {
		mes "Ŀѧƺû㣬..";
		close;
	}
	if (mad == 0) {
		mes "[Ŀѧ]";
		mes "";
		mes "û˸ҶңѺ۵Ȼ";
		next;
		switch(select("˲Ҷ:ᴵţ")) {
		case 1:
			mes "[Ŀѧ]";
			mes "Ű! ǧȷ";
			mes "ǵ޿˸ʱѺ۵ѧߣҵоѺֵĿʯǿ!";
			next;
			break;
		case 2:
			mes "[Ŀѧ]";
			mes "ɣ...";
			close;
		}
		select("Ǻ... ѵʱ");
		mes "[Ŀѧ]";
		mes "ˣҸղʱУԵʯ?";
		mes "ɲһĪʯ";
		next;
		mes "[Ŀѧ]";
		mes "ںִѧľѷֵħ!";
		mes "Ҳ鿴?";
		next;
		select("ʵ鲻Ϲذ...");
		mes "[Ŀѧ]";
		mes "ȻǷǷ";
		mes "Ϊ˴ĿʱҪֶ!";
		mes "?! ҪԿ? Ȥ!";
		mes "죬Ǻ~";
		next;
		mes "[Ŀѧ]";
		mes "һ˾ͻ´һָʾͼװϼɣÿζ˵ظĻҶ챳ˣǺ";
		next;
		switch(select("ð! Ҫô?:Ҫع!")) {
		case 1:
			mes "[Ŀѧ]";
			mes "ܺ! ַԱߵĪʯ!";
			mes "ȥ֮úñְ! Ǻ";
			set mad,1;
			close;
		case 2:
			mes "[Ŀѧ]";
			mes "Ҫ! !...";
			close;
		}
	} else if (mad == 1) {
		mes "[Ŀѧ]";
		mes "?";
		mes "ҪʱеĻͰַĪʯ...";
		close;
	} else {
		set mad,1;
		end;
	}
}

// Orc's Memory Floor 1
//============================================================
1@orcs,180,30,0	script	#Resurrect Monsters1	844,{
	end;

OnInstanceInit:
	disablenpc instance_npcname("#Resurrect Monsters1");
	end;

OnDisable:
	stopnpctimer;
	killmonster instance_mapname("1@orcs"),instance_npcname("#Resurrect Monsters1")+"::OnMyMobDead";
	end;

OnEnable:
	enablenpc instance_npcname("#Resurrect Monsters1");
	monster instance_mapname("1@orcs"),0,0,"սʿ",1023,30,instance_npcname("#Resurrect Monsters1")+"::OnMyMobDead";
	end;

OnMyMobDead:
	set .@map$, instance_mapname("1@orcs");
	set .@mob_dead_num, 30 - mobcount(.@map$,instance_npcname("#Resurrect Monsters1")+"::OnMyMobDead");
	if (.@mob_dead_num > 0) {
		set .@mob_ran,rand(1,30);
		if (.@mob_ran > 29) {
			monster .@map$,0,0,"սʿ",1023,.@mob_dead_num,instance_npcname("#Resurrect Monsters1")+"::OnMyMobDead";
		}
		else if ((.@mob_ran > 28) && (.@mob_ran < 30)) {
			monster .@map$,0,0,"սʿ",1213,.@mob_dead_num,instance_npcname("#Resurrect Monsters1")+"::OnMyMobDead";
			if (rand(1,10) == 9) {
				mapannounce .@map$, "սʿ: We need more defenses! Get more people here!",bc_map,"0xff4444";
			}
		}
		else if ((.@mob_ran > 26) && (.@mob_ran < 29)) {
			areamonster .@map$,41,91,51,81,"սʿ",1213,.@mob_dead_num,instance_npcname("#Resurrect Monsters1")+"::OnMyMobDead";
			if (rand(1,10) == 9) {
				mapannounce .@map$, "Where are the սʿs!? Get them to stop the enemies!",bc_map,"0xff4444";
			}
		}
		else {
			areamonster .@map$,17,187,27,177,"սʿ",1213,.@mob_dead_num,instance_npcname("#Resurrect Monsters1")+"::OnMyMobDead";
			if (rand(1,5) == 3) {
				mapannounce .@map$, "Caution: The army's starting to concentrate at Zone No. 4.",bc_map,"0x77ff77";
			}
			if (rand(1,100) == 50) {
				initnpctimer;
			}
		}
	}
	end;

OnTimer10:
	mapannounce instance_mapname("1@orcs"), "ػӳĺ: Looks like this will take longer than expected. Summon the Stalactic Golems!",bc_map,"0xff4444";
	end;

OnTimer4010:
	set .@map$, instance_mapname("1@orcs");
	mapannounce .@map$, "Stalactic Golems are digging out of the deep underground.",bc_map,"0x77ff77";
	areamonster .@map$,17,187,27,177,"Stalactic Golem",1278,20,instance_npcname("#Resurrect Monsters1")+"::OnMyMobDead";
	stopnpctimer;
	end;
}

1@orcs,180,30,0	script	#Resurrect Monsters2	844,{
	end;

OnInstanceInit:
	disablenpc instance_npcname("#Resurrect Monsters2");
	end;

OnDisable:
	killmonster instance_mapname("1@orcs"),instance_npcname("#Resurrect Monsters2")+"::OnMyMobDead";
	end;

OnEnable:
	enablenpc instance_npcname("#Resurrect Monsters2");
	monster instance_mapname("1@orcs"),0,0,"Trained Wolf",1106,15,instance_npcname("#Resurrect Monsters2")+"::OnMyMobDead";
	end;

OnMyMobDead:
	set .@map$, instance_mapname("1@orcs");
	set .@mob_dead_num, 15 - mobcount(.@map$,instance_npcname("#Resurrect Monsters2")+"::OnMyMobDead");
	if (rand(1,30) > 15) {
		if (.@mob_dead_num > 0) {
			monster .@map$,0,0,"Trained Wolf",1106,.@mob_dead_num,instance_npcname("#Resurrect Monsters2")+"::OnMyMobDead";
		}
	}
	else {
		if (.@mob_dead_num > 0) {
			areamonster .@map$,17,187,27,177,"Trained Wolf",1106,.@mob_dead_num,instance_npcname("#Resurrect Monsters2")+"::OnMyMobDead";
		}
	}
	end;
}

1@orcs,180,30,0	script	#Resurrect Monsters3	844,{
	end;

OnInstanceInit:
	disablenpc instance_npcname("#Resurrect Monsters3");
	end;

OnDisable:
	killmonster instance_mapname("1@orcs"),instance_npcname("#Resurrect Monsters3")+"::OnMyMobDead";
	end;

OnEnable:
	enablenpc instance_npcname("#Resurrect Monsters3");
	monster instance_mapname("1@orcs"),0,0,"˹",1189,15,instance_npcname("#Resurrect Monsters3")+"::OnMyMobDead";
	end;

OnMyMobDead:
	set .@map$, instance_mapname("1@orcs");
	set .@mob_dead_num, 15 - mobcount(.@map$,instance_npcname("#Resurrect Monsters3")+"::OnMyMobDead");
	set .@mob_ran,rand(1,30);
	if (.@mob_ran > 29) {
		if (.@mob_dead_num > 0) {
			monster .@map$,0,0,"˹",1189,.@mob_dead_num,instance_npcname("#Resurrect Monsters3")+"::OnMyMobDead";
		}
	}
	else if ((.@mob_ran > 26) && (.@mob_ran < 30)) {
		if (.@mob_dead_num > 0) {
			areamonster .@map$,43,155,47,159,"˹",1189,.@mob_dead_num,instance_npcname("#Resurrect Monsters3")+"::OnMyMobDead";
			if (rand(1,3) == 3) {
				mapannounce .@map$, "սʿ: Attack them from behind! Cut off their support!",bc_map,"0xff4444";
			}
		}
	}
	else {
		if (.@mob_dead_num > 0) {
			areamonster .@map$,17,187,27,177,"˹",1189,.@mob_dead_num,instance_npcname("#Resurrect Monsters3")+"::OnMyMobDead";
		}
	}
	end;
}

1@orcs,180,30,0	script	#Resurrect Monsters4	844,{
	end;

OnInstanceInit:
	enablenpc instance_npcname("#Resurrect Monsters4");
	areamonster instance_mapname("1@orcs"),98,35,178,115,"ű",1627,10,instance_npcname("#Resurrect Monsters4")+"::OnMyMobDead";
	end;

OnMyMobDead:
	set .@map$, instance_mapname("1@orcs");
	set .@mob_dead_num, 10 - mobcount(.@map$,instance_npcname("#Resurrect Monsters4")+"::OnMyMobDead");
	if (.@mob_dead_num > 0) {
		monster .@map$,0,0,"ű",1627,.@mob_dead_num,instance_npcname("#Resurrect Monsters4")+"::OnMyMobDead";
	}
	end;

OnDisable:
	killmonster instance_mapname("1@orcs"),instance_npcname("#Resurrect Monsters4")+"::OnMyMobDead";
	end;
}

1@orcs,180,29,4	script	³#1-1	433,{
	donpcevent instance_npcname("³#1-2")+"::OnEnable";
	end;
}

1@orcs,180,29,4	script	³#1-2	433,{
	end;

OnInstanceInit:
	disablenpc instance_npcname("³#1-2");
	end;

OnEnable:
	disablenpc instance_npcname("³#1-1");
	enablenpc instance_npcname("³#1-2");
	initnpctimer;
	end;

OnTimer10:
	mapannounce instance_mapname("1@orcs"), "³: ǳ˳... ôô!! һһ붼",bc_map,"0xffff00";
	end;

OnTimer5710:
	mapannounce instance_mapname("1@orcs"), "³: ԭȼƻҪͬǴ򿪴ţǵʱ亦ǱŮ׷ֶúܼ",bc_map,"0xffff00";
	end;

OnTimer14610:
	mapannounce instance_mapname("1@orcs"), "ػӳĺ: оڸϿɵڸȥ!!",bc_map,"0xff4444";
	end;

OnTimer20210:
	mapannounce instance_mapname("1@orcs"), "³: ... ˿ҪˣҪϸҵָ",bc_map,"0xffff00";
	end;

OnTimer24910:
	mapannounce instance_mapname("1@orcs"), "³: ռŮװ1¥ֳ4ħӡˣԼÿפһԽӡػ",bc_map,"0xffff00";
	end;

OnTimer34310:
	mapannounce instance_mapname("1@orcs"), "³: ȥҳôħͻԽһ",bc_map,"0xffff00";
	end;

OnTimer39710:
	mapannounce instance_mapname("1@orcs"), "³: Ҫעǳ˷ӡ˵⾡𾪶ˣͻԱӿ뵽ͨ2¥ȥ",bc_map,"0xffff00";
	end;

OnTimer49210:
	mapannounce instance_mapname("1@orcs"), "³: 2¥пܱ龡ӲӲػǰ",bc_map,"0xffff00";
	end;

OnTimer56310:
	mapannounce instance_mapname("1@orcs"), ": ĵؿ'ħӡ'!ĳͻ˳ִ2¥",bc_map,"0x44ffff";
	donpcevent instance_npcname("#Resurrect Monsters1")+"::OnEnable";
	donpcevent instance_npcname("#Resurrect Monsters2")+"::OnEnable";
	donpcevent instance_npcname("#Resurrect Monsters3")+"::OnEnable";
	disablenpc instance_npcname("³#1-2");
	end;

OnTimer60000:
	areamonster instance_mapname("1@orcs"),137,83,143,89,"ħӡ",1023,1,instance_npcname("B1 Area Mobs")+"::OnMyMobDead";
	stopnpctimer;
	end;

}

1@orcs,168,125,0	script	B1 Area 1	45,3,3,{
OnInstanceInit:
	disablenpc instance_npcname("B1 Area 1");
	end;

OnEnable:
	enablenpc instance_npcname("B1 Area 1");
	areamonster instance_mapname("1@orcs"),103,105,109,111,"ħӡ",1023,1,instance_npcname("B1 Area Mobs")+"::OnMyMobDead1";
	end;

OnTouch:
	warp instance_mapname("1@orcs"),168,130;
	end;

OnContinue:
	donpcevent instance_npcname("B1 Area 2")+"::OnEnable";
	initnpctimer;
	end;

OnTimer10300:
	mapannounce instance_mapname("1@orcs"), "³Ļ: The Orcs here used to be my companions. They just lost their will ever since the Orc Shaman started to control them with her magic.",bc_map,"0xff4499";
	end;

OnTimer18700:
	mapannounce instance_mapname("1@orcs"), "³Ļ: There's nothing we can do but to defeat the Orc Shaman if we want to save the remaining tribes.",bc_map,"0xff4499";
	stopnpctimer;
	end;
}

1@orcs,89,94,0	script	B1 Area 2	45,3,3,{
OnInstanceInit:
	disablenpc instance_npcname("B1 Area 2");
	end;

OnEnable:
	enablenpc instance_npcname("B1 Area 2");
	areamonster instance_mapname("1@orcs"),32,40,38,46,"ħӡ",1023,1,instance_npcname("B1 Area Mobs")+"::OnMyMobDead2";
	end;

OnTouch:
	warp instance_mapname("1@orcs"),85,85;
	end;

OnContinue:
	donpcevent instance_npcname("B1 Area 3")+"::OnEnable";
	initnpctimer;
	end;

OnTimer30300:
	mapannounce instance_mapname("1@orcs"), "³Ļ: I saw the bodies of our tribe. It seems that the Orc Shaman used those Orcs for her rituals.",bc_map,"0xff4499";
	end;

OnTimer37600:
	mapannounce instance_mapname("1@orcs"), "³Ļ: ... It all has to do with me. I am responsible for this evil.",bc_map,"0xff4499";
	stopnpctimer;
	end;
}

1@orcs,38,105,0	script	B1 Area 3	45,3,3,{
OnInstanceInit:
	disablenpc instance_npcname("B1 Area 3");
	end;

OnEnable:
	enablenpc instance_npcname("B1 Area 3");
	areamonster instance_mapname("1@orcs"),19,177,25,183,"ħӡ",1023,1,instance_npcname("B1 Area Mobs")+"::OnMyMobDead3";
	end;

OnTouch:
	warp instance_mapname("1@orcs"),38,110;
	end;

OnContinue:
	donpcevent instance_npcname("B1 Area 4")+"::OnEnable";
	initnpctimer;
	end;

OnTimer30300:
	mapannounce instance_mapname("1@orcs"), "Please, hang in there!",bc_map,"0xff4499";
	end;

OnTimer32700:
	mapannounce instance_mapname("1@orcs"), "We'll get some rest when we get to the 2nd basement after passing through here.",bc_map,"0xff4499";
	stopnpctimer;
	end;
}

1@orcs,21,189,0	script	B1 Area 4	45,3,3,{
OnInstanceInit:
	disablenpc instance_npcname("B1 Area 4");
	end;

OnEnable:
	enablenpc instance_npcname("B1 Area 4");
	donpcevent instance_npcname("#Resurrect Monsters1")+"::OnDisable";
	donpcevent instance_npcname("#Resurrect Monsters2")+"::OnDisable";
	donpcevent instance_npcname("#Resurrect Monsters3")+"::OnDisable";
	donpcevent instance_npcname("#Resurrect Monsters4")+"::OnDisable";
	end;

OnTouch:
	warp instance_mapname("2@orcs"),32,171;
	end;
}

1@orcs,1,1,0	script	B1 Area Mobs	-1,{
	end;

OnMyMobDead:
	donpcevent instance_npcname("B1 Area 1")+"::OnEnable";
	end;

OnMyMobDead1:
	donpcevent instance_npcname("B1 Area 1")+"::OnContinue";
	end;

OnMyMobDead2:
	donpcevent instance_npcname("B1 Area 2")+"::OnContinue";
	end;

OnMyMobDead3:
	donpcevent instance_npcname("B1 Area 3")+"::OnContinue";
	end;
}

// Orc's Memory Floor 2
//============================================================
2@orcs,36,171,0	script	#2Resurrect Monsters1	844,{
	end;

OnInstanceInit:
	disablenpc instance_npcname("#2Resurrect Monsters1");
	end;

OnEnable:
	enablenpc instance_npcname("#2Resurrect Monsters1");
	monster instance_mapname("2@orcs"),0,0,"а",1152,30,instance_npcname("#2Resurrect Monsters1")+"::OnMyMobDead";
	end;

OnDisable:
	stopnpctimer;
	killmonster instance_mapname("2@orcs"),instance_npcname("#2Resurrect Monsters1")+"::OnMyMobDead";
	end;

OnMyMobDead:
	set .@map$, instance_mapname("2@orcs");
	set .@mob_dead_num, 30 - mobcount(.@map$,instance_npcname("#2Resurrect Monsters1")+"::OnMyMobDead");
	if (.@mob_dead_num > 0) {
		set .@mob_ran,rand(1,30);
		if (.@mob_ran > 29) {
			monster .@map$,0,0,"а",1152,.@mob_dead_num,instance_npcname("#2Resurrect Monsters1")+"::OnMyMobDead";
		}
		else if ((.@mob_ran > 28) && (.@mob_ran < 30)) {
			monster .@map$,0,0,"սʿ",1213,.@mob_dead_num,instance_npcname("#2Resurrect Monsters1")+"::OnMyMobDead";
		}
		else if ((.@mob_ran > 26) && (.@mob_ran < 29)) {
			areamonster .@map$,157,112,167,122,"սʿ",1213,.@mob_dead_num,instance_npcname("#2Resurrect Monsters1")+"::OnMyMobDead";
			if (rand(1,10) == 9) {
				mapannounce .@map$, "Warning: սʿs are gathering near area 3.",bc_map,"0xff4444";
			}
		}
		else {
			areamonster .@map$,173,13,183,23,"սʿ",1213,.@mob_dead_num,instance_npcname("#2Resurrect Monsters1")+"::OnMyMobDead";
			if (rand(1,5) == 3) {
				mapannounce .@map$, ": Ů׵ļ̳ʼ",bc_map,"0x77ff77";
			}
			if (rand(1,70) == 50) {
				initnpctimer;
			}
		}
	}
	end;

OnTimer10:
	mapannounce instance_mapname("2@orcs"), "Voice from somewhere: Foolish... Do you really think the altar would fall like that?",bc_map,"0xff4444";
	end;

OnTimer4010:
	set .@map$, instance_mapname("2@orcs");
	mapannounce .@map$, "[ Wraiths were summoned by an unknown power ]",bc_map,"0x77ff77";
	areamonster .@map$,167,25,177,35,"Wraith",1475,30,instance_npcname("#2Resurrect Monsters1")+"::OnMyMobDead";
	stopnpctimer;
	end;
}

2@orcs,36,171,0	script	#2Resurrect Monsters3	844,{
	end;

OnInstanceInit:
	disablenpc instance_npcname("#2Resurrect Monsters3");
	end;

OnEnable:
	enablenpc instance_npcname("#2Resurrect Monsters3");
	monster instance_mapname("2@orcs"),0,0,"˸ʬ",1153,15,instance_npcname("#2Resurrect Monsters3")+"::OnMyMobDead";
	end;

OnMyMobDead:
	set .@map$, instance_mapname("2@orcs");
	set .@mob_dead_num, 15 - mobcount(.@map$,instance_npcname("#2Resurrect Monsters3")+"::OnMyMobDead");
	set .@mob_ran,rand(1,30);
	if (.@mob_ran > 29) {
		if (.@mob_dead_num > 0) {
			monster .@map$,0,0,"˹",1189,.@mob_dead_num,instance_npcname("#2Resurrect Monsters3")+"::OnMyMobDead";
		}
	}
	else if ((.@mob_ran > 6) && (.@mob_ran < 30)) {
		if (.@mob_dead_num > 0) {
			areamonster .@map$,168,10,184,26,"˹",1189,.@mob_dead_num,instance_npcname("#2Resurrect Monsters3")+"::OnMyMobDead";
			if (rand(1,15) == 3) {
				mapannounce .@map$, "Warning: ˹ teams are gathering near the altar.",bc_map,"0xff4444";
			}
		}
	}
	else {
		if (.@mob_dead_num > 0) {
			areamonster .@map$,168,21,184,21,"˹",1189,.@mob_dead_num,instance_npcname("#2Resurrect Monsters3")+"::OnMyMobDead";
		}
	}
	end;

OnDisable:
	killmonster instance_mapname("2@orcs"),instance_npcname("#2Resurrect Monsters3")+"::OnMyMobDead";
	end;
}

2@orcs,180,30,0	script	#2Resurrect Monsters4	844,{
	end;

OnInstanceInit:
	enablenpc instance_npcname("#2Resurrect Monsters4");
	monster instance_mapname("2@orcs"),0,0,"ű",1627,10,instance_npcname("#2Resurrect Monsters4")+"::OnMyMobDead";
	end;

OnMyMobDead:
	set .@map$, instance_mapname("2@orcs");
	set .@mob_dead_num, 10 - mobcount(.@map$,instance_npcname("#2Resurrect Monsters4")+"::OnMyMobDead");
	if (.@mob_dead_num > 0) {
		monster .@map$,0,0,"ű",1627,1,instance_npcname("#2Resurrect Monsters4")+"::OnMyMobDead";
	}
	end;
}

2@orcs,35,169,4	script	³#2-1	433,{
	donpcevent instance_npcname("³#2-2")+"::OnEnable";
	end;
}

2@orcs,35,169,4	script	³#2-2	433,{
	end;

OnInstanceInit:
	disablenpc instance_npcname("³#2-2");
	end;

OnEnable:
	disablenpc instance_npcname("³#2-1");
	enablenpc instance_npcname("³#2-2");
	initnpctimer;
	end;

OnTimer10:
	mapannounce instance_mapname("2@orcs"), "³Ļ: ôʱǰŮ׼̳ķ",bc_map,"0xffff00";
	end;

OnTimer3510:
	mapannounce instance_mapname("2@orcs"), "³Ļ: Do you see the braziers that light the path? Unseal the next zone by strengthening their flames.",bc_map,"0xffff00";
	end;

OnTimer10710:
	mapannounce instance_mapname("2@orcs"), "³Ļ: Of course those monsters won't let you touch the braziers that easily.",bc_map,"0xffff00";
	end;

OnTimer16310:
	mapannounce instance_mapname("2@orcs"), "³Ļ: But still, try keep the battles not too noticable so the Shaman won't guard the altar with her army squad.",bc_map,"0xffff00";
	end;

OnTimer21910:
	mapannounce instance_mapname("2@orcs"), "³Ļ: Only the Party Leader can strengthen the flames, so protect your leader.",bc_map,"0xffff00";
	end;

OnTimer23910:
	mapannounce instance_mapname("2@orcs"), ": ͻڻ¯ϵӡ밴ռȶ˳Ч",bc_map,"0x4444ff";
	donpcevent instance_npcname("#2Resurrect Monsters1")+"::OnEnable";
	donpcevent instance_npcname("#2Resurrect Monsters3")+"::OnEnable";
	donpcevent instance_npcname("¯#1-1")+"::OnEnable";
	disablenpc instance_npcname("³#2-2");
	end;
}

2@orcs,26,164,0	script	¯#1-1	844,{
	if(getpartyleader(getcharid(1),2) != getcharid(0)) end;
	progressbar "ffff00",5;
	setarray .@id[0], atoi(charat(strnpcinfo(2),0)), atoi(charat(strnpcinfo(2),2));
	if (.@id[1] == 4)
		donpcevent instance_npcname("#Warp2-"+.@id[0])+"::OnEnable";
	else
		donpcevent instance_npcname("¯#"+.@id[0]+"-"+(.@id[1]+1))+"::OnEnable";
	initnpctimer;
	disablenpc instance_npcname(strnpcinfo(0));
	end;

OnInstanceInit:
	if (strnpcinfo(0) != "¯#2-1" && strnpcinfo(0) != "¯#3-1")
		disablenpc instance_npcname(strnpcinfo(0));
	end;

OnEnable:
	enablenpc instance_npcname(strnpcinfo(0));
	end;

OnTimer100:
	specialeffect EF_FIREPILLAR;
	end;

OnTimer2000:
	specialeffect EF_FIREPILLARBOMB;
	stopnpctimer;
	end;
}
2@orcs,55,155,0	duplicate(¯#1-1)	¯#1-2	844
2@orcs,108,146,0	duplicate(¯#1-1)	¯#1-3	844
2@orcs,98,171,0	duplicate(¯#1-1)	¯#1-4	844

2@orcs,48,100,0	script	#Warp2-1	45,3,3,{
OnInstanceInit:
	disablenpc instance_npcname("#Warp2-1");
	end;

OnEnable:
	set .@map$, instance_mapname("2@orcs");
	monster .@map$,109,156,"ػӳ",1981,1,instance_npcname("#Mobs Control")+"::OnMyMobDead1";
	mapannounce .@map$, "ػӳ: ˴ˣ־͸ҵ!!",bc_map,"0xff8888";
	end;

OnContinue:
	enablenpc instance_npcname("#Warp2-1");
	initnpctimer;
	end;

OnTimer10000:
	areamonster instance_mapname("2@orcs"),28,158,40,170,"ػӳ",1981,1,instance_npcname("#Mobs Control")+"::OnMyMobDead1";
	stopnpctimer;
	end;

OnTouch:
	warp instance_mapname("2@orcs"),47,93;
	end;
}

2@orcs,35,92,0	duplicate(¯#1-1)	¯#2-1	844
2@orcs,32,70,0	duplicate(¯#1-1)	¯#2-2	844
2@orcs,70,31,0	duplicate(¯#1-1)	¯#2-3	844
2@orcs,84,51,0	duplicate(¯#1-1)	¯#2-4	844

2@orcs,101,55,0	script	#Warp2-2	45,3,3,{
OnInstanceInit:
	disablenpc instance_npcname("#Warp2-2");
	end;

OnEnable:
	set .@map$, instance_mapname("2@orcs");
	monster .@map$,67,64,"˹",1982,1,instance_npcname("#Mobs Control")+"::OnMyMobDead2";
	mapannounce .@map$, "˹: Hah! Pretty impressive that you made it this far, but your foolish little trip ends here...",bc_map,"0xff8888";
	end;

OnContinue:
	enablenpc instance_npcname("#Warp2-2");
	initnpctimer;
	end;

OnTimer10000:
	areamonster instance_mapname("2@orcs"),40,91,52,103,"˹",1982,1,instance_npcname("#Mobs Control")+"::OnMyMobDead2";
	stopnpctimer;
	end;

OnTouch:
	warp instance_mapname("2@orcs"),107,55;
	end;
}

2@orcs,142,145,0	duplicate(¯#1-1)	¯#3-1	844
2@orcs,162,134,0	duplicate(¯#1-1)	¯#3-2	844
2@orcs,144,117,0	duplicate(¯#1-1)	¯#3-3	844
2@orcs,136,98,0	duplicate(¯#1-1)	¯#3-4	844

2@orcs,167,104,0	script	#Warp2-3	45,3,3,{
OnInstanceInit:
	disablenpc instance_npcname("#Warp2-3");
	end;

OnEnable:
	set .@map$, instance_mapname("2@orcs");
	monster .@map$,152,147,"Depraved Orc Spirit",1983,1,instance_npcname("#Mobs Control")+"::OnMyMobDead3";
	mapannounce .@map$, "Depraved Orc Spirit: I smell flesh! Hungry! Wanna try some human meat!!",bc_map,"0xff8888";
	end;

OnContinue:
	areamonster instance_mapname("2@orcs"),117,61,129,73,"Depraved Orc Spirit",1983,1;
	donpcevent instance_npcname("#Boss Control")+"::OnEnable";
	enablenpc instance_npcname("#Warp2-3");
	initnpctimer;
	end;

OnTimer10:
	mapannounce instance_mapname("2@orcs"), "Ů q: Hahaha!! So, you finally made it here. The assassin you sent was just terrible. That stupid Orc is getting cold under my feet.",bc_map,"0xffff00";
	end;

OnTimer6810:
	mapannounce instance_mapname("2@orcs"), "Ů q: My loyal slave, go get those intruders!",bc_map,"0xffff00";
	end;

OnTimer10310:
	mapannounce instance_mapname("2@orcs"), "Ӣ: Whatever you say, my lord.",bc_map,"0xff7777";
	end;

OnTimer13110:
	mapannounce instance_mapname("2@orcs"), ": Ů׿qˣǰ³İɱʧܣȥqӪȿ³",bc_map,"0x8888ff";
	stopnpctimer;
	end;

OnTouch:
	warp instance_mapname("2@orcs"),167,95;
	end;
}

2@orcs,36,171,0	script	#Boss Control	844,{
	end;

OnInstanceInit:
	disablenpc instance_npcname("#Boss Control");
	end;

OnEnable:
	set .@map$, instance_mapname("2@orcs");
	monster .@map$,185,8,"Ů q",1984,1,instance_npcname("#Boss Control")+"::OnMyMobDead";
	monster .@map$,179,15,"Ӣ",1087,1;
	enablenpc instance_npcname("#Boss Control");
	end;

OnMyMobDead:
	donpcevent instance_npcname("³#")+"::OnEnable";
	set .@map$, instance_mapname("2@orcs");
	set .@mob_ran,rand(1,5);
	if (.@mob_ran == 1) {
		mapannounce .@map$, "Ů q: How... How could this be... How could someone like you...!!",bc_map,"0xffff00";
	}
	else if (.@mob_ran == 2) {
		mapannounce .@map$, "Ů q: How is it that I've been overpowered by mere humans!",bc_map,"0xffff00";
	}
	else if (.@mob_ran == 3) {
		mapannounce .@map$, "Ů q: ... δ.. ... ...",bc_map,"0xffff00";
	}
	else if (.@mob_ran == 4) {
		mapannounce .@map$, "Ů q: I... Can't die... Yet...!",bc_map,"0xffff00";
	}
	else {
		mapannounce .@map$, "Ů q: Defeated by these fools... It can't be happening...!",bc_map,"0xffff00";
	}
	donpcevent instance_npcname("#2Resurrect Monsters1")+"::OnDisable";
	donpcevent instance_npcname("#2Resurrect Monsters3")+"::OnDisable";
	donpcevent instance_npcname("#Warp Outside Orc Dun")+"::OnEnable";
	end;
}

2@orcs,182,8,0	script	#Warp Outside Orc Dun	45,3,3,{
OnInstanceInit:
	disablenpc instance_npcname("#Warp Outside Orc Dun");
	end;

OnEnable:
	enablenpc instance_npcname("#Warp Outside Orc Dun");
	end;

OnTouch:
	warp "gef_fild10",240,197;
	end;
}

2@orcs,172,13,0	script	³#	434,{
	if (yong_odun < 2) {
		mes "[³]";
		mes "*Coughing*";
		mes ""+strcharinfo(0)+", it's you...";
		next;
		mes "["+strcharinfo(0)+"] ";
		mes "Don't move! You are wounded!";
		next;
		mes "[³]";
		mes "It's... all right.. I'm dying...";
		mes "....";
		mes "The Shaman? What about the Shaman?";
		next;
		mes "["+strcharinfo(0)+"] ";
		mes "The Shaman's dead now. Who was that Shaman really?";
		next;
		mes "³ seemed to be relieved as he hears of the death of the Shaman, but you notice the bitter expression on his face.";
		next;
		mes "[³]";
		mes "I.. I just couldn't kill my own daughter...";
		mes "Thank you, I'm sure she's finally free from the nightmare that used to choke her soul.";
		next;
		mes "³ was about to say something more, but he breathed his last breath before he could...";
		set yong_odun,2;
		close;
	}
	else {
		mes "You can see the dead body of ³, peacefully lying on the ground.";
		close;
	}

OnInstanceInit:
	disablenpc instance_npcname("³#");
	end;

OnEnable:
	enablenpc instance_npcname("³#");
	end;
}

2@orcs,36,171,0	script	#Mobs Control	844,{
	end;

OnMyMobDead1:
	donpcevent instance_npcname("#Warp2-1")+"::OnContinue";
	end;

OnMyMobDead2:
	donpcevent instance_npcname("#Warp2-2")+"::OnContinue";
	end;

OnMyMobDead3:
	donpcevent instance_npcname("#Warp2-3")+"::OnContinue";
	end;
}
