//===== rAthena Script ======================================= 
//= Kiel Hyre Quest
//===== By: ================================================== 
//= L0ne_W0lf (Script), DZeroX (Timer)
//===== Current Version: ===================================== 
//= 4.7
//===== Compatible With: ===================================== 
//= rAthena Project
//===== Description: ========================================= 
//= Quest for opening Robot Factory first and second floors.
//===== Additional Comments: ================================= 
//= 4.0 A whole bunch-a-updates to various npcs. [L0ne_W0lf]
//=     Corrected condition checks throughout the quest.
//=     Npcs no longer make use of the goto command.
//=     Uses temp npc vars now instead of temp char.
//=     Reduced the amount of variables used.
//=     Corrected some of the cutins in npcs with them.
//=     Added the missing dialogs and weight checks.
//=     Fixed many typos, and grammatical errors.
//=     NPC now names use '#<name>' instead of labels.
//=     Updated some NPC positions, and facings.
//=     Changed the way some NPCs work.
//=     Updated comments for get/delitem commands.
//= 4.1 Added an 'end;' to Kiel Hyre's dialog for the "Yes" option for if you want to confront Kiehl.
//= 4.2 Fixed some issues reported in bugreport:2129. [L0ne_W0lf]
//= 4.2a Follow up to last update. [L0ne_W0lf]
//= 4.2b Missed a condition, fixed it though. [L0ne_W0lf]
//= 4.2c More various fixes :D [L0ne_W0lf]
//= 4.3 Fixed improper condition in the Elly NPC. [L0ne_W0lf]
//=     Corrected some typos in the dialogs.
//= 4.4 Updated reviecer and robots NPC to use mobcount. (bugreport:2380) [L0ne_W0lf]
//= 4.5 Removed a delitem that was no logner needed. [L0en_W0lf]
//= 4.6 Fixed impossible condition for security guard. [L0ne_W0lf]
//= 4.7 Updated RE/Pre-RE EXP. [Euphy]
//============================================================ 

//============================================================================
// Kiel Hyre Quest/Robotic Lab Dungeon
//
// Script Dialog Obtained and Copied Down by L0ne_W0lf
// Timer work and some variable dances by DZeroX
// Based on [iRO Sakray] as of [03/29/2007]
//============================================================================
//----------------------------------------------------------------------------
// [Notes]
//  - Let it be noted that ALL DIALOG IS OFFICIAL TO IRO UNLESS SPECIFIED.
//  - I've fixed a few of iRO's mistakes, but I'm sure I made some of my own. 
//  - Will probably require a major optimizing.
//  - Not going to list ALL of the more usless NPCs. (Doors + Empty "Beautiful Ladies")
//  - Parties are *NOT REQUIRED* as per Doddler's Wiki information.
//
//----------------------------------------------------------------------------
// [Maps]                [Use]
//  yuno_in01 ........... Start quest in pub
//  kh_school ........... Deliver Wine here, Meet Elly
//  yuno ................ Get Delivery for/from "Little Kid"
//  lighthalzen ......... Get Delivery package for "Little Kid"
//  kh_vila ............. Kiel Hyre cottage.
//  kh_dun01 ............ Robot Factory; Save Kiel Hyre
//  kh_mansion .......... Kiel Hyre's Mansion in Lighthalzen
//  kh_kiehl01 .......... Kiehl's room/Cave
//  kh_kiehl02 .......... Kiehl's room/Boss Room
//
//----------------------------------------------------------------------------
// [Variables in Use]
//  KielHyreQuest 	- Main quest tracking variable (Quest finished at 106)
//
//  KHToastGirlEnd	- Pick up delivery if set to 1, 
//			- picked up delivery if set to 2
//			- finished if set to 3 
//			- Deleted once no longer needed.
//
//  KHCottagePoem1	- Tracks Poem 1 quest in cottage. (finished = 5)
//			- Deleted once no longer needed.
//
//  KHCottagePoem2	- Tracks Poem 2 quest in cottage. (finished = 3)
//			- Deleted once no longer needed.
//
//  .@KHInput$		- Used with "Security Guard"
//  			- Used with "Test Tube"
//  			- Used when "Elly" (inputing string in attempt to wake her)
//  			- Used with "Grave", (twice)
//  			- Used with "Heavy Door"
//  			- Used with "Mechanical Device"
//  			- Used for opening various doors in Kiehl's area.
//
//  .@KHFirstKeyhole	- Holds 1 (green keycard) or 2 (cottage key)
//  .@KHSecondKeyhole	- Holds 1 (green keycard) or 2 (cottage key)
//
//  .@KHPotionColor$	- Holds 'red', 'green', or 'yellow' depending on what wrong potion is selected.
//
//  .@KHSwords 		- Used with "Sword Hilt"
//
//  .@KHQRead		- Make sure player has asked questions to Kiel Hyre
//
//  .@KHTitle$		- Holds "Mr", "Mrs", or "Miss"
//
//  .@KHDoorPushAttempt	- Keeps track of how many times a person has attmepted to push the door open.
//
//  .@KHPryingItem$	- Used for incorrect options when prying open last door.
//
//  .KHKilled		- Tracks how many monsters have been killed. Used with "Receiver", "Robots", and "Kiehl" NPCs
//
//  .KHDoor1Open	- 0/1 Depending on if the first door is opened.
//  .KHDoor2Open	- 0/1 Depending on if the second door is opened.
//  .KHDoor3Open	- 0/1 Depending on if the third door is opened.
//  .KHDoor4Open	- 0/1 Depending on if the fourth door is opened.
//  .KHDoor5Open	- 0/1 Depending on if the fifth door is opened.
//
//  .KHKilledBoss	- 0/1 depending on if the boss has been killed.
//
//  $@KHQuestBusy	- 0/1 depending on if the boss room has been set in motion.
//
//----------------------------------------------------------------------------
// [NPCs]			 [Location]
//  Pub Master .................. yuno_in01	[ 35,178]
//  Hanie ....................... yuno_fild08	[196,196]
//  Security Guard .............. yuno_fild08	[158,194]
//  Security Guard .............. yuno_fild08	[158,183]
//  Student ..................... kh_school	[ 57,142]
//  Student ..................... kh_school	[ 57,139]
//  Lady ........................ kh_school	[176, 60]
//  Cute Student ................ kh_school	[179, 39]
//  Little Kid .................. yuno		[217,114]
//  Windmill Owner .............. lighthalzen	[365,300]
//  Cottage Keeper .............. yuno_fild02	[ 93,210]
//  Door ........................ yuno_fild02	[ 75,218]
//  Door ........................ yuno_fild02	[109,218]
//  Wall ........................ kh_vila	[191, 14]
//  Book ........................ kh_vila	[184, 20]
//  Book ........................ kh_vila	[181, 20]
//  Book ........................ kh_vila	[178, 20]
//  Book ........................ kh_vila	[175, 19]
//  Letter ...................... kh_vila	[179, 11]
//  Box ......................... kh_vila	[ 16,175]
//  Apple Box ................... kh_vila	[ 30,184]
//  Map ......................... kh_vila	[ 44,125]
//  Pot ......................... kh_vila	[ 33,148]
//  Calabash .................... kh_vila	[ 14, 55]
//  Pool ........................ kh_vila	[ 39, 39]
//  Vicious Dog ................. kh_vila 	[180,178]
//  Drawer ...................... kh_vila 	[115,186]
//  Box ......................... kh_vila 	[107,126]
//  Bookshelf ................... kh_vila 	[181,138]
//  Sword Hilt .................. kh_vila 	[136, 69]
//  Test Tube ................... kh_vila	[179, 69]
//  Test Tube ................... kh_vila	[185, 69]
//  Window ...................... yuno_fild08	[ 69,185]
//  Elly ........................ kh_school	[178,180]
//  Cookie Basket ............... kh_school	[175,175]
//  Window ...................... kh_school	[188,185]
//  Grave ....................... yuno_fild08	[ 72,170]
//  Heavy Door .................. kh_dun01	[236, 48]
//  Beautiful lady .............. kh_school	[119,149]
//  Beautiful lady .............. kh_school	[122,186]
//  Signboard ................... kh_dun01	[163,223]
//  Mechanical Device ........... kh_dun01	[166,223]
//  Mechanical Device ........... kh_dun01	[162,206]
//  Kiel_Hyre_Door .............. kh_dun01	[224,232]
//  Steward ..................... kh_mansion	[ 78, 55]
//  Kiel Hyre ................... kh_mansion	[ 22, 27]
//  Allysia ..................... kh_mansion	[ 22, 27]
//  Abduction_trigger ........... lighthalzen	[188,200]
//  Mysterious Woman ............ kh_mansion	[ 25, 79]
//  Odd Granma .................. yuno		[250,132]
//  Old Lady .................... yuno 		[250,132]
//  Rosimmir_Entrance ........... yuno		[273,141]
//  Table ....................... kh_rossi	[ 23, 23]
//  Shelf ....................... kh_rossi	[ 92, 40]
//  Desk ........................ kh_rossi	[144,146]
//  Bookshelf ................... kh_rossi	[144,146]
//  Bed ......................... kh_rossi	[154,286]
//  Old Fisherman ............... yuno_fild12	[232,222]
//  Wooden Board ................ yuno_fild09	[158,217]
//  Kiehl_Room_Warp ............. kh_mansion	[ 29, 27]
//  Entrance Device#KHEntry1 .... kh_dun01	[ 44, 20]
//  Entrance Device#KHEntry2 .... kh_dun01	[ 44,203]
//  Security Guard .............. yuno_fild08	[158,194]
//  Receiver .................... kh_kiehl01	[ 17, 39]
//  Flower Vase ................. kh_kiehl01	[ 13, 40]
//  Box ......................... kh_kiehl01	[ 19, 25]
//  Big Door .................... kh_kiehl01	[ 44, 33]
//  Big_Door_1_Warp ............. kh_kiehl01	[ 43, 33]
//  Big Door .................... kh_kiehl01	[174, 40]
//  Big_Door_2_Warp ............. kh_kiehl01	[174, 39]
//  Big Door .................... kh_kiehl01	[ 77,108]
//  Big_Door_3_Warp ............. kh_kiehl01	[ 68,108]
//  Big Door .................... kh_kiehl01	[ 41,177]
//  Big_Door_4_Warp ............. kh_kiehl01	[ 78,177]
//  Robots ...................... kh_kiehl01	[ 15,181]
//  Big Door .................... kh_kiehl01	[166,187]
//  Big_Door_5_Warp ............. kh_kiehl01	[166,186]
//  Kiehl_Room_Trap ............. kh_kiehl02	[ 49, 15]
//  Kiehl#Original .............. kh_kiehl02	[ 50, 52]
//  KiehlRoom ................... kh_kiehl02	[  1,  1]
//  Mitchell#KiehlRoom .......... kh_kiehl02	[ 49, 55]
//  Agent#KHAgent1 ....   ....... kh_kiehl02	[ 53, 52]
//  Agent#KHAgent2 .............. kh_kiehl02	[ 51, 49]
//  Agent#KHAgent3 .............. kh_kiehl02	[ 47, 50]
//  Agent#KHAgent4 .............. kh_kiehl02	[ 46, 53]
//  Kiehl#Copy .................. kh_kiehl02	[ 48, 53]
//  Kiehl_Roomn_Exit ............ kh_kiehl01	[ 50, 59]
//
//----------------------------------------------------------------------------
// [Functions]
//  None
//
//----------------------------------------------------------------------------
// [Conflicts]
//   Resolved
//
//============================================================================

//============================================================================
// Affiliated NPCs
//============================================================================

//----------------------------------------------------------------------------
// Juno Pub Master/Starting point.
//----------------------------------------------------------------------------
yuno_in01,35,179,4	script	Pub Master#kh	46,5,5,{
	if (checkweight(7487,1) == 0) {
		mes "[Vandt]";
		mes "Just a second! You're";
		mes "carrying too many items";
		mes "right now. You'd better";
		mes "put your stuff in Kafra";
		mes "Storage or you won't be";
		mes "able to pick up anything new...";
		close;
	}
	if (KielHyreQuest == 0) {
		mes "[Vandt]";
		mes "Hi there, welcome";
		mes "to my pub. So what";
		mes "would you like to have?";
		next;
		switch(select("Beer, please.","A cocktail, please.","Soju, please.","Maybe later.")) {
		case 1:
			mes "[Vandt]";
			mes "Alright, let me get";
			mes "you a glass of beer on";
			mes "tap. There you are, this";
			mes "is out special Schwaltz Beer.";
			next;
			mes "^3355FF*Gulp gulp gulp*^000000";
			percentheal 5,-5;
			next;
			mes "["+strcharinfo(0)+"]";
			mes "Ahhh, it's really";
			mes "good! That really";
			mes "hits the spot!";
			close;
		case 2:
			mes "[Vandt]";
			mes "I'm sorry, but I have to";
			mes "deliver all of our cocktail";
			mes "ingredients to other customers.";
			mes "Maybe I'll have enough to make";
			mes "you something next time, okay?";
			close;
		case 3:
			mes "[Vandt]";
			mes "S-soju? I'm sorry,";
			mes "but we don't serve that";
			mes "here. It's too much of";
			mes "a tough guy drink for me...";
			close;
		case 4:
			mes "[Vandt]";
			mes "Sure, just take";
			mes "your time, relax,";
			mes "and order something";
			mes "when you're ready.";
			close;
		}
	}
	if (KielHyreQuest == 1) {
		mes "[Vandt]";
		mes "Hi there, welcome";
		mes "to my pub. So what";
		mes "would you like to have?";
		next;
		switch(select("Beer, please:A cocktail, please:Soju, please.:You look worried, what's up?:Cancel")) {
		case 1:
			mes "[Vandt]";
			mes "Alright, let me get";
			mes "you a glass of beer on";
			mes "tap. There you are, this";
			mes "is out special Schwaltz Beer.";
			next;
			mes "^3355FF*Gulp gulp gulp*^000000";
			percentheal 5,-5;
			next;
			mes "["+strcharinfo(0)+"]";
			mes "Ahhh, it's really";
			mes "good! That really";
			mes "hits the spot!";
			close;
		case 2:
			mes "[Vandt]";
			mes "I'm sorry, but I have to";
			mes "deliver all of our cocktail";
			mes "ingredients to other customers.";
			mes "Maybe I'll have enough to make";
			mes "you something next time, okay?";
			close;
		case 3:
			mes "[Vandt]";
			mes "S-soju? I'm sorry,";
			mes "but we don't serve that";
			mes "here. It's too much of";
			mes "a tough guy drink for me...";
			close;
		case 4:
			mes "[Vandt]";
			mes "Oh, did you overhear?";
			mes "I'm sorry, it's just that one";
			mes "of my employees had an";
			mes "accident and was pretty hurt,";
			mes "so I have nodoby that can";
			mes "deliver this merchandise.";
			next;
			mes "[Vandt]";
			mes "I have an urgent order";
			mes "that I need to send to";
			mes "the Kiel Hyre Academy,";
			mes "but I can't find anyone";
			mes "that's available for this";
			mes "kind of temporary job.";
			next;
			switch(select("I'm sorry to hear that:Do you want me to help you?")) {
			case 1:
				mes "[Vandt]";
				mes "Well, I'm sure that I'll";
				mes "figure something out.";
				mes "Do you know anyone";
				mes "that'd be interested in";
				mes "some part time work?";
				close;
			case 2:
				mes "[Vandt]";
				mes "Really? That's great!";
				mes "But first, I think it's fair to";
				mes "tell you that this job may not";
				mes "be as simple as you'd think.";
				mes "I expect you to complete the";
				mes "delivery, no matter what.";
				next;
				switch(select("Sure I'll do it:Wait, let me think about it...")) {
				case 1:
					mes "[Vandt]";
					mes "I'm glad to hear that.";
					mes "Well then, please take this";
					mes "bottle of Culinary Wine to";
					mes "Mrs. ^ff0000Lecollane^000000 in the Kiel";
					mes "Hyre Academy. I'll pay you";
					mes "once you finish the job, okay?";
					getitem 7487,1; //Tavern_Wine
					set KielHyreQuest,2;
					close;
				case 2:
					mes "[Vandt]";
					mes "Sure thing. I really need";
					mes "to get this done, so if you";
					mes "can't do it, but know any";
					mes "capable, responsible";
					mes "people that can, then please";
					mes "tell them about my situation.";
					close;
				}
			}
		case 5:
			mes "[Vandt]";
			mes "Sure, just take";
			mes "your time, relax,";
			mes "and order something";
			mes "when you're ready.";
			close;
		}
	}
	else if ((KielHyreQuest >= 2) && (KielHyreQuest < 6)) {
		mes "[Vandt]";
		mes "Please deliver that bottle";
		mes "of Wine I gave you to Mrs.";
		mes "Mrs. ^ff0000Lecollane^000000, who should be";
		mes "inside the Kiel Hyre Academy.";
		mes "Hurry and get it to her before she";
		mes "can complain about the delivery.";
		close;
	}
	else if (KielHyreQuest == 6) {
		if (countitem(7487) == 0) {
			mes "[Vandt]";
			mes "Oh, you're back.";
			mes "Thanks for making that";
			mes "delivery. Just give me";
			mes "a moment, and then I can";
			mes "pay you in zeny, okay?";
			next;
			select("I need more wine...");
			mes "[Vandt]";
			mes "Oh, you need to deliver";
			mes "another bottle? Alright,";
			mes "let me look around, and";
			mes "I'll give you the wine";
			mes "and your payment.";
			next;
			mes "^3355FFRummage Rummage^000000";
			mes "^3355FFRummage Rummage^000000";
			next;
			mes "[Vandt]";
			mes "There you go!";
			mes "Thank you so much";
			mes "for helping me out~";
			getitem 7487,1; //Tavern_Wine
			set Zeny, Zeny+1000;
			close;
		}
		else {
			mes "[Vandt]";
			mes "Hey, thanks a lot";
			mes "for helping me out that";
			mes "last time. I knew I asked";
			mes "you out of the blue, but";
			mes "you ended up being a life";
			mes "saver! I really appreciate it!";
			close;
		}
	}
	else {
		mes "[Vandt]";
		mes "You're a really good";
		mes "worker, you know that?";
		mes "Dependable, responsible,";
		mes "willing to help others, and";
		mes "proactive too! I think you'll";
		mes "go far in life, kid, I really do~";
		close;
	}

//OnTouch2:
OnTouch:
	if (KielHyreQuest < 1) {
		mes "[Vandt]";
		mes "Arrrggghhh...";
		mes "This can't be good...";
		mes "This isn't good at all!";
		mes "What am I suposed to do?";
		set KielHyreQuest,1;
		close;
	} 
}

//----------------------------------------------------------------------------
// Juno Toast Sales Girl.
//----------------------------------------------------------------------------
yuno,217,114,6	script	Little Kid#kh	96,{
	mes "[Cezu]"; 
	if (KielHyreQuest < 6) {
		mes "Fresh, crunchy toast!";
		mes "If you want some, come";
		mes "and get some tooooast~";
		close;
	}
	else if (KielHyreQuest == 6) {
		if (KHToastGirlEnd < 1) {
			mes "Fresh, crunchy toast!";
			mes "If you want some, come";
			mes "and get some tooooast~";
			mes "Oh! Hi hi~ Did you want";
			mes "to buy some yummy toast?";
			next;
			switch(select("I'm here for Elly:No, thanks")) {
			case 1:
				mes "[Cezu]"; 
				mes "Oh, I see. Elly must have";
				mes "wasted another batch of";
				mes "ingredients again. Well,";
				mes "she's a regular customer,";
				mes "so I really want to help, but";
				mes "I can't really do anything.";
				next;
				mes "[Cezu]"; 
				mes "You see, I just ran";
				mes "out of ingredients too!";
				mes "But I can't really leave";
				mes "to get some more. What if";
				mes "people need to buy toast?";
				mes "Listen, can you help me out?";
				next;
				mes "[Cezu]"; 
				mes "Would you please go get";
				mes "some flour and eggs for me";
				mes "from the ^3355FFLighthalzen Windmill^000000";
				mes "Then, when you come back, I can";
				mes "divide the ingredients, and you";
				mes "can deliver some to Elly.";
				next;
				mes "[Cezu]"; 
				mes "I know that I'm basically";
				mes "making you do everything";
				mes "on your own, but please try";
				mes "to understand that my hands";
				mes "are tied. D-don't ask me";
				mes "why, they just are!";
				set KHToastGirlEnd,1;
				close;
			case 2:
				mes "[Cezu]";
				mes "Okay okay~";
				mes "Please come again!";
				close;
			}
		}
		else if (KHToastGirlEnd == 1) {
			mes "Would you please go to";
			mes "the Lighthalzen Windmill";
			mes "and tell them that Cezu needs";
			mes "lots of flour and lots of eggs!";
			mes "Then, bring all the stuff over";
			mes "to me as soon as you can~";
			close;
		}
		else if (KHToastGirlEnd == 2) {
			mes "Hey, you're back with the";
			mes "ingredients! Thank you so";
			mes "much, I really needed these!";
			mes "Now please give this flour";
			mes "and these eggs to Elly, and";
			mes "send her my regards. See you~";
			delitem 7488,1; //Delivery_Package
			getitem 7488,1; //Delivery_Package
			set KHToastGirlEnd,3;
			close;
		}
	}
	//KHToastGirlEnd no longer needed-- deleting.
	if (KielHyreQuest > 6) set KHToastGirlEnd,0;
	mes "Hot, fresh and";
	mes "cruuuunchy toast!";
	mes "Come and get some!";
	close;
}

//----------------------------------------------------------------------------
// Lighthalzen WindMill Owner.
//----------------------------------------------------------------------------
lighthalzen,366,299,4	script	Windmill Owner#kh	46,{
	if (checkweight(7488,1) == 0) {
		mes "[Mills]";
		mes "Hey, you've got too much";
		mes "stuff on you right now. ";
		mes "Put your junk in Kafra Storage";
		mes "if you expect me to give you";
		mes "anything. That's why you came";
		mes "here to the miss, didn't you?";
		close;
	}
	if (KHToastGirlEnd < 1) {
		mes "[Mills]";
		mes "Hey, whaddya want?";
		mes "I'm pretty busy right";
		mes "now, so you mind coming";
		mes "back later? Then we'll talk.";
		close;
	}
	else if (KHToastGirlEnd == 1) {
		mes "[Mills]";
		mes "Hey, whaddya want?";
		mes "You just happened to";
		mes "catch me at a good time,";
		mes "but if you need anything,";
		mes "you'd better spit it out quick";
		mes "before things get hectic again.";
		next;
		switch(select("I'm here for Cezu:......")) {
		case 1:
			mes "[Mills]";
			mes "Oh, Cezu from the";
			mes "toast stand? Okay,";
			mes "I've got everything";
			mes "that kid needs right";
			mes "here. There's eggs inside,";
			mes "so be really careful with it.";
			mes "It's ready for you...";
			next;
			mes "[Mills]";
			mes "Kid's one of my regular";
			mes "customers, so you don't";
			mes "have to pay me, or run any";
			mes "extra errands on my end. Yeah,";
			mes "I know how other people treat";
			mes "you adventurers. Well, see ya.";
			getitem 7488,1; //Delivery_Package
			set KHToastGirlEnd,2;
			close;
		case 2:
			mes "[Mills]";
			mes "......";
			mes "Um, okay, well, if";
			mes "you need something,";
			mes "just hollar, I guess.";
			mes "Cuts, Cutz where are you?";
			mes "You'd better not be goofing off!";
			close;
		}
	}
	else if (KHToastGirlEnd >= 2) {
		mes "[Mills]";
		mes "That Cutz is such";
		mes "a lazy rascal. The guy";
		mes "thinks he can fool around";
		mes "when he's on the clock...!";
		mes "Ah well, he knows I can't find";
		mes "a better assistant. He'll learn...";
		close;
	}
}

lighthalzen,366,289,2	script	Windmill Owner's Helper	97,{
	if (KHToastGirlEnd < 1) {
		mes "[Cutz]";
		mes "Man, why are we";
		mes "always so busy?";
		mes "Why does Mills have";
		mes "to work me to the bone?";
		mes "Eh, it's a living, I suppose...";
		close;
	}
	else if (KHToastGirlEnd >= 2) {
		mes "[Cutz]";
		mes "Wh-what makes you";
		mes "think I'm goofing off,";
		mes "Mills? L-look, look,";
		mes "my hands are moving,";
		mes "I'm busy, I'm working!";
		close;
	}
	else {
		mes "[Cutz]";
		mes "Hey, you're from";
		mes "Cezu's toast stand,";
		mes "right? How is cute";
		mes "little Cezu doing?";
		close;
	}
}

//============================================================================
//Kiel Hyre Academy NPCs
//============================================================================

//----------------------------------------------------------------------------
// Girl (Talks about the academy)
//----------------------------------------------------------------------------
yuno_fild08,196,196,5	script	Hanie#kh1	102,{
	mes "[Hanie]";
	mes "Oh, I wish I could study";
	mes "at the Kiel Hyre Academy...";
	mes "All of the graduates get";
	mes "really nice jobs! I'm almost";
	mes "jealous of the students!";
	next;
	select("Kiel Hyre Academy?");
	mes "[Hanie]";
	mes "Oh, the Kiel Hyre Academy";
	mes "is a school founded by Kiel";
	mes "Hyre, an inventor that became";
	mes "rich from his strange machines.";
	mes "He decided to give back to society";
	mes "by building this private academy.";
	next;
	mes "[Hanie]";
	mes "However, the school will";
	mes "only accept orphans that are";
	mes "too poor to enroll in any other";
	mes "schools. Sometimes, it makes";
	mes "me wish that I was an orphan too!";
	mes "Well, not really, but you know...";
	close;
}


//----------------------------------------------------------------------------
// Academy Security Guards
//----------------------------------------------------------------------------
yuno_fild08,158,194,6	script	Security Guard#1::KHAGuard	852,{
	if ((KielHyreQuest < 2) || (KielHyreQuest > 31)) { 
		mes "[Security Guard]";
		mes "I'm sorry, but if you aren't";
		mes "associated with this institution,";
		mes "then you're not authorized to";
		mes "enter the ^FF0000Kiel Hyre Academy^000000.";
		mes "Please leave if you don't have";
		mes "an appointment with the staff.";
		close;
	}
	else if (KielHyreQuest == 2) { 
		mes "[Security Guard]";
		mes "I'm sorry, but if you aren't";
		mes "associated with this institution,";
		mes "then you're not authorized to";
		mes "enter the ^FF0000Kiel Hyre Academy^000000.";
		mes "Please leave if you don't have";
		mes "an appointment with the staff.";
		next;
		switch(select("I'm here for a delivery.:......")) {
		case 1:
			mes "[Security Guard]";
			mes "You're here to deliver";
			mes "something? Okay, just give";
			mes "me the recipient's ^FF0000name^000000,";
			mes "followed by the ^FF0000item^000000 being";
			mes "delivered, and I'll verify it";
			mes "before letting you inside.";
			next;
			input .@KHDelivery$;
			if (.@KHDelivery$ != "Lecollane") {
				mes "[Security Guard]";
				mes "You're here to deliver some";
				mes "Wine to...to who? What was";
				mes "the name? I...I don't think";
				mes "we have anybody in the";
				mes "academy named "+.@KHDelivery$+"";
				close;
			}
			input .@KHDelivery$ ;
			if (.@KHDelivery$ != "Culinary Wine") {
				mes "[Security Guard]";
				mes "So you're here to make";
				mes "a delivery to Mrs. Lecollane?";
				mes "What is it you've brought for";
				mes "her? Some ^3355FF"+.@KHDelivery$+"^000000?";
				next;
				mes "[Security Guard]";
				mes "Let me buzz her first,";
				mes "and check to make sure";
				mes "that she's been expecting";
				mes "you. Let's see now...";
				next;
				mes "......";
				mes ".........";
				mes "............";
				next;
				mes "[Security Guard]";
				mes "Huh. Mrs Lecollane";
				mes "is expecting a delivery,";
				mes "but not the item that you";
				mes "say that you've brought for";
				mes "her. You might want to check";
				mes "to see if there's been a mixup...";
				close;
			}
			mes "[Security Guard]";
			mes "Alright....";
			mes "So you're here to";
			mes "deliver a bottle of";
			mes "Wine to Mrs. Lecollane?";
			mes "Let me buzz her, and get";
			mes "this confirmed real quickly.";
			next;
			mes "......";
			mes ".........";
			mes "............";
			next;
			mes "[Security Guard]";
			mes "Okay, everything looks";
			mes "good. Mrs. Lecollane";
			mes "has been expecting you.";
			mes "I guess you can enter.";
			close2;
			warp "kh_school",71,155;
			end;
		case 2:
			mes "[Security Guard]";
			mes "If you don't have";
			mes "an appoointment, then";
			mes "don't loiter around in";
			mes "front of the academy!";
			close;
		}
	}
	else if (KielHyreQuest < 32) { 
		mes "[Security Guard]";
		mes "Oh, did you have";
		mes "other business inside";
		mes "the academy? I remember";
		mes "you from before, so there";
		mes "shouldn't be any problems";
		mes "letting you back inside...";
		close2;
		warp "kh_school",71,155;
		end;
	}
}

yuno_fild08,158,183,7	duplicate(KHAGuard)	Security Guard#2	852

//----------------------------------------------------------------------------
// Gossiping Teenagers/Story NPCs
//----------------------------------------------------------------------------
kh_school,57,142,6	script	Student#kha	893,3,3,{
	mes "[Laci]";
	mes "Oh, wow! We usually";
	mes "don't get visitors on";
	mes "campus! Um, you're not";
	mes "a new faculty member, are you?";
	close;

OnTouch:
	mes "[Laci]";
	mes "Hey, Nesha...!";
	mes "have you heard why";
	mes "Aaci hasn't been coming";
	mes "to class for awhile?";
	next;
	mes "[Gui Nesha]";
	mes "That's right, I haven't";
	mes "seen Aaci in awhile.";
	mes "Did something happen?";
	next;
	mes "[Laci]";
	mes "It's because....";
	mes "Aaci saw a freakin' ghost!";
	mes "It's one hundred percent";
	mes "true! I heard about it from,";
	mes "well, you know, my sources.";
	next;
	mes "[Gui Nesha]";
	mes "...Wha...?";
	mes "Oh, come on,";
	mes "get outta town.";
	close;
}

kh_school,57,139,0	script	Student#khb	893,{
	mes "[Gui Nesha]";
	mes "Aren't we a little";
	mes "old to be talking about";
	mes "this kind of stuff? You";
	mes "know, rumors and ghost";
	mes "stories that make no sense?";
	mes "C'mon, Laci, knock it off!";
	emotion e_swt2;
	close;
}

//----------------------------------------------------------------------------
// Mrs. Lecollane
//----------------------------------------------------------------------------
kh_school,176,60,4	script	Lady#kh	101,{
	if (KielHyreQuest < 2) {
		mes "[Mrs. Lecollane]";
		mes "Is there a problem?";
		mes "Outsiders are not allowed to come";
		mes "in here, please leave.";
		close;
	}
	else if (KielHyreQuest == 2) { 
		mes "[Mrs. Lecollane]";
		mes "Oh, hello. Ah!";
		mes "have you come to";
		mes "deliver my wine? The";
		mes "security guard called and";
		mes "mentioned you were coming.";
		next;
		switch(select("Yes, that's right!:Er, s-sorry!")) {
		case 1:
			mes "[Mrs. Lecollane]";
			mes "Well, you've come a little";
			mes "later than I thought, but";
			mes "I suppose it can't be helped.";
			mes "I guess the waiting has just";
			mes "heightened my anticipation";
			mes "for this bottle of wi--";
			next;
			mes "^3355FF*Cling! Crrrack!*^000000";
			next;
			mes "[Mrs. Lecollane]";
			mes "Elly? Elly did you";
			mes "break something again?!";
			mes "You've got to be more careful!";
			mes "If you don't finish baking those";
			mes "cookies by the end of today, your";
			mes "semester grades will suffer!";
			next;
			mes "[Elly]";
			mes "B-but I just...";
			next;
			mes "[Mrs. Lecollane]";
			mes "^FF0000Elly^000000!!";
			next;
			mes "[Elly]";
			mes "......";
			mes "Yes, Mrs. Lecollane.";
			next;
			mes "[Mrs. Lecollane]";
			mes "*Ahem* Excuse me.";
			mes "Would you please leave";
			mes "the wine over there? You";
			mes "may go now, and please";
			mes "don't wander needlessly";
			mes "around the academy.";
			delitem 7487,1; //Tavern_Wine
			set KielHyreQuest,4;
			close;
		case 2:
			mes "[Mrs. Lecollane]";
			mes "Hm...?";
			mes "I guess I must";
			mes "be mistaken. I'm";
			mes "sorry, I thought you";
			mes "were somebody else.";
			close;
		}
	}
	else if (KielHyreQuest == 4) {
		mes "[Mrs Lecollane]";
		mes "Well, our business is";
		mes "completed, so would you";
		mes "please leave the campus";
		mes "as soon as you can? *Sigh*";
		mes "I can't believe our future";
		mes "is in these girls' hands...";
		close;
	}
}

//----------------------------------------------------------------------------
// Elly (In school)
//----------------------------------------------------------------------------
kh_school,179,39,0	script	Cute Student#kh	895,{
	if (checkweight(908,200) == 0) {
		mes "[Elly]";
		mes "I'm sorry, but would you";
		mes "put some of your things in";
		mes "your Kafra Storage first or";
		mes "something? I can't really";
		mes "help you when you're ";
		mes "carrying so much stuff.";
		close;
	}
	cutin "kh_elly01",2;
	if (KielHyreQuest < 4) { 
		cutin "kh_elly03",2;
		mes "[Elly]";
		mes "W-wah! Oh...!";
		mes "^333333*Phew*^000000 That was close,";
		mes "I almost dropped them ";
		mes "again! Why do I have so much";
		mes "trouble handling ingredients?";
	}
	else if (KielHyreQuest == 4) { 
		cutin "kh_elly03",2;
		mes "[Elly]";
		mes "Oh no, what should";
		mes "I do? ^333333*Sob*^000000 Wh-what";
		mes "am I going to do? ^333333*Sniff*^000000";
		next;
		switch(select("What happened?:......")) {
		case 1:
			mes "[Elly]";
			mes "I... I have to finish baking";
			mes "this batch of cookies by the";
			mes "end of today, but then I spilled";
			mes "all of the ingredients on the";
			mes "floor. I don't know how I can";
			mes "bake those cookies now...";
			next;
			switch(select("What can I do to help you?:Oh, I'm so sorry.")) {
			case 1:
				cutin "kh_elly02",2;
				mes "[Elly]";
				mes "What was that...?";
				mes "You'll really help";
				mes "me? That's wonderful!";
				mes "Thank you! Thanks so much!";
				next;
				break;
			case 2:
				mes "[Elly]";
				mes "Wait, you don't go";
				mes "to this school, don't";
				mes "you? Y-you're one of";
				mes "those adventurers, right?";
				next;
				select("Yeah, that's right.");
				mes "Listen, I know you";
				mes "probably have your own";
				mes "plans, but do  you think";
				mes "you can help me with this";
				mes "huge problem that I have?";
				next;
				switch(select("Accept:Decline")) {
				case 1:
					cutin "kh_elly02",2;
					mes "How Wonderful!";
					mes "Thank you! Thank you";
					mes "so much! I'm supposed to";
					mes "finish baking this batch of";
					mes "cookies soon, but I spilled";
					mes "all of the ingredients...";
					next;
					break;
				case 2:
					mes "["+strcharinfo(0)+"]";
					mes "I'm outta here.";
					next;
					cutin "kh_elly04",2;
					mes "[Elly]";
					mes "W-wait...!";
					mes "Come back, you";
					mes "d-don't...! I really";
					mes "need some help!";
					emotion e_sob;
					close2;
					cutin "",255;
					end;
				}
			}
			cutin "kh_elly01",2;
			mes "[Elly]";
			mes "Well, I guess the only way";
			mes "I can bake these cookies is";
			mes "to get some new ingredients.";
			mes "I'm sorry to be such a burden,";
			mes "but if you didn't offer to help";
			mes "me, then I'd have no one to ask!";
			next;
			cutin "kh_elly04",2;
			mes "[Elly]";
			mes "You don't understand how";
			mes "important it is that I bake";
			mes "these cookies... If I don't";
			mes "finish this assignment, then";
			mes "Mrs. Crank will fail me for";
			mes "the entire semester!";
			next;
			mes "[Elly]";
			cutin "kh_elly01",2;
			mes "Okay, I need to calm";
			mes "down. I think I can do";
			mes "this with your help.";
			mes "Would you please do me";
			mes "this huge favor and bring";
			mes "all of these ingredients?";
			next;
			mes "[Elly]";
			mes "^3355FF1 Wine^000000,";
			mes "^3355FF7 Milks^000000,";
			mes "^3355FF5 Cacaos^000000,";
			mes "^3355FF2 Cheeses^000000,";
			mes "^3355FF1 Egg^000000, and";
			mes "^3355FF1 Bag of Flour^000000.";
			next;
			mes "[Elly]";
			mes "Let's see... You can";
			mes "get Wine from a pub in";
			mes "Juno, Cacaos from hunting";
			mes "Yoyos, and you can get flour";
			mes "and Eggs from the girl that";
			mes "runs the Toast Stand in Juno.";
			next;
			mes "[Elly]";
			mes "Good luck, getting";
			mes "everything, and I hope";
			mes "you hurry back here with";
			mes "those cookie ingredients";
			mes "as quickly as you can, okay?";
			set KielHyreQuest,6;
			break;
		case 2:
			mes "[Elly]";
			mes "*Sob*...";
			break;
		}
	}
	else if (KielHyreQuest == 6) {
		if ((countitem(519) < 7) || (countitem(548) < 2) || (countitem(7182) < 5) || (countitem(7487) < 1) || (countitem(7488) < 1)) {
			mes "[Elly]";
			mes "Let's see, would you";
			mes "like me to remind you";
			mes "which ingredients I need?";
			mes "Please bring these things as";
			mes "soon as you can so that I can";
			mes "quickly bake some cookies~";
			next;
			mes "[Elly]";
			mes "^3355FF1 Wine^000000,";
			mes "^3355FF7 Milks^000000,";
			mes "^3355FF5 Cacaos^000000,";
			mes "^3355FF2 Cheeses^000000,";
			mes "^3355FF1 Egg^000000, and";
			mes "^3355FF1 Bag of Flour^000000.";
			next;
			cutin "kh_elly01",2;
			mes "[Elly]";
			mes "Let's see... You can";
			mes "get Wine from a pub in";
			mes "Juno, Cacaos from hunting";
			mes "Yoyos, and you can get flour";
			mes "and Eggs from the girl that";
			mes "runs the Toast Stand in Juno.";
		}
		else {
			cutin "kh_elly02",2;
			mes "[Elly]";
			mes "Hooray! Finally, I have";
			mes "everything I need! This is";
			mes "great! Oh, would you please";
			mes "give me a moment while I bake";
			mes "these cookies?  It shouldn't take";
			mes "long, so hold on just a bit.";
			delitem 519,7; //Milk
			delitem 548,2; //Cheese
			delitem 7182,5; //Cacao
			delitem 7487,1; //Tavern_Wine
			delitem 7488,1; //Delivery_Package
			set KielHyreQuest,8;
			//KHPubMasterEnd no longer needed-- deleting.
			set KHPubMasterEnd,0;
			set KHToastGirlEnd,0;
			emotion e_ho;
		}
	}
	else if (KielHyreQuest == 8) {
		mes "[Elly]";
		mes "Tadah! I did it!";
		mes "They're finally done!";
		mes "Elly's special cookies.";
		mes "I'd like you to have some";
		mes "as thanks for helping me out.";
		next;
		mes "[Elly]";
		mes "I'm sorry, but I was so";
		mes "preoccupied with baking";
		mes "these cookies that I didn't";
		mes "even ask for your name. I'm";
		mes "^FF0000Ellyja^000000, but everybody calls me,";
		mes "''Elly.'' What's your name?";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "^3355FF"+strcharinfo(0)+"^000000.";
		mes "It's ^3355FF"+strcharinfo(0)+"^000000.";
		next;
		cutin "kh_elly02",2;
		mes "[Elly]";
		mes ""+strcharinfo(0)+"?";
		mes "...that name! It's wonderful!";
		getitem 538,5; //Well_Baked_Cookie
		set KielHyreQuest,10;
	}
	else if (KielHyreQuest == 10) {
		mes "[Elly]";
		mes "I'm sorry, but I have";
		mes "another favor to ask you";
		mes "if you don't mind helping";
		mes "me out again. Don't worry,";
		mes "you won't have to hurry as";
		mes "quickly as you did last time.";
		next;
		switch(select("What do you need?:Sorry, but I'm pretty busy...")) {
		case 1:
			mes "[Elly]";
			mes "You know how you helped";
			mes "me bake those cookies?";
			mes "It's the first time I was able";
			mes "to do it without burning them!";
			mes "I just know Grandfather'd";
			mes "be so proud of me!";
			next;
			mes "[Elly]";
			mes "I really want Grandfather";
			mes "to taste the cookies I baked,";
			mes "but the cookies will be stale";
			mes "by the time I'm able to leave";
			mes "campus. Would you deliver these";
			mes "cookies to my grandfather for me?";
			next;
			switch(select("Sure:I'm busy.")) {
			case 1:
				cutin "kh_elly02",2;
				mes "[Elly]";
				mes "Oh, "+strcharinfo(0)+"!";
				mes "Thank you so much, I knew";
				mes "you'd understand! Would you";
				mes "please bring the cookies to";
				mes "him at ^FF0000Kiel Hyre's cottage^000000?";
				next;
				mes "[Elly]";
				mes "Oh, right! They're really";
				mes "careful about visitors and";
				mes "keeping strangers off the";
				mes "property, but if you mention";
				mes "my name, they'll let you in.";
				mes "Alright then, see you~";
				set KielHyreQuest,12;
				break;
			case 2:
				cutin "kh_elly03",2;
				mes "[Elly]";
				mes "Oh, um...";
				mes "Okay, I'm sorry to";
				mes "have bothered you...";
				break;
			}
			break;
		case 2:
			cutin "kh_elly03",2;
			mes "[Elly]";
			mes "Oh, um...";
			mes "Okay, I'm sorry to";
			mes "have bothered you...";
			break;
		}
	}
	else if (KielHyreQuest == 12) {
		mes "[Elly]";
		mes "Oh, you don't know where";
		mes "to find Kiel Hyre's cottage?";
		mes "It's just north from this";
		mes "academy. Please deliver my";
		mes "cookies to Grandfather, and";
		mes "let him know I really miss him.";
	}
	else if (KielHyreQuest == 14) {
		cutin "kh_elly03",2;
		mes "[Elly]";
		mes "Hm? Grandfather's not";
		mes "home? That's strange, he";
		mes "didn't mention anything about";
		mes "any business trips. I thought";
		mes "he'd be at home all day...";
		next;
		cutin "kh_elly04",2;
		mes "[Elly]";
		mes "Would you go back to his";
		mes "cottage one more time? Here,";
		mes "you can use this Cottage Key.";
		mes "That way, you can just go";
		mes "inside and talk to him~";
		getitem 7489,1; //Villa_Spare_Key
		set KielHyreQuest,16;
	}
	else if ((KielHyreQuest >= 14) && (KielHyreQuest < 20)) {
		mes "[Elly]";
		mes "That's so weird...";
		mes "I thought Grandfather";
		mes "said that he'd be at";
		mes "home all day today...";
	}
	else if (KielHyreQuest == 20) {
		mes "[Elly]";
		mes "Hmm...?";
		mes "What's this,";
		mes "a letter for me?";
		next;
		mes "^3355FFElly opened the envelope";
		mes "and started reading the letter.^000000";
		next;
		mes "^333333Dearest Elly,";
		mes " ";
		mes "I have something to discuss";
		mes "with my son Kiehl, so I am";
		mes "leaving to meet with him.";
		mes "If you don't hear from me";
		mes "after 7 days after I've written";
		mes "this letter, then you must";
		mes "escape the academy as soon";
		mes "as possible, and retrieve";
		mes "something inside our ";
		mes "cottage's study.";
		mes " ";
		mes "If you have a friend you";
		mes "can trust, please ask him";
		mes "to follow my traces in the";
		mes "cottage. I might be in danger,";
		mes "and in dire need of rescue.";
		mes " ";
		mes "Elly, don't trust anyone";
		mes "in the academy, even your";
		mes "classmates, since they may";
		mes "be influenced by Kiehl.";
		mes " ";
		mes "Be careful, and I love you.";
		mes " ";
		mes "--Grandpa^000000";
		next;
		cutin "kh_elly03",2;
		mes "[Elly]";
		mes "What? Oh no, it's been";
		mes "ten days since he wrote";
		mes "this letter! Ah, does this";
		mes "mean that he's in danger?!";
		mes "Oh no, what should I do?";
		delitem 7490,1; //Letter_to_Elly
		set KielHyreQuest,22;
	}
	else if (KielHyreQuest == 22) {
		cutin "kh_elly03",2;
		mes "[Elly]";
		mes "......";
		mes ".........";
		mes "............";
		next;
		switch(select("About your grandpa:Tell me about Kiehl:What's with this academy?")) {
		case 1:
			mes "[Elly]";
			mes "Oh! My grandfather is";
			mes "Kiel Hyre, founder and";
			mes "CEO of the Kiel Hyre";
			mes "foundation. He looks";
			mes "strict and cold hearted,";
			mes "but he's actually very nice!";
			next;
			mes "[Elly]";
			mes "We're not related by";
			mes "blood, but he's taken";
			mes "care of me ever since";
			mes "I lost my parents. Oh,";
			mes "Grandapa, where are you?";
			mes "I'm getting so worried!";
			break;
		case 2:
			mes "[Elly]";
			mes "Kiehl? That's my";
			mes "grandfather's son...";
			mes "I don't know him that";
			mes "well, and only saw him";
			mes "once at an academy event.";
			next;
			mes "[Elly]";
			mes "Mmm, he's a good looking";
			mes "guy with pale skin, silver";
			mes "hair, and this cold, fierce";
			mes "stare. A lot of my classmates";
			mes "worship Kiehl because he's";
			mes "also a business genius~";
			next;
			mes "[Elly]";
			mes "It's weird though...";
			mes "I have no idea why my";
			mes "grandpa and Kiehl don't";
			mes "get along. They're both";
			mes "really good at what they do...";
			break;
		case 3:
			mes "[Elly]";
			mes "Well, I know the security";
			mes "here is really tight, but";
			mes "that's because everything";
			mes "here is so luxurious and";
			mes "expensive, you know~";
			next;
			mes "[Elly]";
			mes "We also have a very";
			mes "special curriculum where";
			mes "you learn more of what you";
			mes "want. Personally, I want to";
			mes "become a great career woman";
			mes "like ^0000FFMs. Allysia^000000. Heh heh~";
			next;
			mes "[Elly]";
			mes "This place certainly";
			mes "isn't like other schools.";
			//mes "You already know that only";
			mes "Yeah, everything is made to";
			mes "fit each of the student's needs.";
			next;
			mes "[Elly]";
			mes "Recently, though?";
			mes "Some really weird stuff";
			mes "has been happening. All of";
			mes "my classmates are afraid of";
			mes "going out alone by themselves.";
			next;
			cutin "kh_elly02",2;
			mes "[Elly]";
			mes "But I'll be okay!";
			mes "You'll be there to";
			mes "rescue me from danger,";
			mes "right, "+strcharinfo(0)+"?";
			next;
			switch(select("Who is Ms. Allysia?:Strange incidents?")) {
			case 1:
				mes "[Elly]";
				mes "Oh, Ms. Allysia is";
				mes "Grandfather's secretary~";
				mes "She's so beautiful, and";
				mes "my grandfather really";
				mes "trusts her with everything!";
				break;
			case 2:
				cutin "kh_elly04",2;
				mes "[Elly]";
				mes "Well, "+strcharinfo(0)+"...";
				mes "I'm not supposed to tell";
				mes "anyone outside of the school,";
				mes "but I can trust you! You see...";
				mes "We're haunted by a ghost!";
				next;
				mes "[Elly]";
				mes "I know it sounds crazy,";
				mes "but this ghost wanders the";
				mes "campus, and curses its victims,";
				mes "making them so cold and lifeless.";
				mes "It happened to my roommate,";
				mes "Mayo. It's like she's a statue...";
				next;
				mes "[Elly]";
				mes "I snuck into the medical";
				mes "office to see her, and she...";
				mes "She couldn't do anything!";
				mes "What would happen if the";
				mes "ghost decided to curse me?!";
				next;
				cutin "kh_elly02",2;
				mes "[Elly]";
				mes "You know what...?";
				mes "If I ever got cursed";
				mes "by that ghost, just yell";
				mes "''^FF0000Wake up, Elly!^000000''";
				mes "That'll wake me up for sure!";
				set KielHyreQuest,24;
				break;
			}
		}
	}
	else if (KielHyreQuest >= 24 && KielHyreQuest <= 26) {
		cutin "kh_elly04",2;
		mes "[Elly]";
		mes "Argh, I'm in a fix!";
		mes "I have to finish my";
		mes "homework before it's due!";
		mes "Yeah, I've got to go see";
		mes "Mrs. Lecollane now.";
		next;
		mes "[Elly]";
		mes "Say, "+strcharinfo(0)+",";
		mes "if it's okay, would you";
		mes "please go find what my";
		mes "grandpa left for me in";
		mes "the ^FF0000cottage study^000000? You're";
		mes "the only one I can trust!";
		next;
		mes "[Elly]";
		mes "Anyway, I'll see you later";
		mes "in the evening! Please come";
		mes "by my ^FF0000dorm room^000000. Um, the";
		mes "dorms are in the church just";
		mes "behind the academy, okay?";
		next;
		mes "[Elly]";
		mes "My room is in the back,";
		mes "and it's on the ^FF0000second floor^000000";
		mes "^FF0000on the left side^000000. Please use";
		mes "a ladder to come up, okay?";
		mes "I'll leave my window open";
		mes "for you, so just come, okay?";
		next;
		mes "[Elly]";
		mes "Hurry, hurry, the";
		mes "teacher's coming!";
		set KielHyreQuest,26;
	}
	else {
		mes "[Elly]";
		mes "Hurry, hurry, the";
		mes "teacher's coming!";
	}
	close2;
	cutin "",255;
	end;
}

//----------------------------------------------------------------------------
// Elly's Window 
//----------------------------------------------------------------------------
yuno_fild08,69,185,0	script	Window#kh	111,{
	if (KielHyreQuest < 29) {
		mes "^3355FFYou can see a curtain";
		mes "decorated with a cute";
		mes "design through the";
		mes "window of this room,";
		mes "which is probably";
		mes "used by a young girl.^000000";
		close;
	}
	else if (KielHyreQuest== 29) {
		mes "^3355FFThis must be Elly's room.";
		mes "It doesn't sound like anyone";
		mes "is inside, so she probably";
		mes "isn't back yet. For now, you";
		mes "should try to find what her";
		mes "grandfather left for her";
		mes "in their cottage's Study.^000000";
		close;
	}
	else if ((KielHyreQuest >= 30) && (KielHyreQuest <= 45)) {
		mes "^3355FFThis slightly open window";
		mes "must lead into Elly's room.";
		mes "Although she asked you to";
		mes "find a ladder to enter her";
		mes "window, you probably won't";
		mes "find one. You might be able";
		mes "to climb up that water pipe...^000000";
		next;
		switch(select("Climb Water Pipe:Find Another Way")) {
		case 1:
			if (rand(1,3) == 2) {
				mes "^3355FFYou climbed up the";
				mes "water pipe, and sneaked";
				mes "into Elly's room successfully.^000000";
				close2;
				warp "kh_school",185,185;
				end;
			}
			else {
				mes "^3355FFYou tried to climb";
				mes "the water pipe, but";
				mes "you ended up falling";
				mes "and bumping your head.^000000";
				percentheal -10,0;
				close;
			}
		case 2:
			mes "^3355FFThere must be some";
			mes "other way to get into";
			mes "Elly's room, aside from";
			mes "climbing up this water pipe...^000000";
			close;

		}
	}
	else {
		mes "^3355FFYou can't go up into";
		mes "that open window.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Elly (In Dormitory)
//----------------------------------------------------------------------------
kh_school,178,180,4	script	Elly	895,{
	if (checkweight(908,200) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "Inventory space first...^000000";
		close;
	}
	if (KielHyreQuest < 30) {
		mes "[Elly]";
		mes "Who the heck are you?";
		mes "Y-you're not supposed";
		mes "to be able to get inside!";
		mes "Get out of here right now!";
		close2;
		percentheal -99,0;
		warp "yuno_fild08",100,100;
		end;
	}
	else if (KielHyreQuest < 32) {
		mes "[Elly]";
		mes "......";
		mes ".........";
		mes "............";
		close;
	}
	else if (KielHyreQuest == 32) {
		mes "[Elly]";
		mes "......";
		mes ".........";
		mes "............";
		next;
		mes "^3355FFElly seems to have";
		mes "been cursed, and is";
		mes "completely still and";
		mes "lifeless. You've got to";
		mes "try something, but what?^000000";
		next;
		switch(select("Wake her up by shaking.:Wake her up by yelling.:Ignore")) {
		case 1:
			mes "^3355FFYou grab Elly by the";
			mes "shoulders, and try to get";
			mes "her to respond by violently";
			mes "shaking her entire body.^000000";
			next;
			mes "["+strcharinfo(0)+"]";
			mes "Elly? Elly! No!";
			mes "Come back to us!";
			next;
			mes "^3355FFElly's not responding...^000000";
			close;
		case 2:
			input .@KHInput$;
			if (.@KHInput$ == "Wake up, Elly!") {
				mes "[Elly]";
				mes ".............";
				next;
				mes "^3355FFAs soon as you said those";
				mes "words, a ^000000Small Golden Key^3355FF";
				mes "and a ^000000Button^3355FF drop from Elly's";
				mes "hands. It looks like she woke";
				mes "up, but only for an instant.^000000";
				getitem 7493,1; //Golden_Key
				getitem 7494,1; //Kiel_Button
				set KielHyreQuest,34;
				close;
			}
			else {
				mes "[Elly]";
				mes "......";
				mes ".........";
				mes "............";
				next;
				mes "^3355FFElly's not responding...^000000";
				close;
			}
		case 3:
			mes "^3355FFAlright...";
			mes "But sooner or later,";
			mes "you should try to break";
			mes "the curse placed on Elly.^000000";
			close;
		}
	}
	else if (KielHyreQuest == 34) {
		if (countitem(7491) < 1) {
			//Missing text, needs another run through.
			mes "^3355FFMaybe the golden key^000000";
			mes "unlocks something in the^000000";
			mes "Cottage. Let's take another look.^000000";
			close;
		}
		else {
			mes "^3355FFIt looks like Elly's";
			mes "Golden Key might fit";
			mes "into the keyhole on the";
			mes "Grey Box you found inside";
			mes "Kiel Hyre's Cottage.^000000";
			next;
			mes "^3355FFYou successfully open the";
			mes "Grey Box with the Golden Key,";
			mes "and find a Blue Keycard, along";
			mes "with a folded note, inside the";
			mes "Grey Box. You quickly read";
			mes "the note's contents...^000000";
			next;
			mes "Dearest Elly,";
			mes "Kiehl finally broke the taboo,";
			mes "and tried to transform you guys";
			mes "into something horrible.";
			mes "^FFFFFF_^000000";
			mes "By the time you read this,";
			mes "my life is probably in danger.";
			mes "Whether I live depends on you.";
			mes "^FFFFFF_^000000";
			mes "You'll already learn if you";
			mes "meet Puppet, but I want to tell";
			mes "you myself: you're not human.";
			mes "You'll learn the details if you";
			mes "enter the factory by using the";
			mes "entrance near the grave next";
			mes "to the church. Then, I want";
			mes "you to find Allysia inside";
			mes "the factory's secret room.";
			mes "I've registered your name in";
			mes "her security system, so don't";
			mes "worry. Hopefully, Allysia will";
			mes "then come to save me...";
			mes "^FFFFFF_^000000";
			mes "Sorry about that,";
			mes "Grandpa";
			getitem 7495,1; //Blue_Key_Card
			delitem 7491,1; //Iron_Box
			set KielHyreQuest,36;
			close;
		}
	}
	else if (KielHyreQuest >= 36) {
		mes "^3355FFThis is where you";
		mes "discovered the note";
		mes "locked inside the Grey Box.";
		mes "The following message was";
		mes "written in the note by Elly's";
		mes "grandfather, Kiel Hyre.^000000";
		next;
		mes "Dearest Elly,";
		mes "Kiehl finally broke the taboo,";
		mes "and tried to transform you guys";
		mes "into something horrible.";
		mes "^FFFFFF_^000000";
		mes "By the time you read this,";
		mes "my life is probably in danger.";
		mes "Whether I live depends on you.";
		mes "^FFFFFF_^000000";
		mes "You'll already learn if you";
		mes "meet Puppet, but I want to tell";
		mes "you myself: you're not human.";
		mes "You'll learn the details if you";
		mes "enter the factory by using the";
		mes "entrance near the grave next";
		mes "to the church. Then, I want";
		mes "you to find Allysia inside";
		mes "the factory's secret room.";
		mes "I've registered your name in";
		mes "her security system, so don't";
		mes "worry. Hopefully, Allysia will";
		mes "then come to save me...";
		mes "^FFFFFF_^000000";
		mes "Sorry about that,";
		mes "Grandpa";
		close;
	}
}

//----------------------------------------------------------------------------
// Cookie Basket
//----------------------------------------------------------------------------
kh_school,175,176,0	script	Cookie Basket#kh	111,{
	if (KielHyreQuest < 30) {
		mes "^3355FFIt's a cookie";
		mes "basket filled with";
		mes "delicious cookies.^000000";
		close;
	}
	else if (KielHyreQuest == 30) {
		mes "^3355FFThis must be";
		mes "Elly's cookie basket.";
		mes "There appears to be";
		mes "a folded note wedged";
		mes "between the cookies.^000000";
		next;
		switch(select("Read Note:Ignore")) {
		case 1:
			mes ""+strcharinfo(0)+", help!";
			mes "There's this guy dressed in";
			mes "black who's walking around,";
			mes "and casting this weird spell!";
			mes "He's the one that's been making";
			mes "people cold and lifeless as";
			mes "puppets! I'm getting scared!";
			mes "^FFFFFF_^000000";
			mes "I hope you get this note...";
			mes "He ran after me, but I locked";
			mes "myself in my room. I'm going";
			mes "to leave my window open so that";
			mes "you can still find me. I hope he";
			mes "doesn't cast his curse on me!";
			set KielHyreQuest,32;
			close;
		case 2:
			mes "^3355FFThat note probably";
			mes "wasn't written just";
			mes "for you, anyway.^000000";
			close;
		}
	}
	else if (KielHyreQuest < 108) {
		mes "^3355FFThese cookies aren't";
		mes "stale yet, but they're no";
		mes "longer warm. If they're";
		mes "not at room temperature,";
		mes "then they're a little cold.^000000";
		close;
	}
	else if (KielHyreQuest == 108) {
		mes "^3355FFAs you stare at the";
		mes "cookie basket, the wind";
		mes "from the window jostles";
		mes "it, revealing a letter that";
		mes "was placed underneath.";
		mes "It was probably written";
		mes "by Elly for you to read.^000000";
		next;
		mes "^333333Dearest "+strcharinfo(0)+",";
		mes " ";
		mes "My teachers usually yell at me";
		mes "since I make so many mistakes,";
		mes "but today Mrs. Lecollane gave me";
		mes "praise for my yummy cookies!";
		mes "It's all thanks to you, my friend.";
		mes "I'm very happy we've met:";
		mes "you've taught me that there";
		mes "are good people in the world.";
		mes "And I know Grandpa will like";
		mes "you, though, I don't know";
		mes "where he could be...";
		mes " ";
		mes "Someday, I hope to become";
		mes "as nice a person as you are.";
		mes "Let's keep in touch and be";
		mes "really good friends, okay?";
		mes " ";
		mes "Yours, Elly^000000";
		next;
		mes "^3355FFIt feels like you can";
		mes "still sense Elly's warmth";
		mes "and kindness from her";
		mes "cookie basket. You picked";
		mes "out a cookie, and put it";
		mes "in your mouth. It was";
		mes "deliciously bittersweet.";
		set KielHyreQuest,109;
		next;
		input .@input$;
		mes "["+strcharinfo(0)+"]";
		mes ""+.@input$+"";
		mes "It's time to go back. I can't";
		mes "stay here much longer.";
		close2;
		warp "yuno_fild08",69,183;
		end;
	}
	else {
		mes "^3355FFAll the cookies";
		mes "in this basket are";
		mes "stale! Well, it shouldn't";
		mes "come as a surprise.";
		mes "It's been a long time";
		mes "since they were baked.^000000";
		close;
	}
	end;
}

//----------------------------------------------------------------------------
// Elly's Window (In Dormitory)
//----------------------------------------------------------------------------
kh_school,188,185,0	script	Window#kh2	111,{
	warp "yuno_fild08",69,183;
	end;
}

//----------------------------------------------------------------------------
// Grave/Kiel Hyre dungeon entry
//----------------------------------------------------------------------------
yuno_fild08,71,170,0	script	Grave#kh	111,{
	if (KielHyreQuest < 36) {
		mes "^3355FFIt's just a grave.";
		mes "It might be important";
		mes "to you later, but now";
		mes "it's not really all that";
		mes "helpful to you.^000000";
		close;
	}
	else if (KielHyreQuest == 36) {
		if (countitem(7492) < 1) {
			mes "^3355FFIt's just a grave.";
			mes "It might be important";
			mes "to you later, but now";
			mes "it's not really all that";
			mes "helpful to you.^000000";
			close;
		}
		else {
			mes "^3355FFThere's a secret door";
			mes "near this grave. It looks";
			mes "like there's some kind of";
			mes "slot and a number pad";
			mes "installed on the door.^000000";
			next;
			mes "^3355FFWhat should you";
			mes "insert into the slot?^000000";
			next;
			input .@KHInput$;
			if (.@KHInput$ == "Yellow Keycard") {
				mes "^3355FFAn electronic confirmation";
				mes "chime sounds once you insert";
				mes "the Yellow Keycard, followed by";
				mes "an automated voice that asks:^000000";
				next;
				mes "[Security System]";
				mes "Please enter the password.";
				next;
				input .@KHInput$;
				next;
				if (.@KHInput$ == "4772961") {
					mes "[Security System]";
					mes "Password confirmed.";
					mes "Welcome, Kiel Hyre.";
					next;
					mes "^3355FFYou hear another ";
					mes "pleasant beep, and";
					mes "a secret path opens.^000000";
					set KielHyreQuest,38;
					close;
				}
				else {
					mes "[Security System]";
					mes "Incorrect password.";
					mes "Please try again.";
					close;
				}
			}
			else {
				mes "^3355FFWhatever you're trying";
				mes "to insert into the slot";
				mes "isn't working at all...^000000";
				close;
			}
		}
	}
	else if ((KielHyreQuest >= 38) && (KielHyreQuest < 106)) {
		mes "^3355FFThe door to the";
		mes "factory is wide open.^000000";
		next;
		switch(select("Enter:Cancel")) {
		case 1:
			warp "kh_dun01",3,230;
			end;
		case 2:
			mes "......";
			mes ".........";
			mes "............";
			close;
		}
	}

	else if (KielHyreQuest >= 106) {
		if (countitem(7509) < 1) {
			mes "^3355FFThe secret entrance";
			mes "has now been sealed.^000000";
			close;
		}
		else {
			mes "As you aproach the";
			mes "grave, it begins to";
			mes "emit flashes of light.^000000";
			next;
			switch(select("Use the ^0000FFLuxurious Keycard^000000:Ignore")) {
			case 1:
				mes "Once you use the";
				mes "Luxurious Keycard,";
				mes "a secret path opens^000000";
				next;
				switch(select("Enter:cancel")) {
				case 1:
					warp "kh_dun01",3,230;
					end;
				case 2:
					mes "......";
					mes ".........";
					mes "............";
					close;
				}
			case 2:
				mes "......";
				mes ".........";
				mes "............";
				close;
			}
		}
	}
}

//============================================================================
//Kiel Hyre Cottage NPCs
//============================================================================

//----------------------------------------------------------------------------
// Cottage Keeper
//----------------------------------------------------------------------------
yuno_fild02,93,210,4	script	Cottage Keeper#kh	85,{
	if ((KielHyreQuest < 12) || (KielHyreQuest > 12)) {
		mes "[Cottage Keeper]";
		mes "This is private property,";
		mes "so please do not enter this";
		mes "area unless you're authorized.";
		close;
	}
	else if (KielHyreQuest == 12) {
		mes "[Cottage Keeper]";
		mes "This is private property,";
		mes "so please do not enter this";
		mes "area unless you're authorized.";
		next;
		switch(select("I have an appointment with Kiel Hyre.:Alright.")) {
		case 1:
			mes "[Cottage Keeper]";
			mes "You have an";
			mes "appointment with";
			mes "Master Kiel Hyre?";
			mes "Um, are you sure?";
			next;
			switch(select("Yes:No")) {
			case 1:
				mes "[Cottage Keeper]";
				mes "There must be some sort";
				mes "of mistake. Mister Hyre";
				mes "wouldn't have left if he";
				mes "was supposed to keep";
				mes "an appointment...";
				set KielHyreQuest,14;
				close;
			case 2:
				mes "[Cottage Keeper]";
				mes "Well unless you have";
				mes "an appointment, I don't";
				mes "think you'll be able to";
				mes "meet with Mister Hyre.";
				close;
			}
		case 2:
			mes "[Cottage Keeper]";
			mes "Goodbye.";
			close;
		}
	}
}

//----------------------------------------------------------------------------
// Cottage Door (left)
//----------------------------------------------------------------------------
yuno_fild02,75,218,0	script	Door#kh2	111,{
	if (KielHyreQuest < 16) {
		mes "^3355FFThis door is locked.";
		mes "If someone inside won't";
		mes "open it for you, then you'll";
		mes "need the right key to unlock it.";
		close;
	}
	if (KielHyreQuest == 16) {
		mes "^3355FFThis door is locked.";
		mes "If someone inside won't";
		mes "open it for you, then you'll";
		mes "need the right key to unlock it.";
		next;
		switch(select("Unlock:Cancel")) {
		case 1:
			mes "^3355FFYou unlock the door with the";
			mes "key that Elly gave you, and";
			mes "as you push it open, a folded";
			mes "note dropped from top of the";
			mes "door. The following words";
			mes "are written on this crude note.";
			next;
			mes "6 Forward,";
			mes "3 Left,";
			mes "3 Forward,";
			mes "4 Left";
			close2;
			set KielHyreQuest,18;
			warp "kh_vila",188,18;
			end;
		case 2:
			mes "......";
			mes ".........";
			mes "............";
			close;
		}
	}
	else {
		mes "^3355FFThe door is open.^000000";
		next;
		switch(select("Enter:Cancel")) {
		case 1:
			warp "kh_vila",188,18;
			end;
		case 2:
			close;
		}
	}
}

//----------------------------------------------------------------------------
// Cottage Door (Right)
//----------------------------------------------------------------------------
yuno_fild02,109,218,0	script	Door#kh1	111,{
	if (KielHyreQuest != 16) {
		mes "^3355FFThis door is locked.";
		mes "If someone inside won't";
		mes "open it for you, then you'll";
		mes "need the right key to unlock it.";
		close;
	}
	if (KielHyreQuest == 16) {
		mes "^3355FFThis door is locked.";
		mes "If someone inside won't";
		mes "open it for you, then you'll";
		mes "need the right key to unlock it.";
		next;
		switch(select("Open:Cancel")) {
		case 1:
			mes "^3355FFYou don't have";
			mes "the key that can";
			mes "unlock this door.^000000";
			close;
		case 2:
			mes "......";
			mes ".........";
			mes "............";
			close;
		}
	}
}


//----------------------------------------------------------------------------
// Store room interior; Wall
//----------------------------------------------------------------------------
kh_vila,191,14,0	script	Wall#kh	139,1,1,{
	if (KielHyreQuest < 28) {
		mes "^3355FFIt's just a wall.";
		mes "It's not particularly";
		mes "standing in your way.^000000";
		close;
	}
	if (KielHyreQuest >= 28) {
		mes "^3355FFThe wall is now";
		mes "open, revealing";
		mes "a secret path.^000000";
		next;
		switch(select("Enter:Cancel")) {
		case 1:
			warp "kh_vila",17,177;
			end;
		case 2:
			close;
		}
	}
}

//----------------------------------------------------------------------------
// Store room interior; books
//----------------------------------------------------------------------------
kh_vila,184,20,0	script	Book#kh1::BookKHQ1	111,{
	if (KielHyreQuest != 26) {
		mes "^3355FFThis bookshelf is^000000";
		mes "^3355FFcrammed with many^000000";
		mes "^3355FFlarge, hardcover books^000000";
		close;
	}
	else if (KielHyreQuest == 26) {
		if (rand(1,10) == 8) {
			mes "^3355FFWithout thinking, you";
			mes "reach for a book from";
			mes "the bookshelf. As you";
			mes "pull it towards you, the";
			mes "wall slides opens open";
			mes "to reveal a secret path.^000000";
			set KielHyreQuest,28;
			specialeffect EF_READYPORTAL2,AREA,"Wall#kh";
			close;
		}
		else {
			mes "^3355FFThis bookshelf is";
			mes "crammed with many";
			mes "large, hardcover books.^000000";
			close;
		}

	}

}
kh_vila,181,20,0	duplicate(BookKHQ1)	Book#kh2	111
kh_vila,178,20,0	duplicate(BookKHQ1)	Book#kh3	111
kh_vila,175,19,0	duplicate(BookKHQ1)	Book#kh4	111

//----------------------------------------------------------------------------
// Store room interior; Letter to Elly on the floor.
//----------------------------------------------------------------------------
kh_vila,179,11,0	script	Letter#kh	-1,1,1,{
//OnTouch2:
OnTouch:
	if (KielHyreQuest == 18) {
		if (checkweight(7490,1) == 0) {
			mes "^3355FFJust a minute...!";
			mes "There's something on";
			mes "the floor here, but you";
			mes "can't pick it up since";
			mes "you're carrying too";
			mes "many items now.^000000";
			close;
		}
		mes "^3355FFYou've found a letter";
		mes "on the floor. Naturally,";
		mes "you pick it up, despite";
		mes "the fact that it's not";
		mes "addressed to you.^000000";
		getitem 7490,1; //Kyll_Hire_Letter
		set KielHyreQuest,20;
		close;
	} 
	else{
		mes "^3355FFYou entered the room.^000000";
		close;
	}
	end; 
}

//----------------------------------------------------------------------------
// Cottage interior, kitchen; Box (Pet Food vending machine)
//----------------------------------------------------------------------------
kh_vila,16,175,0	script	Box#khp1	111,{
	mes "^FFFFFF##^000000*Tasty-Nutricious-Delicious*";
	mes "*Cute Pet Doof Vending Machine*";
	mes "The best food for your Cute Pets";
	mes "that is superior to the Pet Food";
	mes "you can buy in the market!";
	mes "^FFFFFF_^000000";
	mes "Price: 1,100 zeny (cheap!)";
	next;
	switch(select("Buy!:Cancel")) {
	case 1:
		if (Zeny < 1100) {
			mes "^3355FFUnfortunately, you";
			mes "don't have enough";
			mes "zeny to insert into";
			mes "the vending machine.^000000";
			close;
		}
		else {
			mes "^3355FFOh no...!^000000";
			mes "^3355FF1,100 zeny seems kind";
			mes "of expensive for Pet Food,";
			mes "but if it's better than the";
			mes "normal stuff, it might";
			mes "be worth a shot.^000000";
			next;
			mes "^3355FFOh no...!";
			mes "There's nothing";
			mes "special about it";
			mes "at all! It's just";
			mes "normal Pet Food!";
			set Zeny, Zeny-1100;
			getitem 537,1;	//Pet_Food
			close;
		}
	case 2:
		mes "^3355FFThis vending machine";
		mes "seems really shady and";
		mes "suspicious for some reason.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, kitchen; Apple Box (Useless?)
//----------------------------------------------------------------------------
kh_vila,30,184,0	script	Apple Box#khp1	111,{
	mes "^3355FFYou find a box filled with";
	mes "ripe, delicious apples.^000000";
	next;
	switch(select("Take the box:Leave it")) {
	case 1:
		mes "^3355FFNo...! Wait!";
		mes "Something's wrong!";
		mes "Whatever you do,";
		mes "don't take this box!^000000";
		next;
		mes "^3355FFAnd so, your inner";
		mes "voice, your Jungian";
		mes "shadow if you will,";
		mes "prevented you from";
		mes "taking the box.^000000";
		close;
	case 2: 
		mes "^3355FFSomething is wrong";
		mes "with this box of apples.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, dining room; Map
//----------------------------------------------------------------------------
kh_vila,44,126,0	script	Map#khp1	111,{
	if ((KHCottagePoem1 < 2) && (KielHyreQuest < 30)) {
		mes "^3355FFA magnificent world map,";
		mes "detailing the Rune-Midgarts";
		mes "Kingdom, Schwaltzvalt Republic,";
		mes "as well as another country to the";
		mes "west whose name is unfamiliar";
		mes "to you, is pasted to this wall.^000000";
		next;
		mes "^3355FFAs you examine the";
		mes "world map more closely,";
		mes "you find that something has";
		mes "been hidden underneath it.^000000";
		switch(select("Ignore:Examine")) {
		case 1:
			mes "^3355FFWhatever might be";
			mes "hidden beneath this";
			mes "map probably isn't";
			mes "important enough for";
			mes "you to investigate.^000000";
			close;
		case 2:
			mes "^3355FFUnfortunately, you can't";
			mes "see what's under the map";
			mes "since it's pasted to the wall.";
			mes "You'll need to find some";
			mes "way to loosen the glue";
			mes "without damaging the map...^000000";
			set KHCottagePoem1,1;
			close;
		}
	}
	else  if ((KHCottagePoem1 == 2) && (KielHyreQuest < 30)) {
		mes "^3355FFYou bring the pot of";
		mes "steaming hot liquid";
		mes "close to the world map.";
		mes "As the paste on the wall";
		mes "moistens, the map slowly";
		mes "begins to peel back.^000000";
		next;
		mes "^3355FFThe peeling map reveals";
		mes "a folded piece of paper";
		mes "hidden beneath it. You";
		mes "take the paper, and smooth";
		mes "the map out to adhere it to the";
		mes "wall once again. A message is";
		mes "written on the piece of paper.^000000";
		next;
		mes "^0000FFShe will be in a place";
		mes "as cold as the poles.";
		mes "When the well is dried";
		mes "and the earth is cracked,";
		mes "the path to her heart, a";
		mes "heart as transparent as";
		mes "crystal, will be open.^000000";
		next;
		mes "^3355FFI'll have to fight four";
		mes "snakes with four swords";
		mes "to find her. The first sword";
		mes "is love. The second sword";
		mes "is despair. The third sword";
		mes "is rage. The fourth sword is";
		mes "hope. To find her, to rescue her.^000000";
		next;
		mes "^3355FF...............................";
		mes "The deeper meaning";
		mes "of this poem, if it even";
		mes "exists, eludes you.^000000";
		set KHCottagePoem1,3;
		close;
	}
	else  if ((KHCottagePoem1 > 2) || (KielHyreQuest >= 30)) {
		mes "^3355FFThis is were you found";
		mes "the paper on which the";
		mes "poem was written. Perhaps";
		mes "it would be a good idea to";
		mes "refresh your memory and";
		mes "read that poem again.^000000";
		next;
		switch(select("Read:Cancel")) {
		case 1:
			mes "^0000FFShe will be in a place";
			mes "as cold as the poles.";
			mes "When the well is dried";
			mes "and the earth is cracked,";
			mes "the path to her heart, a";
			mes "heart as transparent as";
			mes "crystal, will be open.^000000";
			next;
			mes "^3355FFI'll have to fight four";
			mes "snakes with four swords";
			mes "to find her. The first sword";
			mes "is love. The second sword";
			mes "is despair. The third sword";
			mes "is rage. The fourth sword is";
			mes "hope. To find her, to rescue her.^000000";
			next;
			mes "^3355FF...............................";
			mes "The deeper meaning";
			mes "of this poem, if it even";
			mes "exists, eludes you.^000000";
			close;
		case 2:
			mes "^3355FFThere's no need for";
			mes "you to reread this poem.";
			mes "You're a freakin' genius!^000000";
			close;
		}
	}
}

//----------------------------------------------------------------------------
// Cottage interior, kitchen; Pot
//----------------------------------------------------------------------------
kh_vila,33,184,0	script	Pot#khp1	111,{
	if (KHCottagePoem1 < 1) {
		mes "^3355FFYou've found a pot";
		mes "filled with boiling,";
		mes "steaming liquid.^000000";
		close;
	}
	else if (KHCottagePoem1 == 1) {
		mes "^3355FFYou've found a pot";
		mes "filled with boiling,";
		mes "steaming liquid.";
		mes "Steam... That you could";
		mes "use to loosen the glue on";
		mes "the map... You're a genius!^000000";
		next;
		switch(select("Try it.:That? That won't work!")) {
		case 1:
			mes "^3355FFYou picked up the";
			mes "boiling pot, but";
			mes "slightly burned your";
			mes "hands by accident.";
			set KHCottagePoem1,2;
			close;

		case 2:
			mes "^3355FFNo, no...";
			mes "We'd better try";
			mes "something else.^000000";
			close;
		}
	}
	else if ((KHCottagePoem1 > 1) || (KielHyreQuest >= 30)){
		mes "^3355FFThis is where you";
		mes "picked up the pot filled";
		mes "with steaming hot liquid.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, fire place; Calabash
//----------------------------------------------------------------------------
kh_vila,14,55,0	script	Calabash#khp1	111,{
	if ((countitem(7329) < 1) && (countitem(7516) < 1) && (countitem(7491) < 1) && (KielHyreQuest < 38)) {
		if (checkweight(7329,1) == 0) {
			mes "^3355FFThat's a nice looking";
			mes "calabash. You might even";
			mes "get something from it...";
			mes "But first you better get";
			mes "rid of all your extra weight.";
			mes "And by weight, I mean items.^000000";
			close;
		}
		mes "^3355FFIt's an expensive";
		mes "looking calabash--";
		mes "or in less fancy";
		mes "words, a ''gourd.''";
		mes "Would do you do?^000000";
		next;
		switch(select("Break Open Calabash:Look Inside Calabash:Ignore")) {
		case 1:
			mes "^3355FFYou can't break";
			mes "open that calabash...";
			mes "You're a hero, not a vandal.";
			mes "Now, if this act of vandalism";
			mes "can be considered an act of";
			mes "heroism, then it'd be okay.^000000";
			close;
		case 2:
			mes "^3355FFYou tenderly place";
			mes "your hand into the";
			mes "calabash, and gently";
			mes "feel around with your";
			mes "fingers until you retrieve";
			mes "an Old Bronze Key.^000000";
			getitem 7329,1; //Old_Bronze_Key
			close;
		case 3:
			mes "^3355FFThere's probably";
			mes "nothing inside anyway.^000000";
			close;
		}
	}
	else {
		mes "^3355FFThis is the expensive";
		mes "looking calabash from";
		mes "which you've obtained";
		mes "the Old Bronze Key.";
		mes "It's useless to you now.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, garden; Pool
//----------------------------------------------------------------------------
kh_vila,39,41,0	script	Pool#khp1	111,{
	if ((KHCottagePoem1 < 3) && (KielHyreQuest < 30)) {
		mes "^3355FFYou find a fancy pool";
		mes "filled with fresh water.^000000";
		close;
	}
	else if ((KHCottagePoem1 == 3) && (KielHyreQuest < 30)) {
		mes "^3355FFYou find a fancy pool";
		mes "filled with fresh water,";
		mes "along with a conscpicuous";
		mes "lion statue with two handles.^000000";
		next;
		switch(select("Pull Handles:Cancel")) {
		case 1:
			mes "Which handle would";
			mes "you like to pull first?";
			next;
			switch(select("Right Handle:Left Handle")) {
			case 1:
				mes "^3355FFYou pull the right";
				mes "handle, causing water";
				mes "to gush out of the lion's";
				mes "mouth. It looks pretty cool~^000000";
				close;
			case 2:
				mes "^3355FFAs soon as you pull the";
				mes "left handle, the water in";
				mes "the pool drains away. The";
				mes "pool empties, and you can";
				mes "see a layer of green moss";
				mes "covering the pool's bottom.^000000";
				next;
				switch(select("Ignore:Investigate")) {
				case 1:
					mes "^3355FFYou decide that";
					mes "a pool is little more";
					mes "than a hole without";
					mes "any water to fill it.^000000";
					close;
				case 2:
					mes "^3355FFAs you look through";
					mes "the wet moss at the";
					mes "bottom of the pool,";
					mes "you stumble upon a";
					mes "small, peculiar button.^000000";
					next;
					switch(select("Press button:Don't Press Button")) {
					case 1:
						mes "^3355FFYou press the button,";
						mes "which seems to trigger";
						mes "a strange sound coming";
						mes "from the stairs at the hallway.^000000";
						set KHCottagePoem1,4;
						close;
					case 2:
						mes "^3355FFYou'd better not push";
						mes "this button. Your enemies";
						mes "must have hidden it carefully";
						mes "for you to find: it must be";
						mes "some sort of nefarious trap.^000000";
						close;
					}
				}
			}
		case 2:
			mes "^3355FFYou decided not";
			mes "to pull any handles.^000000";
			close;
		}
	}
	else if ((KHCottagePoem1 > 3) || (KielHyreQuest >= 30)) {
		mes "^3355FFThis is where you pressed";
		mes "the small button that caused";
		mes "some strange sound to come";
		mes "from the stairs near the hallway.";
		close;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, upstairs; Vicious Dog
//----------------------------------------------------------------------------
kh_vila,181,178,4	script	Vicious Dog#khp1	81,7,3,{
//OnTouch2:
OnTouch:
	mes "*Grrr~*";
	next;
	mes "^3355FFAn extremely vicious";
	mes "looking dog is glaring";
	mes "at you. Can you really";
	mes "pass by this creature";
	mes "without getting hurt?^000000";
	next;
	switch(select("March forward:Run away")) {
	case 1:
		if (countitem(537) >= 1) {
			mes "^3355FFWait! Perhaps you can";
			mes "use food to soothe the";
			mes "savage beast. Why don't";
			mes "you feed it some of your Pet";
			mes "Food and see what happens?^000000";
			next;
			switch(select("Give Pet Food:It won't work!")) {
			case 1:
				mes "^3355FFYou gingerly throw the";
				mes "Pet Food towards the dog.";
				mes "Its tail shakes violently as";
				mes "it devours the food. You'd";
				mes "better pass this dog now";
				mes "while you have the chance!^000000";
				delitem 537,1; //Pet_Food
				close2;
				warp "kh_vila",173,182;
				end;
			case 2:
				break;
			}
		}
		mes "^3355FFYou slowly approach";
		mes "the dog, but it won't";
		mes "stop snarling at you.";
		mes "You try to run past the";
		mes "dog, but it blocks all of";
		mes "your moves. What to do?^000000";
		next;
		mes "[Vicious Dog]";
		mes "BOW WOW!";
		mes "BOW WOW!";
		mes "BOW WOW WOW!";
		next;
		mes "^3355FFThe dog chased you";
		mes "downstairs like the";
		mes "suckah chump you are.^000000";
		close2;
		warp "kh_vila",126,70;
		end;
	case 2:
		mes "^3355FFLet's get out of here!^000000";
		close2;
		warp "kh_vila",126,70;
		end;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, upstairs; Drawer, first room nightstand
//----------------------------------------------------------------------------
kh_vila,115,186,0	script	Drawer#khp1	111,{
	if (checkweight(7492,1) == 0) {
		mes "^3355FFThere's something inside";
		mes "this drawer, but you can't";
		mes "take it since you're carrying";
		mes "to many items with you. Maybe";
		mes "you should pay a visit to your";
		mes "trusty Kafra Storage first.^000000";
		close;
	}
	if ((countitem(7492) < 1) && (KielHyreQuest <= 36)) {
		mes "^3355FFYou find an old drawer";
		mes "^that has been closed.";
		mes "^If you open it, then you";
		mes "^might find something";
		mes "^inside. Or could it be";
		mes "^empty. Who knows?^000000";
		next;
		switch(select("Open Drawer:Ignore")) {
		case 1:
			mes "^3355FFYou obtain a Yellow";
			mes "Keycard from inside the";
			mes "drawer. Opening that drawer";
			mes "turned out to be worthwhile.^000000";
			getitem 7492,1; //Yellow_Key_Card
			close;
		case 2:
			mes "^3355FFForget opening that";
			mes "drawer. I mean, come on,";
			mes "what would be the point?^000000";
			close;
		}
	}
	else {
		mes "^3355FFThis is where you";
		mes "found the Yellow Keycard.";
		mes "This drawer is now empty.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, upstairs; Box
//----------------------------------------------------------------------------
kh_vila,107,126,0	script	Box#khp2	111,{
	if ((countitem(7329) < 1) && (countitem(7516) < 1) && (countitem(7491) < 1) && (KielHyreQuest < 38)) {
		mes "^3355FFA solid box is laid";
		mes "on the floor in which";
		mes "a smaller, locked box";
		mes "has been placed inside.^000000";
		close;
	}
	else if ((countitem(7329) >= 1) && (countitem(7516) < 1) && (countitem(7491) < 1) && (KielHyreQuest < 38)) {
		mes "^3355FFA solid box is laid";
		mes "on the floor in which";
		mes "a smaller, locked box";
		mes "has been placed inside.";
		mes "Perhaps you can use your";
		mes "Old Bronze Key to unlock it.^000000";
		next;
		switch(select("Use Old Bronze Key:No, it'll never work.")) {
		case 1:
			mes "^3355FFYour hunch paid off!";
			mes "The Old Bronze Key really";
			mes "did unlock that box! You";
			mes "open the inner box and";
			mes "obtain the Green Keycard";
			mes "that was locked inside.";
			getitem 7516,1; //Green_Key_Card
			delitem 7329,1; //Old_Bronze_Key
			close;
		case 2:
			mes "^3355FFWhat...?";
			mes "What? Using a key";
			mes "to unlock a lock?";
			mes "Come on, that's";
			mes "freakin' crazy talk!^000000";
			close;
		}
	}
	else {
		mes "^3355FFThis is the box from";
		mes "which you've obtained";
		mes "the Green Keycard.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, upstairs; Bookshelf.
//----------------------------------------------------------------------------
kh_vila,181,138,0	script	Bookshelf#khp1	111,{
	if ((countitem(7491) < 1) && (countitem(7329) >= 1) || (countitem(7516) >= 1)) {
		mes "^3355FFOne of the books on";
		mes "this crammed bookshelf";
		mes "is labeled with the note,";
		mes "''To Elly.'' It must have been";
		mes "left behind by her grandfather.^000000";
		next;
		switch(select("Examine Book:Ignore")) {
		case 1:
			mes "^3355FFYou skim through the";
			mes "book's pages, and don't";
			mes "find anything particularly";
			mes "interesting. However, you";
			mes "notice a steel surface behind the";
			mes "shelf as you place the book back.^000000";
			next;
			switch(select("Examine the steel surface:Ignore")) {
			case 1:
				mes "^3355FFYou remove more of the";
				mes "shelf's books to reveal";
				mes "that the steel surface is";
				mes "part of a safe hidden behind";
				mes "the bookshelf. There are two";
				mes "keyholes on the steel safe.^000000";
				next;
				switch(select("Try all your keys:Cancel")) {
				case 1:
					mes "^3355FFWhich key will";
					mes "you insert into";
					mes "the first keyhole?^000000";
					next;
					if (countitem(7329) >= 1) {
						select("Old Bronze Key:Cottage Key");
						mes "^3355FFWhich key will";
						mes "you insert into";
						mes "the second keyhole?^000000";
						next;
						select("Old Bronze Key:Cottage Key");
					}
					else if (countitem(7516) >= 1) {
						switch(select("Green Keycard:Cottage Key")) {
						case 1:
							set .@KHFirstKeyhole,1;
							break;
						case 2:
							set .@KHFirstKeyhole,2;
							break;
						}
						mes "^3355FFWhich key will";
						mes "you insert into";
						mes "the second keyhole?^000000";
						next;
						switch(select("Green Keycard:Cottage Key")) {
						case 1:
							set .@KHSecondKeyhole,1;
							break;

						case 2:
							set .@KHSecondKeyhole,2;
							break;

						}
						if (.@KHFirstKeyhole == 2) && (.@KHSecondKeyhole == 1) {
							mes "^3355FFThe safe opens with";
							mes "a click, and you see";
							mes "a Grey Box inside.";
							mes "You take the Grey Box";
							mes "with you, hoping that it";
							mes "will come in handy later.^000000";
							delitem 7489,1; //Villa_Spare_Key
							delitem 7516,1; //Green_Key_Card
							getitem 7491,1; //Iron_Box
							close;
						}

					}
					mes "^3355FFThe safe won't open.^000000";
					close;
				case 2:
					mes "^3355FFIt's probably a better";
					mes "idea to investigate the";
					mes "cottage for the keys that";
					mes "will open up this safe...^000000";
					close;
				}
			case 2:
				mes "^3355FFYou place the books";
				mes "back on the bookshelf.^000000";
				close;
			}
		case 2:
			mes "^3355FFYou can probably";
			mes "find better clues";
			mes "somewhere else";
			mes "around here.^000000";
			close;
		}
	}
	else {
		mes "^3355FFYou've found a";
		mes "bookshelf that's";
		mes "crammed with books.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, upstairs; Desk
//----------------------------------------------------------------------------
kh_vila,118,144,0	script	Desk#khp1	111,{
	if (KHCottagePoem2 < 1) {
		mes "^3355FFThere are piles of papers";
		mes "and books stacked on top";
		mes "of the desk covering topics";
		mes "like artificial power, Sage";
		mes "Varmundt's research, factory";
		mes "robotization, and magic scrolls...^000000";
		next;
		mes "^3355FFWhile rummaging through";
		mes "the books and papers, you";
		mes "find a piece of paper with";
		mes "the Kiel Hyre Foundation's";
		mes "official seal. You decide that";
		mes "it might come in handy someday.^000000";
		next;
		mes "^3355FFYou've obtained";
		mes "a blank piece of";
		mes "paper with the Kiel";
		mes "Hyre Foundation seal.^000000";
		set KHCottagePoem2,1;
		close;
	}
	else if (KHCottagePoem2 >= 1) {
		mes "^3355FFThere are piles of papers";
		mes "and books, covering various";
		mes "scientific and magic topics,";
		mes "stacked on top of this desk.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Cottage interior, upstairs; Medicine Chest
//----------------------------------------------------------------------------
kh_vila,123,170,0	script	Medicine Chest#khp1	111,{
	if ((KHCottagePoem2 < 1) && (KielHyreQuest < 30)) {
		mes "^3355FFThis medicine cabinet";
		mes "is filled with bottles of";
		mes "various colors. What kind";
		mes "of medicine can be found here?^000000";
		close;
	}
	else if ((KHCottagePoem2 == 1) && (KielHyreQuest < 30)) {
		mes "^3355FFThis medicine cabinet";
		mes "is filled with bottles of";
		mes "various colors. What kind";
		mes "of medicine can be found here?^000000";
		next;
		mes "^3355FFWait, you have a blank piece";
		mes "of paper with the Kiel Hyre";
		mes "Foundation seal! It's strange";
		mes "that the seal was put on a blank";
		mes "piece of paper. Maybe something";
		mes "is written on it with special ink?^000000";
		next;
		mes "^3355FFIt's a crazy hunch, but";
		mes "maybe, just maybe, you can";
		mes "use something inside this";
		mes "medicine cabinet that will";
		mes "reveal any invisible ink";
		mes "written on this document!^000000";
		next;
		switch(select("What? That's crazy!:Of course! Let's try it!")) {
		case 1:
			mes "^3355FFSorry.";
			mes "I thought it";
			mes "was a good idea...^000000";
			close;
		case 2:
			switch(select("Try Red Liquid:Try Blue Liquid:Try Yellow Liquid:Try Green Liquid:Cancel")) {
			case 1:
				set .@KHPotionColor$,"red";
				break;
			case 2:
				mes "^3355FFIt works!";
				mes "The blue liquid is";
				mes "revealing small text";
				mes "written on the paper.";
				mes "It looks like some";
				mes "kind of long poem...^000000";
				next;
				mes "[Poem]";
				mes "The first snake is made of";
				mes "steel, but I used my rage";
				mes "to destroy it. The second";
				mes "snake is made of magic,";
				mes "but my love pierced its heart.";
				next;
				mes "[Poem]";
				mes "The third snake is flesh";
				mes "and blood, but my hope";
				mes "defeated it in the end.";
				mes "However, the fourth and";
				mes "final snake is formless, and";
				mes "no one knows its appearance.";
				next;
				mes "[Poem]";
				mes "I cast my despair to the air,";
				mes "but nobody knows if it killed";
				mes "the snake. I am merely ^0000FFa little";
				mes "lost devil^000000 with four swords and";
				mes "four snakes, searching for that";
				mes "girl in the darkness.";
				next;
				mes "^3355FFThis is a very";
				mes "strange poem. What";
				mes "could it possibly mean?^000000";
				set KHCottagePoem2,2;
				close;
			case 3:
				set .@KHPotionColor$,"yellow";
				break;
			case 4:
				set .@KHPotionColor$,"green";
				break;
			case 5:
				mes "^3355FFNever mind.";
				mes "This idea sounds";
				mes "too crazy to work...";
				mes "like puttting a man";
				mes "on the moon. Can you";
				mes "believe that hogwash?^000000";
				close;
			}
			mes "^3355FFYou tried sprinkling";
			mes "the "+.@KHPotionColor$+" liquid from the";
			mes "medicine cabinet onto";
			mes "the blank paper with the";
			mes "Kiel Hyre Foundation seal.";
			mes "However, nothing happened...^000000";
			close;
		}
	}
	else if ((KHCottagePoem2 >= 2) || (KielHyreQuest >= 30)) {
		mes "^3355FFThis is where you poured";
		mes "some blue liquid to read";
		mes "a poem written in invisible";
		mes "ink on the blank piece of paper";
		mes "with the Kiel Hyre Foundation";
		mes "seal. Would you like read it?^000000";
		next;
		switch(select("No time!:Read")) {
		case 1:
			mes "^3355FFYou're running out of";
			mes "time! For now, it would";
			mes "be best for you to search";
			mes "every inch of this cottage.^000000";
			close;
		case 2:
			mes "[Poem]";
			mes "The first snake is made of";
			mes "steel, but I used my rage";
			mes "to destroy it. The second";
			mes "snake is made of magic,";
			mes "but my love pierced its heart.";
			next;
			mes "[Poem]";
			mes "The third snake is flesh";
			mes "and blood, but my hope";
			mes "defeated it in the end.";
			mes "However, the fourth and";
			mes "final snake is formless, and";
			mes "no one knows it's appearance.";
			next;
			mes "[Poem]";
			mes "I cast my despair to the air,";
			mes "but nobody knows if it killed";
			mes "the snake. I am merely a ^3355FFlittle^000000";
			mes "^3355FFlost devil^000000 with four swords and";
			mes "four snakes, searching for that";
			mes "girl in the darkness.";
			close;

		}
	}
}

//----------------------------------------------------------------------------
// Cottage interior, stair case; Sword hilt
//----------------------------------------------------------------------------
kh_vila,136,68,0	script	Sword Hilt#kh	111,{
	if ((KHCottagePoem1 < 3) || (KHCottagePoem2 < 2) && (KielHyreQuest < 30)) {
		mes "^3355FFThere are four elaborately";
		mes "designed swords positioned";
		mes "next to four creepy looking";
		mes "snake sculptures.^000000";
		close;
	}
	else if ((KHCottagePoem1 <= 4) || (KHCottagePoem2 <= 2) && (KielHyreQuest < 30)) {
		mes "^3355FFThere are four elaborately";
		mes "designed swords positioned";
		mes "next to four creepy looking";
		mes "snake sculptures. Wait!";
		mes "Perhaps they're related to";
		mes "that poem you read earlier...";
		next;
		switch(select("No way!:Of course!")) {
		case 1:
			mes "^3355FFImpossible...";
			mes "It must be some";
			mes "kind of coincidence...^000000";
			close;
		case 2:
			mes "^3355FFOf course! And look!";
			mes "There's a hole on top";
			mes "of the head of each snake";
			mes "sculpture. These holes seem";
			mes "big enough to insert each of";
			mes "the ornamental swords nearby...^000000";
			next;
			switch(select("Ignore:Insert Ornamental Swords")) {
			case 1:
				mes "^3355FFImposible...^000000";
				mes "^3355FFIt must be some^000000";
				mes "^3355FFkind of coincidence...^000000";
				close;
			case 2:
				if (KHCottagePoem1 != 4) {
					mes "^3355FFCan't... Pull out...";
					mes "Sword! It must be";
					mes "locked into place";
					mes "somehow, or sealed";
					mes "by some strange force!^000000";
					close;
				}
				else {
					mes "^3355FFYou should probably";
					mes "try to insert each sword";
					mes "into the correct snake.";
					mes "First, please select the";
					mes "snake in which you will";
					mes "insert the first sword.^000000";
					next;
					switch(select("First Snake:Second Snake:Third Snake:Fourth Snake")) {
					default:
						break;
					case 2:
						set .@KHSwords,.@KHSwords+1;
						break;
					}
					next;
					mes "^3355FFNow, please choose";
					mes "the snake in which you";
					mes "will insert the second sword.^000000";
					next;
					switch(select("First Snake:Second Snake:Third Snake:Fourth Snake")) {
					default:
						break;
					case 4:
						set .@KHSwords,.@KHSwords+1;
						break;
					}
					next;
					mes "^3355FFNext, please select";
					mes "the snake in which you";
					mes "will insert the third sword.^000000";
					next;
					switch(select("First Snake:Second Snake:Third Snake:Fourth Snake")) {
					case 1:
						set .@KHSwords,.@KHSwords+1;
						break;
					default:
						break;
					}
					next;
					mes "^3355FFLastly, please select";
					mes "the snake in which you";
					mes "will insert the fourth sword.^000000";
					next;
					switch(select("First Snake:Second Snake:Third Snake:Fourth Snake")) {
					default:
						break;
					case 3:
						set .@KHSwords,.@KHSwords+1;
						break;
					}

					if (.@KHSwords == 4) {
						mes "^3355FFYour ears are suddenly";
						mes "filled with a low buzzing";
						mes "noise, and your mind";
						mes "and body feel as if they";
						mes "are being swept away...^000000";
						set KHCottagePoem1,5;
						set KHCottagePoem2,3;
						close2;
						warp "kh_vila",178,72;
						end;
					}

					else {
						mes "^3355FFNothing happened...";
						mes "You probably didn't";
						mes "insert the swords into";
						mes "the correct snakes. For now,";
						mes "you should return the swords,";
						mes "and then try this again later.^000000";
						close;
					}
				}
			}
		}
	}
	else if ((KHCottagePoem1 == 5) && (KHCottagePoem2 == 3) || (KielHyreQuest >= 30)) {
		mes "^3355FFHere is a hidden";
		mes "path that leads to";
		mes "the secret laboratory.^000000";
		next;
		switch(select("Enter:Cancel")) {
		case 1:
			warp "kh_vila",178,72;
			end;
		case 2:
			close;
		}
	}
}

//----------------------------------------------------------------------------
// Cottage interior, Secret Room; left test tube
//----------------------------------------------------------------------------
kh_vila,179,68,0	script	Test Tube#khp2	111,{
	mes "^3355FFThis test tube contains";
	mes "a young man dressed in";
	mes "a Kiel Hyre Academy";
	mes "uniform. Somehow, you";
	mes "get the feeling that you've";
	mes "seen him somewhere before.^000000";
	close;
}


//----------------------------------------------------------------------------
// Cottage interior, Secret Room; Right test tube
//----------------------------------------------------------------------------
kh_vila,185,68,0	script	Test Tube::TestTubeKHQ2	111,{
	if (KielHyreQuest > 28) {
		mes "^3355FFA strange looking,";
		mes "wizened old man is";
		mes "held within this test tube.^000000";
		close;
	}
	else if (KielHyreQuest == 28) {
		mes "^3355FFA strange looking,";
		mes "wizened old man is";
		mes "held within this test tube.";
		mes "There is a small red button";
		mes "right underneath the test tube.^000000";
		next;
		switch(select("Press Button:Investigate Further")) {
		case 1:
			mes "[???]";
			mes "H-hello...? C-can you";
			mes "hear me? I don't recognize";
			mes "you... But... Maybe I forgot?";
			mes "Wait, wait. If you're my friend,";
			mes "then you know what to call me,";
			mes "right? Do you know what I am?";
			next;
			input .@KHInput$;
			if (.@KHInput$ == "little lost devil") {
				mes "[???]";
				mes "Heh... Heh heh...";
				mes "He knows... Hey, you";
				mes "have to remember these";
				mes "numbers, okay? D-don't";
				mes "forget, they'll be important...";
				mes "^FF00004^000000, ^FF00007^000000, ^FF00007^000000, ^FF00002^000000, ^FF00009^000000, ^FF00006^000000, ^FF00001^000000. That's all...";
				next;
				mes "^3355FF4772961^000000";
				mes "^3355FFWhat could^000000";
				mes "^3355FFthose numbers^000000";
				mes "^3355FFpossibly mean?^000000";
				//KHCottagePoem1 and KHCottagePoem2 no longer needed-- deleting
				set KHCottagePoem1,0;
				set KHCottagePoem2,0;
				set KielHyreQuest,30;
				close;
			}
			else {
				mes "[???]";
				mes "No... No...";
				mes "That's not right.";
				mes "I don't think we";
				mes "were friends. No...";
				close;
			}
		case 2:
			mes "^3355FFLet's investigate";
			mes "this area a little";
			mes "more first.^000000";
			close;
		}
	}
	else if (KielHyreQuest >= 30) {
		if ((countitem(7491) > 0) && (countitem(7492) > 0)){
			mes "^3355FFWhat could the";
			mes "number 4772961";
			mes "mean? For now, you've";
			mes "found everything that";
			mes "you need from this place,";
			mes "so you should return to Elly.^000000";
			close;
		}
		else {
			mes "^3355FFWhat could the";
			mes "number 4772961";
			mes "mean? For now, you'd";
			mes "better search this cottage";
			mes "for any clues you can find...^000000";
			close;
		}
	}
	end;
}

//============================================================================
// Robot Factory NPCs
//============================================================================

//----------------------------------------------------------------------------
// Robotic's Factory; Heavy Door
//----------------------------------------------------------------------------
kh_dun01,235,48,0	script	Heavy Door#kh1::HeavyDoorKHQ1	111,{
	if (KielHyreQuest < 38) {
		mes "^3355FFThere is a large, heavy";
		mes "door infront of you.^000000";
		next;
		switch(select("Open Door:Cancel")) {
		case 1:
			input .@KHInput$;
			mes "^3355FFYou try to push the";
			mes "door open with all";
			mes "your might, but fail";
			mes "to make it budge.^000000";
			close;
		case 2:
			mes "^3355FFyou decided to leave";
			mes "this door alone until";
			mes "you can figure out";
			mes "how to open it^000000";
			close;
		}
	}
	else if ((KielHyreQuest >= 38) && (KielHyreQuest < 46)) {
		mes "^3355FFThere is a large, heavy";
		mes "door in front of you.^000000";
		next;
		switch(select("Open Door:Cancel")) {
		case 1:
			input .@KHInput$;
			if (.@KHInput$ == "Blue Keycard") {
				mes "^3355FFYou've successfully";
				mes "opened the door.";
				close2;
				warp "kh_school",119,144;
				end;
			}
			else {
				mes "^3355FFYou try to push the";
				mes "door open with all";
				mes "your might, but fail";
				mes "to make it budge.^000000";
				close;
			}
		case 2:
			mes "^3355FFYou decided to leave";
			mes "this door alone until";
			mes "you can figure out";
			mes "how you can open it.^000000";
			close;
		}
	}
	else {
		mes "^3355FFThis is an incredibly";
		mes "heavy door that is tightly";
		mes "closed. You won't be able to";
		mes "open it through brute force.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Robotic's Factory; Heavy Door (These doors don't seem to serve any purpose)
//----------------------------------------------------------------------------
kh_dun01,76,233,0	script	Heavy Door::HeavyDoorKHQ2	111,{
	if ((KielHyreQuest >= 38) && (KielHyreQuest < 46)) {
		mes "^3355FFThere is a large, heavy";
		mes "door infront of you.^000000";
		next;
		switch(select("Open Door:Cancel")) {
		case 1:
			input .@KHInput$;
			mes "^3355FFYou try to push the";
			mes "door open with all";
			mes "your might, but fail";
			mes "to make it budge.^000000";
			close;
		case 2:
			mes "^3355FFyou decided to leave";
			mes "this door alone until";
			mes "you can figure out";
			mes "how to open it^000000";
			close;
		}
	}
	else {
		mes "^3355FFThere is a large, heavy";
		mes "door infront of you^000000";
		close;
	}
}

kh_dun01,106,233,0	duplicate(HeavyDoorKHQ2)	Heavy Door#kh3	111
kh_dun01,6,164,0	duplicate(HeavyDoorKHQ2)	Heavy Door#kh4	111
kh_dun01,6,133,0	duplicate(HeavyDoorKHQ2)	Heavy Door#kh5	111
kh_dun01,6,60,0	duplicate(HeavyDoorKHQ2)	Heavy Door#kh6	111
kh_dun01,6,30,0	duplicate(HeavyDoorKHQ2)	Heavy Door#kh7	111
kh_dun01,6,18,0	duplicate(HeavyDoorKHQ2)	Heavy Door#kh8	111
kh_dun01,235,70,0	duplicate(HeavyDoorKHQ2)	Heavy Door#kh9	111
kh_dun01,235,92,0	duplicate(HeavyDoorKHQ2)	Heavy Door#kh10	111
kh_dun01,235,114,0	duplicate(HeavyDoorKHQ2)	Heavy Door#kh11	111

//----------------------------------------------------------------------------
// Beautiful Lady and Beautiful Lady copies.
//----------------------------------------------------------------------------
kh_school,119,149,4	script	Beautiful Lady#kh1::BeatifulLadyKHQ1	894,{
	cutin "kh_ellisia",2;
	if (KielHyreQuest < 40) {
		mes "[Allysia]";
		mes "Hm? I don't think";
		mes "I know you. Kiel Hyre";
		mes "has only authorized Elly,";
		mes "and a trusted friend that";
		mes "may be helping her, to";
		mes "be admitted to this area.";
		next;
		mes "[Allysia]";
		mes "I cannot see ^FF0000Elly^000000.";
		mes "Has she been attacked as well?";
		mes "Are you ^FF0000Elly's friend^000000?";
		next;
		mes "[Allysia]";
		mes "I don't see Elly anywhere";
		mes "around here. I can only let";
		mes "you enter if you can identify";
		mes "yourself as Elly's friend.";
		mes "Is there anything that you";
		mes "can present to me as proof?";
		next;
		switch(select("Yellow Keycard:Blue Keycard:Golden Key:Carved Button:...?")) {
		default:
			break;
		case 3:
			mes "[Allysia]";
			mes "Ah, isn't this the";
			mes "key that Kiel Hyre gave";
			mes "to Elly? Yes, I'm convinced";
			mes "that you've been helping her.";
			mes "I've been waiting for you, so";
			mes "let me guide you to my room.";
			close2;
			cutin "",255;
			warp "kh_school",120,180;
			end;
		case 4:
			mes "[Allysia]";
			mes "Th-that's Kiehl's";
			mes "seal! Did he send you";
			mes "here to get me?! I'm";
			mes "not taking any chances!";
			close2;
			cutin "",255;
			monster "kh_school",117,144,"Bomb",1745,1;
			monster "kh_school",117,144,"Bomb",1745,1;
			monster "kh_school",117,144,"Bomb",1745,1;
			monster "kh_school",117,144,"Bomb",1745,1;
			end;
		case 5:
			mes "[Allysia]";
			mes "......";
			mes "........";
			mes "...........";
			close2;
			cutin "",255;
			end;
		}
		mes "[Allysia]";
		mes "Hm? This doesn't prove";
		mes "that Elly really trusts you...";
		close2;
		cutin "",255;
		end;
	}
	else if (KielHyreQuest >= 40) {
		mes "[Allysia]";
		mes "Please follow me.";
		close2;
		cutin "",255;
		warp "kh_school",120,180;
		end;
	}
}


kh_school,117,149,4	script	Beautiful lady#kh2::BeatifulLadyKHQ2	894,{
	end;
}
kh_school,118,149,4	duplicate(BeatifulLadyKHQ2)	Beautiful lady#kh3	894
kh_school,120,149,4	duplicate(BeatifulLadyKHQ2)	Beautiful lady#kh4	894
kh_school,121,149,4	duplicate(BeatifulLadyKHQ1)	Beautiful lady#kh5	894

//----------------------------------------------------------------------------
// Beautiful Lady "Allysia"
//----------------------------------------------------------------------------
kh_school,122,186,4	script	Beautiful Lady#kh6	894,{
	if (checkweight(7496,1) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "Inventory space first...^000000";
		close;
	}
	cutin "kh_ellisia",2;
	if (KielHyreQuest < 38) {
		mes "[??????]";
		mes "This is private property.";
		mes "Please leave immediately!";
		close2;
		cutin "kh_ellisia",255;
		warp "yuno_fild08",73,172;
		end;
	}
	else if (KielHyreQuest <= 38) {
		mes "[Allysia]";
		mes "Friend of prototype Elly,";
		mes "I welcome you. As you may";
		mes "have figured out, I need your";
		mes "help. Kiel Hyre is being held";
		mes "somewhere inside this factory.";
		next;
		mes "[Allysia]";
		mes "It is imperative that";
		mes "you search for Kiel Hyre";
		mes "and rescue him as soon";
		mes "as you possibly can!";
		next;
		switch(select("What is this factory?:What happened to ^FF0000Kiel Hyre^000000?")) {
		case 1:
			mes "[Allysia]";
			mes "This factory is part of";
			mes "the Kiel Hyre Foundation's";
			mes "secret business where humanoid";
			mes "robots are manufactured. Myself,";
			mes "and all of the academy's students";
			mes "are actually robots, not humans.";
			next;
			mes "[Allysia]";
			mes "The Kiel Hyre Foundation's";
			mes "ultimate goal is to develop";
			mes "superior robots that will help";
			mes "human society. As robots, we";
			mes "can handle tasks that are too";
			mes "dangerous or difficult for humans.";
			break;
		case 2:
			mes "[Allysia]";
			mes "^3355FFKiehl^000000 has proceeded to";
			mes "perform abnormal modifications";
			mes "to the humanoid robots. This";
			mes "has been reported to Kiel Hyre,";
			mes "who has left to stop Kiehl.";
			mes "However, Hyre hasn't returned.";
			next;
			mes "[Allysia]";
			mes "Fearing that Kiehl would";
			mes "break me, Kiel Hyre brought";
			mes "a copy of me instead. I can still";
			mes "detect Kiel Hyre's heartbeat,";
			mes "so he should be alright, but his";
			mes "own son might harm him soon.";
			next;
			mes "[Allysia]";
			mes "Take this Keycard";
			mes "which will enable you";
			mes "to enter the secret areas";
			mes "inside this factory. If you";
			mes "locate Kiel Hyre, please";
			mes "let me know right away.";
			getitem 7496,1; //Red_Key_Card
			set KielHyreQuest,40;
			break;
		}
		close2;
		cutin "",255;
		end;
	}
	else if (KielHyreQuest == 40) {
		mes "[Allysia]";
		mes "I can still detect";
		mes "Kiel Hyre's heartbeat,";
		mes "but his sone Kiehl might";
		mes "do something desperate to";
		mes "him soon. Please locate Kiel";
		mes "Hyre before that can happen!";
		close2;
		cutin "",255;
		warp "kh_dun01",22,216;
		end;
	}
	else if (KielHyreQuest == 42) {
		mes "[Allysia]";
		mes "Have you already";
		mes "located Kiel Hyre?";
		next;
		mes "^3355FFYou tell Allysia where^000000";
		mes "^3355FFKiel Hyre has been locked^000000";
		mes "^3355FFup, and give her the metal^000000";
		mes "^3355FFfragment that Kiel Hyre handed^000000";
		mes "^3355FFto you. She took fragment^000000";
		mes "^3355FFand wore it around her wrist.^000000";
		next;
		mes "[Allysia]";
		mes "...Kiel Hyre's secret code";
		mes "confirmed. B_2_3 area.";
		mes "Vital signs are normal.";
		mes "Envelope received. Sending";
		mes "modified Puppet Designs...";
		next;
		mes "[Allysia]";
		mes "Alright, I've recieved";
		mes "Kiel Hyre's orders, and";
		mes "must carry them out...";
		delitem 7497,1; //Steel_Piece
		set KielHyreQuest,44;
		close2;
		cutin "",255;
		end;
	}
	else if (KielHyreQuest == 44) {
		mes "[Allysia]";
		mes "Alright, I have a mission";
		mes "to carry out for Kiel Hyre,";
		mes "and I don't have much time.";
		mes "Let me give you some specific";
		mes "instructions very quickly.";
		next;
		mes "[Allysia]";
		mes "Firstly, I need to take your";
		mes "keycards for security reasons.";
		mes "Secondly, meet me at the Kiel";
		mes "Hyre Mansion in Lighthalzen.";
		mes "Present the Golden Key to";
		mes "be admitted to the premises.";
		delitem 7492,1; //Yellow_Key_Card
		delitem 7495,1; //Blue_Key_Card
		delitem 7496,1; //Red_Key_Card
		set KielHyreQuest,46;
		next;
		mes "[Allysia]";
		mes "I understand that this";
		mes "is sudden, and I'm not";
		mes "giving you a thorough";
		mes "explanation, but something";
		mes "horrible will happen if I don't";
		mes "hurry as quickly as possible.";
		close2;
		warp "yuno_fild08",73,172;
		cutin "",255;
		end;
	}
	else if (KielHyreQuest >= 44) {
		mes "[Allysia]";
		mes "I understand that this";
		mes "is sudden, and I'm not";
		mes "giving you a thorough";
		mes "explanation, but something";
		mes "horrible will happen if i don't";
		mes "hurry as quickly as possible.";
		close2;
		warp "yuno_fild08",73,172;
		cutin "",255;
		end;
	}
}

//----------------------------------------------------------------------------
// Signboard (another useless NPC?)
//----------------------------------------------------------------------------
kh_dun01,163,223,4	script	Signboard#kh	857,{
	mes "[Notice]";
	mes "Cute Pets are prohibited";
	mes "in this area. (Cute Pets that";
	mes "provide special assistance";
	mes "to the visually impaired are";
	mes "exempt from this rule.)";
	close;
}

//----------------------------------------------------------------------------
// Mechanical Devices for accessing restricted area
//----------------------------------------------------------------------------
kh_dun01,166,223,0	script	Mechanical Device#kh::KHKeyardReader	111,{
	if ((KielHyreQuest <= 38) || (KielHyreQuest >= 44)) {
		mes "^3355FFYou encounter";
		mes "a mechanical device.";
		mes "It looks like it can be";
		mes "operated by inserting the";
		mes "correct keycard into the slot.^000000";
		close;
	}
	else if ((KielHyreQuest == 40) && (countitem(7496) >= 1)) {
		mes "^3355FFYou encounter";
		mes "a mechanical device.";
		mes "It looks like it can be";
		mes "operated by inserting the";
		mes "correct keycard into the slot.^000000";
		next;
		input .@KHInput$;
		if (.@KHInput$ == "Red Keycard") {
			mes "^3355FFThe door opens once";
			mes "you insert the Red Keycard.^000000";
			close2;
			warp "kh_dun01",170,227;
			end;
		}
		else {
			mes "^3355FFNothing happened.^000000";
			close;
		}
	}
}

kh_dun01,162,206,0	duplicate(KHKeyardReader)	Mechanical Device	111

//----------------------------------------------------------------------------
// Keep monsters out of the quest area.
// Silly really since the rest of it's a dungeon
//----------------------------------------------------------------------------
//kh_dun01,180,220,0	script	Monster Warp#kh1::KHMobWarp	-1,5,20,{
//OnTouchNPC:
//	warp "kh_dun01",178,138;
//	end;
//}

//kh_dun01,190,220,0	duplicate(KHMobWarp)	Monster Warp#kh2	-1,5,20
//kh_dun01,200,250,0	duplicate(KHMobWarp)	Monster Warp#kh3	-1,5,20
//kh_dun01,210,220,0	duplicate(KHMobWarp)	Monster Warp#kh4	-1,5,20
//kh_dun01,220,220,0	duplicate(KHMobWarp)	Monster Warp#kh5	-1,5,10

//----------------------------------------------------------------------------
// Kiel Hyre - OnTouch
//----------------------------------------------------------------------------
kh_dun01,224,233,0	script	Factory B Area Door	-1,5,5,{
//OnTouch2:
OnTouch:
	if (KielHyreQuest == 40) {
		if (checkweight(7497,1) == 0) {
			mes "^3355FFJust a second...";
			mes "You're carrying too";
			mes "many items with you";
			mes "right now, so you'll";
			mes "need to free up more";
			mes "Inventory space first...^000000";
			close;
		}
		mes "^3355FFYou can faintly hear";
		mes "a voice from the other";
		mes "side of this door.^000000";
		next;
		mes "[????]";
		mes "^333333...Kiehl...";
		mes "...How dare you...!^000000";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "Mister Kiel Hyre?";
		mes "Is that you in there?";
		next;
		mes "[Kiel Hyre]";
		mes "Wh-who's there?";
		mes "Identify yourself!";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "I'm... I'm...";
		next;
		mes "^3355FFYou explain your story";
		mes "to the voice behind the";
		mes "door, and tell him what";
		mes "happened to Elly and Allysia.^000000";
		next;
		mes "[Kiel Hyre]";
		mes "^333333...Yes... It's me.";
		mes "I'm Kiel Hyre, trapped";
		mes "in here. He went so far";
		mes "as to modify Elly, eh?";
		mes "...............................^000000";
		next;
		mes "[Kiel Hyre]";
		mes "^333333Hurry, take this";
		mes "module to Allysia!";
		mes "She'll know what to do";
		mes "with it. If you're really";
		mes "helping us, then she'll have";
		mes "some instructions for you too.^000000 ";
		next;
		mes "^3355FFKiel Hyre slid";
		mes "a strange metal";
		mes "fragment through";
		mes "the gap between the";
		mes "door and the floor.^000000";
		getitem 7497,1; //Steel_Piece
		set KielHyreQuest,42;
		close;
	}

	else if (KielHyreQuest >= 42) {
		mes "[Kiel Hyre]";
		mes "......";
		close;
	}
}

//----------------------------------------------------------------------------
// Robot Factory Second Floor Entrances
//----------------------------------------------------------------------------
kh_dun01,44,203,0	script	Entrance Device#khd2::KHAccess	111,{
	if (countitem(7509) < 1) {
		mes "^3355FFYou encounter";
		mes "a mechanical device.";
		mes "It looks like it can be";
		mes "operated by inserting the";
		mes "correct keycard into the slot.^000000";
		close;
	}
	else {
		mes "^3355FFYou encounter";
		mes "a mechanical device.";
		mes "It looks like it can be";
		mes "operated by inserting the";
		mes "correct keycard into the slot.^000000";
		next;
		input .@KHInput$;
		if (.@KHInput$ == "Luxurious Keycard") {
			mes "^3355FFAs you insert the";
			mes "Luxurious Keycard";
			mes "into the keycard slot,";
			mes "the door swings open";
			mes "to reveal a long flight";
			mes "of descending stairs.^000000";
			next;
			switch(select("Descend Stairs:Cancel")) {
			case 1:
				warp "kh_dun02",41,198;
				end;
			case 2:
				mes "^3355FFIt looks like this door";
				mes "has automatically closed";
				mes "after the preprogrammed";
				mes "time limit has elapsed.^000000";
				close;
			}
		}
		else {
			mes "^3355FFYou try to push the";
			mes "door open with all";
			mes "your might, but fail";
			mes "to make it budge.^000000";
			close;
		}
	}
}

kh_dun01,36,195,0	duplicate(KHAccess)	Entrance Device#khd1	111

//============================================================================
// Kiel Hyre Mansion NPCs, and Kiehl's Room NPCs
//============================================================================

//----------------------------------------------------------------------------
// Kiel's Steward
//----------------------------------------------------------------------------
kh_mansion,78,55,5	script	Steward#kh	109,{
	if (KielHyreQuest < 46) {
		mes "[Steward]";
		mes "This is a private residence,";
		mes "please leave.";
		close2;
		warp "lighthalzen",188,201;
		end;
	}
	if ((KielHyreQuest >= 46) && (KielHyreQuest < 50)) {
		mes "[Steward]";
		mes "Greetings.";
		mes "Have you been invited";
		mes "by the master of";
		mes "this mansion?";
		next;
		switch(select("Present Golden Key:????")) {
		case 1:
			mes "[Steward]";
			mes "Ah, Master "+strcharinfo(0)+".";
			mes "I've been expecting your";
			mes "arrival. Please, this way.";
			close2;
			warp "kh_mansion",21,14;
			end;
		case 2:
			mes "[Steward]";
			mes "If you have not been";
			mes "invited by the master of";
			mes "this mansion, then I'm";
			mes "afraid that I must insist on";
			mes "your immediate departure!";
			close2;
			warp "lighthalzen",188,201;
			end;
		}
	}
	if ((KielHyreQuest >= 50) && (KielHyreQuest < 64) || (KielHyreQuest >= 70)) {
		mes "[Steward]";
		mes "Ah, Master "+strcharinfo(0)+".";
		mes "It is a pleasure to";
		mes "receive your company";
		mes "once again. Would you";
		mes "like to see my master?";
		next;
		switch(select("Yes:No")) {
		case 1:
			mes "[Steward]";
			mes "Very well.";
			mes "Right this way~";
			close2;
			warp "kh_mansion",21,14;
			end;
		case 2:
			mes "[Steward]";
			mes "Very well.";
			mes "Please make";
			mes "yourself at home.";
			close;
		}
	}
	if ((KielHyreQuest == 52) || (KielHyreQuest == 54) || (KielHyreQuest >= 64) && (KielHyreQuest <= 70)) {
		mes "[Steward]";
		mes "Ah, Master "+strcharinfo(0)+".";
		mes "It is a pleasure to";
		mes "receive your company";
		mes "once again. Would you";
		mes "like to see my master, or...?";
		next;
		switch(select("^FF0000Kiel Hyre^000000:^3355FFMitchell^000000")) {
		case 1:
			mes "[Steward]";
			mes "Very well.";
			mes "Right this way~";
			close2;
			warp "kh_mansion",21,14;
			end;
		case 2:
			mes "[Steward]";
			mes "Oh...? You must.";
			mes "be here to deliver";
			mes "good news. Excuse me...";
			next;
			mes "^3355FFThe Steward furtively^000000";
			mes "^3355FFlooked around to check^000000";
			mes "^3355FFif anyone is watching him.^000000";
			next;
			mes "[Steward]";
			mes "I believe it should";
			mes "be safe enough to let";
			mes "you go see him now...";
			mes "Please, hurry this way.";
			close2;
			warp "kh_mansion",20,87;
			end;
		}
	}
}

//----------------------------------------------------------------------------
// Kiel Hyre
//----------------------------------------------------------------------------
kh_mansion,22,28,4	script	Kiel Hyre#kh	903,{
	if (checkweight(908,200) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "inventory space first...^000000";
		close;
	}

	cutin "kh_kyel01",2;
	if (KielHyreQuest < 46) {
		mes "[Kiel Hyre]";
		mes ".........";
		mes ".........";
		mes "............";
		close2;
		cutin "",255;
		end;
	}

	else if (KielHyreQuest == 46) {
		cutin "kh_kyel01",2;
		mes "[Kiel Hyre]";
		mes "Ah, you must be "+strcharinfo(0)+".";
		mes "I'd like to thank you for saving";
		mes "my life. You must have many";
		mes "questions to ask me, so I'll";
		mes "do my best to give you answers.";
		next;
		while(1) {
			switch(select("Robots?:^3355FFKiehl^000000?:^FF0000Elly^000000's button?")) {
			case 1:
				mes "[Kiel Hyre]";
				mes "I've been researching";
				mes "robotics for thirty-two";
				mes "years now. I'm proud to";
				mes "say that I've succeeded";
				mes "where the great Sage";
				mes "Varmundt did not.";
				next;
				mes "[Kiel Hyre]";
				mes "It's been my dream to";
				mes "develop humanoid robots";
				mes "from humans. Those Guardians";
				mes "might be robots too, but they";
				mes "don't operate using free will.";
				next;
				mes "[Kiel Hyre]";
				mes "If you'd like to know more";
				mes "of the specifics concerning";
				mes "robotics, why don't you speak";
				mes "with ^3355FFAllysia^000000? She can explain";
				mes "everything much more succinctly";
				mes "than I can. I tend to ramble...";
				set .@KHQRead,.@KHQRead+1;
				next;
				break;
			case 2:
				mes "[Kiel Hyre]";
				mes "^3355FFKiehl^000000 is my only son,";
				mes "but the love of my life";
				mes "died after giving birth to";
				mes "him. I'll admit that he's";
				mes "a genius in mechanical";
				mes "design and development.";
				next;
				mes "[Kiel Hyre]";
				mes "He's largely responsible";
				mes "for the creation of Third";
				mes "Generation robots like Elly.";
				mes "Unfortunately, he's trying to";
				mes "modify his creations for";
				mes "some sinister purpose.";
				next;
				mes "[Kiel Hyre]";
				mes "I tried to stop him,";
				mes "but I ended up getting";
				mes "locked inside the factory.";
				mes "I don't know why he wants";
				mes "to do this. I still have";
				mes "absolutely no clue...";
				set .@KHQRead,.@KHQRead+1;
				next;
				break;
			case 3:
				mes "[Kiel Hyre]";
				mes "That button Elly was";
				mes "holding has ^3355FFKiehl's emblem^000000";
				mes "engraved on it. Ah, and that";
				mes "man in black menacing the";
				mes "students? That was probably";
				mes "^3355FFKaiser^000000, Kiehl's bodyguard.";
				next;
				mes "[Kiel Hyre]";
				mes "Kaiser...";
				mes "I don't know";
				mes "anything about him.";
				mes "I've never even seen";
				mes "his face! Kiehl just hired";
				mes "him without letting me know...";
				set .@KHQRead,.@KHQRead+1;
				next;
				break;
			}
			if (.@KHQRead == 3) {
				mes "[Kiel Hyre]";
				mes "If you don't have";
				mes "anymore questions for me,";
				mes "then would you please";
				mes "let me rest?? I'm still not";
				mes "feeling well from the time";
				mes "I was locked up in the factory.";
				delitem 7493,1; //Golden_Key
				delitem 7494,1; //Kiel_Button
				set KielHyreQuest,48;
				break;
			}
		}
	}
	else if (KielHyreQuest == 48) {
		mes "[Kiel Hyre]";
		mes "Ah, I almost forgot.";
		mes "Please, take this as";
		mes "a little reward for";
		mes "saving my life.";
		getitem 12105,1; //Taming_Gift_Set
		getexp (checkre(3))?70000:700000,0;
		set KielHyreQuest,50;
	}
	else if ((KielHyreQuest >= 50) && (KielHyreQuest < 64)) {
		mes "[Kiel Hyre]";
		mes "If you don't have";
		mes "anymore questions for me,";
		mes "then would you please";
		mes "let me rest?? I'm still not";
		mes "feeling well from the time";
		mes "I was locked up in the factory.";
	}
	else if (KielHyreQuest == 64) {
		cutin "kh_kyel01",2;
		mes "[Kiel Hyre]";
		mes "Hm? Did you";
		mes "have something";
		mes "that you wanted";
		mes "to ask me?";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "I don't have enough";
		mes "concrete evidence yet,";
		mes "but I might have some";
		mes "questions soon enough.";
	}
	else if (KielHyreQuest == 68) {
		cutin "kh_kyel02",2;
		mes "[Kiel Hyre]";
		mes "Ah, "+strcharinfo(0)+".";
		mes "It's you. So how can";
		mes "I help you today?";
		next;
		select("About ^3355FFAllysia^000000...");
		mes "["+strcharinfo(0)+"]";
		mes "You know, I was looking";
		mes "through this deserted house";
		mes "in Juno, and discovered";
		mes "an old portrait of a woman";
		mes "that looks just like Allysia.";
		next;
		cutin "kh_kyel02",2;
		mes "[Kiel Hyre]";
		mes "Oh...";
		mes "Is that all?";
		mes "I thought you had";
		mes "a robotics question.";
		next;
		cutin "kh_Kyel03",2;
		mes "[Kiel Hyre]";
		mes "Anyway, that's a";
		mes "strange coincidence.";
		mes "Well, I suppose it's";
		mes "not so strange to find";
		mes "look-a-likes for other people...";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "I don't think it's just";
		mes "a coincidence. The woman";
		mes "in that thirty year old portrait";
		mes "was also named Allysia, and she";
		mes "worked at Orsimier street";
		mes "in Juno. Does that ring a bell?";
		next;
		cutin "kh_kyel02",2;
		mes "[Kiel Hyre]";
		mes "......";
		mes ".........";
		mes "............";
		next;
		cutin "kh_kyel01",2;
		mes "["+strcharinfo(0)+"]";
		mes "Then I thought that this";
		mes "Allysia must have been the";
		mes "woman that you loved, and";
		mes "that you based your robot's";
		mes "apperance on her.";
		next;
		cutin "kh_kyel02",2;
		mes "[Kiel Hyre]";
		mes "............";
		next;
		cutin "kh_kyel01",2;
		mes "["+strcharinfo(0)+"]";
		mes "I think this is what happened:";
		mes "when you were a young, poor";
		mes "man, you fell in love with";
		mes "Allysia. However, she was";
		mes "in love with Rosimier, who";
		mes "was rich and powerful.";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "However, Rosimier was";
		mes "betrothed to some other";
		mes "woman, and he ended up";
		mes "marrying his fiancee, thus";
		mes "breaking Allysia's heart.";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "Feeling betrayed, her";
		mes "heart broken, Allysia jumped";
		mes "into a river. Then, you decided";
		mes "to get revenge on Rosimier, so";
		mes "you ended up joining";
		mes "Rekenber Corporation!";
		next;
		cutin "kh_Kyel03",2;
		mes "[Kiel Hyre]";
		mes "Hahahahahahaha!";
		mes "Oh, what an imagination~";
		mes "That's very ridiculous...";
		mes "Though, I admit, maybe";
		mes "I did design Allysia after";
		mes "seeing that woman long ago.";
		next;
		mes "[Kiel Hyre]";
		mes "I'd almost forgotten";
		mes "about her! I think we";
		mes "were friends... Though,";
		mes "where did you get the idea";
		mes "that I might have";
		mes "been in love with her?";
		next;
		select("Reveal Kiel's Portrait from Hut");
		cutin "kh_kyel02",2;
		mes "[Kiel Hyre]";
		mes "Wh-what...";
		mes "How did...";
		mes "Where did you...?";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "Kiel Hyre, I found this";
		mes "portrait of you as a young";
		mes "man from the house of the";
		mes "man that bought Allysia's ring.";
		mes "I even spoke to the fisherman";
		mes "that discovered Allysia's body.";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "You paid an awful lot";
		mes "of money to buy Allysia's";
		mes "ring. How can you not tell";
		mes "me that you didn't love her?";
		next;
		cutin "kh_Kyel03",2;
		mes "[Kiel Hyre]";
		mes "*Sigh...*";
		mes "You got me, you got me.";
		mes "I didn't want you to learn";
		mes "the truth. You are correct.";
		mes "I loved Allysia, and designed";
		mes "my robot to look just like her.";
		next;
		mes "[Kiel Hyre]";
		mes "I could never forget her.";
		mes "Ever. But I would never";
		mes "do anything to harm the";
		mes "Rosimiers! I'm a scientist!";
		mes "I hated him when I was young,";
		mes "but things are different now!";
		next;
		mes "[Kiel Hyre]";
		mes "I shed no tears when the";
		mes "Rosimiers fell, but I wasn't";
		mes "responsible. Besides, I didn't";
		mes "have the resources or the";
		mes "capability to cause it...";
		next;
		cutin "kh_kyel02",2;
		mes "["+strcharinfo(0)+"]";
		mes "I'm afraid that the";
		mes "evidence shows otherwise.";
		next;
		select("Reveal Portrait of Rosimiers");
		mes "["+strcharinfo(0)+"]";
		mes "Take a good look";
		mes "at this portrait that";
		mes "I found at the Rosimiers'";
		mes "old house. Do you see";
		mes "anything... incriminating?";
		next;
		cutin "kh_Kyel03",2;
		mes "[Kiel Hyre]";
		mes "Aside from that";
		mes "James Rosimier, you";
		mes "mean? No! I don't see";
		mes "anything wrong with";
		mes "this picture at all.";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "Take a good look";
		mes "at the pocketwatch";
		mes "in the portrait. That's";
		mes "the pocketwatch you";
		mes "wear today, isn't it?";
		next;
		cutin "kh_kyel02",2;
		mes "[Kiel Hyre]";
		mes "...!!!";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "You might not have caused";
		mes "the downfall of the Rosimiers";
		mes "yourself, but with the aid of";
		mes "the Rekenber Corporation, I'd";
		mes "say it was entirely possible!";
		next;
		cutin "kh_Kyel03",2; 
		mes "[Kiel Hyre]";
		mes "Well played, adventurer.";
		mes "Well played. I don't regret";
		mes "what I did: they killed my";
		mes "Allysia! If James didn't betray";
		mes "her, if only he didn't drive";
		mes "her to commit suicide...";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "That's where you're wrong!";
		mes "Allysia was killed, she didn't";
		mes "commit suicide. Take a good";
		mes "look at this note right here!";
		next;
		mes "[Kiel Hyre]";
		mes "What?!";
		next;
		select("Show James's Note");
		mes "[Kiel Hyre]";
		mes "What does this prove?";
		mes "This doesn't show that";
		mes "James didn't betray Allysia.";
		mes "How does this change anything?";
		mes "She's dead, nothing I can do";
		mes "will bring her back to me!";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "I never said James didn't";
		mes "betray her. Look at the date";
		mes "on the note. James made plans";
		mes "to run away with her on August";
		mes "20th. However, her body was";
		mes "found on the same day.";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "Ergo, Allysia must have";
		mes "died on August 19th. If she";
		mes "was planning to run away with";
		mes "her love on the next day, then";
		mes "she had no reason to kill herself!";
		next;
		mes "[Kiel Hyre]";
		mes "No, that's not right!";
		mes "She probably couldn't";
		mes "trust me! She must have";
		mes "realized she was nothing";
		mes "but another toy to him!";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "Oh yeah? I say she jumped";
		mes "into the river because you";
		mes "met her on that day. Now,";
		mes "take a good look at this!";
		next;
		select("Show K.H.'s note");
		mes "["+strcharinfo(0)+"]";
		mes "This note was  written by";
		mes "a man with your initials,";
		mes "K.H. These initials were also";
		mes "signed on her portrait. You";
		mes "must have written this note:";
		mes "there's too many coincidences!";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "According to this note,";
		mes "you told Allysia that you";
		mes "wanted to see her again";
		mes "at the place you first met.";
		mes "I think you did see her again...";
		mes "on August 19th, the day she died!";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "I'm assuming the place you";
		mes "two first met was near the";
		mes "river. No more of your lies:";
		mes "Tell me what really happened!";
		next;
		cutin "kh_kyel02",2;
		mes "[Kiel Hyre]";
		mes "............";
		mes ".........";
		mes "......";
		next;
		cutin "kh_Kyel03",2;
		mes "[Kiel Hyre]";
		mes "Hah... Ha ha ha...";
		mes "Yes... That's right...";
		mes "That horrible night.";
		mes "I remember it well...";
		mes ".....................";
		next;
		cutin "kh_kyel02",2;
		mes "[Kiel Hyre]";
		mes "That night, when she came";
		mes "to the river to meet me as";
		mes "I had asked, I begged her to";
		mes "run away with me, instead";
		mes "of waiting for that James.";
		next;
		mes "[Kiel Hyre]";
		mes "She insisted that James";
		mes "never betrayed her, and he";
		mes "promised to take her away";
		mes "with him the next day. Can";
		mes "you imagine how that made";
		mes "me feel? I was nothing to her.";
		next;
		mes "[Kiel Hyre]";
		mes "My feelings didn't matter to";
		mes "her at all! She kept fidgeting";
		mes "with that ring...I lost control";
		mes "and tried to take that damned";
		mes "thing away from her, and";
		mes "throw it into the river...";
		next;
		mes "[Kiel Hyre]";
		mes "But you know what?";
		mes "She struggled, she actually";
		mes "fought me! It was just a small";
		mes "fight, but then, before I knew";
		mes "it, the ground underneath us";
		mes "collapsed and... the rains...";
		next;
		select(".........");
		mes "[Kiel Hyre]";
		mes "I'm not sure what it";
		mes "was. The rain weakened";
		mes "the ground, something went";
		mes "wrong... and she just... just...";
		mes "The river swallowed her...";
		mes "I felt empty. She was gone. ";
		delitem 7499,1; //Family_Portrait
		delitem 7500,1; //Elysia_Portrait
		delitem 7501,1; //Kyll_Hyre_Letter2
		delitem 7502,1; //Piece_Memo_Of_James
		delitem 7503,1; //Man_Portrait
		set KielHyreQuest,70;
		close2;
		cutin "",255;
		end;
	}
	else if (KielHyreQuest <= 70) {
		cutin "kh_kyel01",2;
		mes "[Kiel Hyre]";
		mes "You already know that";
		mes "she was found dead the";
		mes "next day. But what really";
		mes "broke my heart was that";
		mes "she held that ring so tightly";
		mes "in her hand, even in death...";
		next;
		cutin "kh_kyel03",2;
		mes "[Kiel Hyre]";
		mes "His family had everything";
		mes "while I had nothing. And";
		mes "he had the audacity to take";
		mes "Allysia away from me?!";
		mes "How could that be right?";
		next;
		mes "[Kiel Hyre]";
		mes "Even though she had passed";
		mes "away, I still wanted to prove";
		mes "to Allysia what kind of ugly";
		mes "person James really was.";
		mes "That was when I joined the";
		mes "Rekenber Corporation.";
		next;
		mes "[Kiel Hyre]";
		mes "I designed the very first";
		mes "First Generation Robot, which";
		mes "I named Allysia, and sold the";
		mes "designs to Rekenber. I gave them";
		mes "robots, and they gave me money,";
		mes "power, obedient subordinates.";
		next;
		mes "[Kiel Hyre]";
		mes "Of course I knew they'd use";
		mes "my robots for spying and killing!";
		mes "But you know what? It didn't";
		mes "matter so long as they gave me";
		mes "the means to my revenge. It was";
		mes "the perfect partnership, really.";
		next;
		mes "[Kiel Hyre]";
		mes "You've got me right";
		mes "where you want me.";
		mes "Who are you working";
		mes "for, and what exactly";
		mes "do you want? My designs?";
		mes "My death? Everything...?";
		next;
		cutin "kh_kyel01",2;
		mes "["+strcharinfo(0)+"]";
		mes "Actually, I just want";
		mes "to ask about the nature";
		mes "of your professional";
		mes "relationship with the";
		mes "Rekenber Corporation.";
		mes "And about Kiehl.";
		next;
		mes "[Kiel Hyre]";
		mes "Kiehl, eh? After hearing";
		mes "my crazy story, I'm guessing";
		mes "that you already suspect the";
		mes "truth about him... He's also";
		mes "a robot, specifically the first";
		mes "of the Second Generation models.";
		next;
		mes "[Kiel Hyre]";
		mes "His mind was developed using.";
		mes "an experimental, and unstable,";
		mes "form of the Condensed Magic";
		mes "Spell Scrolls. He was the only";
		mes "Second Generation robot that";
		mes "I was allowed to keep.";
		next;
		mes "[Kiel Hyre]";
		mes "I've become very attached";
		mes "to Kiehl. It's not surprising,";
		mes "seeing that robotics have";
		mes "become my life. I even raised";
		mes "him as my own son, and taught";
		mes "him everything about robotics";
		next;
		mes "[Kiel Hyre]";
		mes "Kiehl is now a genius,";
		mes "and has even developed the";
		mes "Third Generation of robots.";
		mes "Unfortunately, I failed to";
		mes "properly raise him with";
		mes "human morals and ethics.";
		next;
		select("......");
		mes "[Kiel Hyre]";
		mes "He's been transforming";
		mes "the Third Generation robots";
		mes "into killing machines. That's";
		mes "why I tried to put them all";
		mes "into the academy, so they";
		mes "could learn human behavior.";
		next;
		mes "[Kiel Hyre]";
		mes "Although the academy";
		mes "has delayed Kiehl's plans,";
		mes "he has succeeded into";
		mes "converting all of the robots";
		mes "into uncontrollable engines";
		mes "of mass destruction.";
		next;
		mes "[Kiel Hyre]";
		mes "Yes, he's been working";
		mes "closely with Rekenber.";
		mes "Their true objective is to";
		mes "create killing machines";
		mes "for Rekenber's use.";
		next;
		mes "[Kiel Hyre]";
		mes "You know all the secrets";
		mes "of my past now. I'm not";
		mes "upset with you or anything,";
		mes "but I do have something";
		mes "that I want to ask of you.";
		next;
		mes "[Kiel Hyre]";
		mes "Please! Stop Kiehl!";
		mes "I don't want his madness";
		mes "to destroy any more robots!";
		mes "I see each and every one";
		mes "of them as one of my children!";
		next;
		mes "[Kiel Hyre]";
		mes "I know that I must take";
		mes "full responsibility for all";
		mes "that has happened. I promise";
		mes "to take any punishment for";
		mes "my actions once everything";
		mes "has been resolved.";
		next;
		select("Accept:Okay:Nod");
		mes "[Kiel Hyre]";
		mes "Thank you so much!";
		mes "You can find Kiehl";
		mes "in the underground";
		mes "level in this mansion.";
		next;
		mes "[Kiel Hyre]";
		mes "He stays in the old room";
		mes "where he was created, but";
		mes "he reconstructed it as some";
		mes "kind of cave to keep everyone";
		mes "out, including me. Yes, he";
		mes "doesn't trust anyone anymore...";
		next;
		mes "[Kiel Hyre]";
		mes "When you find him, I want";
		mes "you to take Allysia's ring";
		mes "out of his heart. If you";
		mes "remove it, that should stop";
		mes "him from going berserk.";
		next;
		select("Allysia's Ring?");
		mes "[Kiel Hyre]";
		mes "Yes... Her ring is the";
		mes "beginning of everything";
		mes "I put that in his heart so";
		mes "that I'd never forget what";
		mes "the Rosimiers did to me.";
		next;
		mes "[Kiel Hyre]";
		mes "I think Kiehl's grown";
		mes "so powerful that normal";
		mes "weapons might not work";
		mes "on him anymore. Use this";
		mes "device that will cause his";
		mes "power supply to fluctuate.";
		getitem 7504,1; //Toy_Motor
		next;
		cutin "kh_kyel03",2;
		mes "[Kiel Hyre]";
		mes "If you successfully attach";
		mes "this to Kiehl's body, then";
		mes "he won't be able to use his";
		mes "body's full power. While he's";
		mes "weakened, open up his chest";
		mes "and get the ring from his heart.";
		next;
		mes "[Kiel Hyre]";
		mes "Let me know once";
		mes "you're ready. Then, I'll";
		mes "guide you Kiehl's room.";
		set KielHyreQuest,74;
	}
	else if ((KielHyreQuest >= 74) && (KielHyreQuest <= 104)) {
		mes "[Kiel Hyre]";
		mes "Are you ready";
		mes "to confront";
		mes "Kiehl now?";
		next;
		switch(select("Yes:No")) {
		case 1:
			mes "[Kiel Hyre]";
			mes "There... the secret";
			mes "passage is open now.";
			mes "Just go to the right of";
			mes "me, but be careful. Kiehl";
			mes "is extremely dangerous.";
			close2;
			enablenpc "Kiehl_Room_Warp";
			donpcevent "Kiehl_Room_Warp::OnEnable";
			cutin "",255;
			end;
			break;
		case 2:
			mes "[Kiel Hyre]";
			mes "Please take your";
			mes "time. I imagine that";
			mes "it won't be easy.";
			break;
		}
	}
	else if ((KielHyreQuest >= 74) && (KielHyreQuest <= 106)) {
		cutin "kh_kyel01",2;
		mes "[Kiel Hyre]";
		mes "You're back...!";
		mes "So were you able";
		mes "to retrieve Allysia's";
		mes "Ring from Kiehl's heart?";
		next;
		if (countitem(7508) < 1) {
			mes "[Kiel Hyre]";
			mes "You mean... You don't have it?";
			mes "Please, retrieve Allysia's Ring";
			mes "from Kiehl's heart!";
			next;
			enablenpc "Kiehl_Room_Warp";
			donpcevent "Kiehl_Room_Warp::OnEnable";
			close2;
			cutin "",255;
			end;
		}
		mes "[Kiel Hyre]";
		mes "Wh-what happened...?";
		mes "Kiehl developed a new";
		mes "body for himself? Th-that";
		mes "would make him a Fourth";
		mes "Generation robot. I had";
		mes "no idea he was this smart.";
		next;
		mes "[Kiel Hyre]";
		mes "Wait, now that I think about";
		mes "it, I did see robot bodies that";
		mes "looked like Kiehl when I was";
		mes "locked in the factory. So he";
		mes "was using those copies to";
		mes "develop personal upgrades.";
		next;
		mes "[Kiel Hyre]";
		mes "Here, please take this";
		mes "Keycard which will let you";
		mes "enter and investigate the";
		mes "deepest levels of the factory.";
		mes "I'll investigate Kiehl's room.";
		getitem 7509,1; //Fancy_Key_Card
		set KielHyreQuest,108;
		next;
		if (Sex == 0) {
			if (getpartnerid() == 0) set .@KHTitle$,"Miss";
			else set .@KHSTitle$,"Mrs";
		}
		else set .@KHTitle$,"Mr";
		mes "[Kiel Hyre]";
		mes "Kiehl is my responsibility...";
		mes "No matter what the cost may";
		mes "be, I've got to stop him! Oh,";
		mes "and here, please take this";
		mes "with my thanks for all of";
		mes "your help, "+.@KHTitle$+" "+strcharinfo(0)+".";
		getitem 616,1;  //Old Card Album
		delitem 7508,1; //Elysia_Ring
		getexp (checkre(3))?100000:1000000,0;
	}
	else if (KielHyreQuest >= 108) {
		mes "[Kiel Hyre]";
		mes "......";
		mes ".........";
		mes "............";
	}
	close2;
	cutin "",255;
	end;
}


//----------------------------------------------------------------------------
// Allysia
//----------------------------------------------------------------------------
kh_mansion,18,30,4	script	Allysia	894,{
	if (KielHyreQuest < 46) {
		mes "[Allysia]";
		mes "Who are you?";
		mes "How did you get here?";
		mes "Go away";
		close;
	}
	cutin "kh_ellisia",2;
	if (KielHyreQuest < 70) {
		mes "[Allysia]";
		mes "You must be surprised";
		mes "by everything that's been";
		mes "happening. Maybe everything";
		mes "would be easier to understand";
		mes "if I explained about robots?";
		next;
		switch(select("Yes:No")) {
		case 1:
			mes "[Allysia]";
			mes "The robots you've been";
			mes "encountering are automated";
			mes "mechanical puppets that can";
			mes "independantly think and operate.";
			mes "Many sages have tried to develop";
			mes "their own robots, but have failed.";
			next;
			mes "[Allysia]";
			mes "My master, Kiel Hyre, has";
			mes "been studying robotics since";
			mes "he was twenty years old, and";
			mes "has developed three different";
			mes "generations of robots, the first,";
			mes "second, and third generations.";
			next;
			switch(select("First Generation:Second Generation:Third Generation")) {
			case 1:
				mes "[Allysia]";
				mes "I am a good example of one";
				mes "of Kiel Hyre's First Generation";
				mes "robots. I was constructed using";
				mes "a heavy mechanical framework,";
				mes "a robotic heart, and chemically";
				mes "synthesized skin covering.";
				next;
				mes "[Allysia]";
				mes "My central processing unit,";
				mes "equivalent to your brain, is";
				mes "essentially a Memory Scroll";
				mes "based on the design of the";
				mes "Magic Spell Scrolls that you";
				mes "adventurers use in battle.";
				next;
				mes "[Allysia]";
				mes "I'm the oldest type of";
				mes "humanoid robot, so I weigh";
				mes "a lot, and my mind can only";
				mes "process a limited amount of";
				mes "data. Therefore, I can't express";
				mes "emotion similarly to a human.";
				next;
				break;
			case 2:
				mes "[Allysia]";
				mes "The First Generation robots";
				mes "were developed from mostly";
				mes "mechanical parts, but the";
				mes "Second Generation robots";
				mes "incorporated Homunculus";
				mes "science and technology.";
				next;
				mes "[Allysia]";
				mes "Second Generation robots";
				mes "are more life-like since they";
				mes "have artifically created skin";
				mes "and flesh, although they still";
				mes "are constructed from a heavy";
				mes "mechanical framework.";
				next;
				mes "[Allysia]";
				mes "Sage elemental scroll";
				mes "technology was also used";
				mes "to develop the Condensed";
				mes "Memory Scroll, a central";
				mes "processing unit superior to that";
				mes "used in First Generation robots.";
				next;
				mes "[Allysia]";
				mes "Although Condensed Memory";
				mes "Scrolls were 100,000 times";
				mes "more powerful than ordinary";
				mes "Memory Scrolls, they were";
				mes "problematic and were prone";
				mes "to too many error problems.";
				next;
				mes "[Allysia]";
				mes "Second Generation robots";
				mes "were capable of expressing";
				mes "human-like emotion, but their";
				mes "production halted after six";
				mes "years because they were";
				mes "considered faulty.";
				next;
				break;
			case 3:
				mes "[Allysia]";
				mes "Third Generation robots";
				mes "were mostly designed by";
				mes "Kiel Hyre's son, Kiehl,";
				mes "and don't use a mechanical";
				mes "framework at all: the entire";
				mes "body is basically a homunculus.";
				next;
				mes "[Allysia]";
				mes "With their organic bodies";
				mes "and advanced artificial hearts";
				mes "made from imitation Ymir Heart";
				mes "Pieces, they can experience";
				mes "physiologic phenomena";
				mes "just like ordinary humans.";
				next;
				mes "[Allysia]";
				mes "Kiehl was able to develop";
				mes "a more stable form of the";
				mes "Condensed Memory Scroll";
				mes "which does not suffer from";
				mes "critical errors, and can be";
				mes "cheaply mass processed.";
				next;
				mes "[Allysia]";
				mes "Elly is actually a Third";
				mes "Generation prototype. Once";
				mes "we optimize the prototypes,";
				mes "we will begin mass production.";
				mes "In fact, the academy is our";
				mes "prototype testing ground.";
				next;
				mes "[Allysia]";
				mes "The fact that out prototype";
				mes "robots can interact just like";
				mes "real humans is proof of our";
				mes "success in robotics.";
				next;
				break;
			}
		case 2:
			mes "[Allysia]";
			mes "Please let me know if";
			mes "you'd like to learn more";
			mes "about Kiel Hyre's robots.";
			break;
		}
	}
	else {
		mes "[Allysia]";
		mes "......";
		mes ".........";
		mes "............";
	}
	close2;
	cutin "",255;
	end;
}

//----------------------------------------------------------------------------
// Abduction triggering NPC
//----------------------------------------------------------------------------
lighthalzen,188,200,0	script	Abduction_trigger	-1,3,1,{
//OnTouch2:
OnTouch:
	if (KielHyreQuest == 50) {
		mes "^3355FFAs you walked out of";
		mes "the mansion, something";
		mes "smashed the top of your";
		mes "head, and you instantly";
		mes "lose consciousness...";
		close2;
		percentheal -99,0;
		warp "kh_mansion",30,75;
	}
	end;
}

//----------------------------------------------------------------------------
// Mysterious Woman "Mitchell Layla"
//----------------------------------------------------------------------------
kh_mansion,25,79,4	script	Mysterious Woman#kh	727,3,3,{

//OnTouch2:
OnTouch:
	if (KielHyreQuest == 50) {
		mes "^3355FFYou awaken with your";
		mes "head painfully throbbing,";
		mes "and a mysterious woman";
		mes "standing in front of you.^000000";
		next;
		mes "[??????]";
		mes "Hm? Oh, you're awake";
		mes "earlier than I thought.";
		mes "You must feel confused,";
		mes "but listen carefully. If you";
		mes "don't, then I can't guarantee";
		mes "your safety, okay? Alright.";
		next;
		mes "[??????]";
		mes "All you need to know it";
		mes "that I'm a secret agent for";
		mes "the Schwaltzvalt Republic";
		mes "government. We're investigating";
		mes "abnormal activity between Kiel";
		mes "Hyre and the Rekenber Corporation.";
		next;
		mes "[??????]";
		mes "We saw you enter the";
		mes "mansion and speak to";
		mes "Kiel Hyre, so basically";
		mes "you're here for questioning.";
		mes "Now tell me the truth. How";
		mes "do you know Kiel Hyre?";
		next;
		switch(select("I'll tell you everything!:I don't know nuthin'!")) {
		case 2:
			mes "[??????]";
			mes "Don't...know...nuthin'?";
			mes "You sure about that? Only";
			mes "a select few can even speak";
			mes "with Kiel Hyre in person. You";
			mes "must have some connection";
			mes "to him. I'm right, aren't it?";
			next;
			mes "["+strcharinfo(0)+"]";
			mes "......";
			mes ".........";
			mes "............";
			next;
			mes "[??????]";
			mes "Are you trying to protect";
			mes "him? I think that you might";
			mes "not understand what kind of";
			mes "person you're really dealing";
			mes "with here. I'll tell you what";
			mes "I've learned about him...";
			next;
			mes "[??????]";
			mes "Kiel Hyre. CEO of the";
			mes "Kiel Hyre Foundation,";
			mes "manufacturer of various";
			mes "machinery. His company started";
			mes "as a small Einbroch store whose";
			mes "technology slowly grew famous.";
			next;
			mes "[??????]";
			mes "Rekenber Corperation offered";
			mes "a merger with the Kiel Hyre";
			mes "Foundation. We're still not";
			mes "sure why they wanted Kiel";
			mes "Hyre in particular to repair";
			mes "and develop their Guardians...";
			next;
			mes "[??????]";
			mes "We're also not sure why";
			mes "they wanted to suddenly";
			mes "focus more on Guardian";
			mes "development. Then, all";
			mes "of a sudden, Kiel Hyre's son";
			mes "appears from out of nowehre.";
			next;
			mes "[??????]";
			mes "It's very suspicious.";
			mes "There's no records of his";
			mes "birth or anything. Still, maybe";
			mes "Kiel Hyre really did have him";
			mes "with his secretary, Allysia.";
			mes "Well, no one is really sure.";
			next;
			mes "[??????]";
			mes "In any case, Kiel Hyre's";
			mes "son and heir, Kiehl, helped";
			mes "his father establish this";
			mes "special academy as their";
			mes "way of giving back to society.";
			next;
			mes "[??????]";
			mes "Almost every corporation and";
			mes "organization tried to get their";
			mes "spies to enter this academy,";
			mes "but all of them were rejected.";
			mes "it's strange. At least one of";
			mes "them should have made it in.";
			next;
			mes "[??????]";
			mes "And recently, Kiehl Hyre";
			mes "has held a secret meeting with";
			mes "Rekenber executives to announce";
			mes "his new project. He intends to";
			mes "create advanced humanoid robots";
			mes "that will replace guardians!";
			next;
			mes "[??????]";
			mes "Our spies reported that";
			mes "Kiel Hyre was nowhere to";
			mes "be seen at that meeting,";
			mes "as well as his trusted";
			mes "secretary, Allysia. He...";
			mes "He just disappeared!";
			next;
			mes "[??????]";
			mes "Then, Kiel Hyre pops back";
			mes "in his mansion after all";
			mes "this time as if nothing";
			mes "happened! At the same time,";
			mes "Kiehl disappears, under the";
			mes "excuse of conducting research.";
			next;
			mes "[??????]";
			mes "Rekenber is sponsoring";
			mes "both Kiehl and Kiel, but";
			mes "there's some kind of conflict";
			mes "going on between father and";
			mes "son, I just know it! Now tell";
			mes "me, what's going on?";
			next;
			mes "[??????]";
			mes "I'm not sure how well you";
			mes "know this country, but the";
			mes "fact that Rekenber is invoved";
			mes "must tell you that these aren't";
			mes "good people. Tell me what";
			mes "you know about them!";
			next;
		case 1:
			mes "^3355FFYou tell the woman^000000";
			mes "^3355FFeverything you know^000000";
			mes "^3355FFabout Kiel Hyre. Your^000000";
			mes "^3355FFvoice quivers with sadness^000000";
			mes "^3355FFwhenever you mention Elly.^000000";
			next;
			mes "[??????]";
			mes "I see, I see...";
			mes "That poor girl... So...";
			mes "Your involvement in this";
			mes "is a coincidence? In that";
			mes "case, I want your help";
			mes "in our investigation.";
			next;
			switch(select("Okay:......")) {
			case 2:
				mes "[??????]";
				mes "If you don't cooperate,";
				mes "then I can't guarantee";
				mes "your safety, adventurer";
				next;
				mes "["+strcharinfo(0)+"]";
				mes "Huh? What...?";
				mes "What does that mean?";
				mes "Are you threatening me?";
				next;
				select("Just do what she says.");
			case 1:
				mes "[??????]";
				mes "Great.";
				mes "I'm Agent Mitchell Layla.";
				mes "From here on, you're working";
				mes "for the Schwaltzvalt Republic!";
				set KielHyreQuest,52;
				close;
			}
		}
	}
	else if (KielHyreQuest == 52) {
		mes "[Mitchell]";
		mes "I've got some new";
		mes "information for you.";
		mes "There's an old lady in";
		mes "Juno that knew a woman";
		mes "named Allysia 30 years ago.";
		next;
		mes "[Mitchell]";
		mes "The clincher is that this";
		mes "Allysia from 30 years ago";
		mes "commited suicide, and is";
		mes "identical to Kiel Hyre's";
		mes "secretary, who is also";
		mes "named Allysia.";
		next;
		mes "[Mitchell]";
		mes "This is too much of a";
		mes "coincidence. I want you to";
		mes "go to Juno and investigate.";
		mes "When you're done, talk to";
		mes "Kiel Hyre's steward, and";
		mes "he'll send you over to me.";
		next;
		mes "[Mitchell]";
		mes "Yeah, I know.";
		mes "That guy actually";
		mes "works for me. Anyway,";
		mes "when you're ready to go";
		mes "to Juno, let me know, and you";
		mes "can board the federal airship.";
		set KielHyreQuest,54;
		close;
	}
	else if (KielHyreQuest == 54) {
		mes "[Mitchell]";
		mes "Are you ready?";
		mes "I'll let you board";
		mes "the federal Airship so";
		mes "you can get to Juno, and";
		mes "finish your mission quickly.";
		next;
		switch(select("Yes:No")) {
		case 1:
			mes "[Mitchell]";
			mes "Good luck. Once you";
			mes "complete your mission,";
			mes "make sure that you report";
			mes "to Kiel Hyre's steward so";
			mes "that he can send you to me.";
			close2;
			warp "yuno",54,209;
			end;
		case 2:
			mes "[Mitchell]";
			mes "Take your time...";
			mes "But keep in mind that";
			mes "I'm not a patient woman!";
			close;
		}
	}
	else if (KielHyreQuest == 64) {
		mes "[Mitchell]";
		mes "Ah, you're back.";
		mes "What do you have";
		mes "to report from your";
		mes "investigation?";
		next;
		mes "[Mitchell]";
		mes ".....................";
		mes "Ah, I see. Good work.";
		mes "Why don't you go speak to Kiel";
		mes "Hyre and confront him with";
		mes "what you've learned about";
		mes "his past? Yeah, grill him.";
		next;
		mes "[Mitchell]";
		mes "Wear this hidden mic,";
		mes "so we can send help if";
		mes "you're endangered. I want";
		mes "you to find out who Kiel";
		mes "really is, and what's his";
		mes "relationship to Rekenber.";
		set KielHyreQuest,68;
		next;
		warp "kh_mansion",83,50;
		end;
	}
	else if (KielHyreQuest >= 68) {
		mes "[Mitchell]";
		mes "Shouldn't you be";
		mes "leaving about now?";
		next;
		warp "kh_mansion",83,50;
		end;
	}
}

//----------------------------------------------------------------------------
// Warp portal into Kiehl's 'Room'
// - Anyone can enter
// - After 30-40 seonds this NPC should be disabled.
//----------------------------------------------------------------------------
kh_mansion,29,27,0	script	Kiehl_Room_Warp	45,2,2,{
OnTouch:
	warp "kh_kiehl01",10,31;
	end;

OnEnable:
	initnpctimer;
	specialeffect EF_SUMMONSLAVE;
	end;

OnTimer30000:
	stopnpctimer;
	specialeffect EF_SUMMONSLAVE;
	disablenpc "Kiehl_Room_Warp";
	end;

OnInit:
	disablenpc "Kiehl_Room_Warp";
	end;
}

//============================================================================
// Rosimier NPCs and other Related NPCs
//============================================================================

//----------------------------------------------------------------------------
// Odd Grandma
//----------------------------------------------------------------------------
yuno,257,140,4	script	Odd Grandma	846,{
	if (KielHyreQuest < 54) {
		mes "[Grandma]";
		mes "Where did you go,";
		mes "my darling? Where";
		mes "are you, my little dear?";
		close;
	}
	else if (KielHyreQuest == 54) {
		mes "[Grandma]";
		mes "Lullabye...";
		mes "Say goodnight...";
		mes "Hush little baby...";
		mes "Go to sleeeeep~";
		next;
		switch(select("What are you doing?:Um, I don't see a baby...")) {
		case 1:
			mes "[Grandma]";
			mes "Oh? My baby won't stop";
			mes "crying and can't seem";
			mes "to sleep. She needs to";
			mes "rest, so I can go to work.";
			mes "The house is so messy,";
			mes "and the boss is unhappy...";
			set KielHyreQuest,56;
			next;
			select("Um, I don't see a baby...");
			mes "[Grandma]";
			mes "What, she's right--";
			mes "Well. Darling, what";
			mes "are you doing? Don't";
			mes "misbehave in front of";
			mes "our friend! Shhh, be";
			mes "good, my little girl.";
			//GetHEALTHSTATE VAR_CURSE 30
			close;
		case 2:
			mes "[Grandma]";
			mes "What are you...?";
			mes "Oh, look at that.";
			mes "You made my little";
			mes "darling cry! Shhh,";
			mes "hush, little ^0000FFAllysia^000000.";
			mes "Go to sleeeeeeep~";
			close;
		}
	}
	else if ((KielHyreQuest >= 56) && (KielHyreQuest < 60)) {
		mes "[Grandma]";
		mes "Allysia...?!";
		mes "Allysia, where did";
		mes "you go? You were";
		mes "supposed to come";
		mes "home a while ago!";
		if (countitem(7500) < 1) { 
			close;
		}
		else {
			next;
			switch(select("Allysia? Isn't she...")) {
			case 1:
				cutin "kh_ellisia_port",1;
				mes "^3355FFYou show Allysia's";
				mes "portrait to the old woman.^000000";
				next;
				cutin "",255;
				mes "[Grandma]";
				mes "Oh, do you know";
				mes "Allysia? She's been";
				mes "missing! She left home";
				mes "yesterday and hasn't";
				mes "come back! C-can you";
				mes "tell me where she is?!";
				close;
			}
		}
	}
	else if (KielHyreQuest >= 60) {
		mes "[Grandma]";
		mes "Don't worry, Allysia...";
		mes "Mommy will always be";
		mes "here for you. There's no";
		mes "need to be sad...";
		close;
	}
}

//----------------------------------------------------------------------------
// Old Lady; gives you the key to the Rosimier Mansion
//----------------------------------------------------------------------------
yuno,250,132,0	script	Old Lady#kh	711,{
	if (KielHyreQuest < 56) {
		mes "[Old Lady]";
		mes "Oooh, my legs and back";
		mes "are so sore. These old";
		mes "bones ache all over...";
		close;
	}
	else if (KielHyreQuest == 56) {
		if (checkweight(7498,1) == 0) {
			mes "^3355FFJust a second...";
			mes "You're carrying too";
			mes "many items with you";
			mes "right now, so you'll";
			mes "need to free up more";
			mes "Inventory space first...^000000";
			close;
		}
		mes "[Old Lady]";
		mes "Goodness, I hate this";
		mes "weather! Reminds me";
		mes "of how old I've gotten!";
		mes "It chills my bones, it does!";
		next;
		switch(select("......:Do you know that grandma?")) {
		case 1:
			mes "[Old Lady]";
			mes "Damn it! If only I didn't";
			mes "have all those adventures";
			mes "in my youth! Then maybe";
			mes "I wouldn't suffer so in";
			mes "my advanced age!";
			close;
		case 2:
			mes "[Old Lady]";
			mes "Oh... Yes. She was";
			mes "the mother of my best";
			mes "friend, ^3355FFAllysia^000000. Ever since";
			mes "she commited suicide, things";
			mes "haven't been the same. Her";
			mes "mother lost her sanity...";
			next;
			select("Was ^3355FFAllysia^000000...?");
			mes "[Old Lady]";
			mes "Oh, Allysia was such";
			mes "a beautiful girl. So many";
			mes "men wanted her, especially";
			mes "that dashing James Rosimier.";
			mes "I remember hearing that they";
			mes "were going to get married...";
			next;
			mes "[Old Lady]";
			mes "I was so happy for her!";
			mes "But then, all of a sudden,";
			mes "she killed herself. Well,";
			mes "that's what they all say.";
			mes "Even today, I'm still not";
			mes "sure what happened.";
			next;
			select("Wait, who's James Rosimier?");
			mes "[Old Lady]";
			mes "Oh, James belonged to";
			mes "one of the oldest and richest";
			mes "families in Juno. Everything";
			mes "was going great for them, but";
			mes "some time after Allysia died,";
			mes "the family went bankrupt.";
			next;
			mes "[Old Lady]";
			mes "The city manages their";
			mes "old residence now. For";
			mes "some reason, they decided";
			mes "to entrust me with the master";
			mes "key to the Rosimier Mansion.";
			next;
			select("May I borrow the Master Key?");
			mes "[Old Lady]";
			mes "Well, I'm really not";
			mes "supposed to give it to just";
			mes "anyone, but I can tell that";
			mes "you're working with Allysia's";
			mes "best interests at heart.";
			next;
			mes "[Old Lady]";
			mes "However, you've got to";
			mes "make sure that you return";
			mes "it to me before the people";
			mes "from City Hall ask me for it.";
			mes "Alright then, I hope you find";
			mes "what you're looking for.";
			getitem 7498,1; //Rosimier_Key
			set KielHyreQuest,58;
			close;
		}
	}

	else if ((KielHyreQuest == 58) &&
		(countitem(7499) < 1) || 
		(countitem(7500) < 1) || 
		(countitem(7501) < 1) || 
		(countitem(7502) < 1)) {
		mes "[Old Lady]";
		mes "Please hurry and find";
		mes "whatever you're searching";
		mes "for in the Rosimier Mansion.";
		mes "I might get in trouble if";
		mes "the people from City Hall";
		mes "come and ask me for the key...";
		close;
	}

	else if ((KielHyreQuest == 58) &&
		(countitem(7499) == 1) && 
		(countitem(7500) == 1) && 
		(countitem(7501) == 1) && 
		(countitem(7502) == 1)) {
		mes "[Old Lady]";
		mes "Oh, you're finished";
		mes "searching the mansion?";
		mes "Depressing, isn't it?";
		mes "The creditors basically";
		mes "ransacked everything";
		mes "a very long time ago.";
		next;
		select("Why did ^3355FFAllysia^000000...?");
		mes "[Old Lady]";
		mes "Well, I know that James";
		mes "and Allysia were in love,";
		mes "and he promised to marry";
		mes "her. Now, supposedly his";
		mes "family already betrothed";
		mes "him to another woman.";
		next;
		mes "[Old Lady]";
		mes "Time went by, and he";
		mes "was forced to marry his";
		mes "fiancee. Allysia was pretty";
		mes "devastated. I think maybe";
		mes "that's what she... you know...";
		next;
		mes "[Old Lady]";
		mes "Listen, if you want to learn";
		mes "more about what happened,";
		mes "then I think you should talk";
		mes "to the ^3355FFfisherman that lives^000000";
		mes "^3355FFsouth of the Kiel Hyre Academy.^000000";
		next;
		mes "[Old Lady]";
		mes "He's the one that found";
		mes "Allysia's body in the river,";
		mes "so he might have a better";
		mes "idea of what had happened.";
		delitem 7498,1; //Rosimier_Key 
		set KielHyreQuest,60;
		close;
	}
	else if (KielHyreQuest >= 60) {
		mes "[Old Lady]";
		mes "Yep, Rain's coming.";
		mes "Can feel it in my bones.";
		close;
	}
}


//----------------------------------------------------------------------------
// Warp portal into Rosimier Mansion
//----------------------------------------------------------------------------
yuno,273,141,0	script	Rosimmir_Entrance	45,2,2,{
OnTouch:
	if (countitem(7498) < 1) {
		mes "That mansion seems to have";
		mes "been destroyed by the time.";
		mes "However, the door looks like";
		mes "it'd be still operational if";
		mes "you had the right key.";
		close;
	}
	else {
		warp "kh_rossi",20,92;
	}
	end;
}

//----------------------------------------------------------------------------
// Rosimier Mansion, first floor; Table
//----------------------------------------------------------------------------
kh_rossi,23,23,0	script	Table#khr2	111,{
	if (checkweight(7499,1) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "Inventory space first...^000000";
		close;
	}
	if (KielHyreQuest < 58) {
		mes "^3355FFThere's nothing here";
		mes "of importance to you.^000000";
		close;
	}
	else if (KielHyreQuest < 60) {
		if (countitem(7499) < 1) {
			cutin "kh_family_port",1;
			mes "^3355FFYou examine the table,";
			mes "and find a framed portrait";
			mes "inside the open drawer.^000000";
			getitem 7499,1; //Family_Portrait
		}
		else {
			mes "^3355FFThe open drawer of";
			mes "this desk is now empty.^000000";
		}
	}
	else{
		mes "^3355FFThis was the desk in";
		mes "which you obtained the";
		mes "Rosimier family portrait.";
		mes "Its drawers are empty now.^000000";
		close;
	}
	close2;
	cutin "",255;
	end;
}

//----------------------------------------------------------------------------
// Rosimier Mansion, first floor; Shelf
//----------------------------------------------------------------------------
kh_rossi,92,40,0	script	Shelf#khr	111,{
	if (checkweight(7500,1) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "Inventory space first...^000000";
		close;
	}
	if (KielHyreQuest < 58) {
		mes "^3355FFThere's nothing here";
		mes "of importance to you.^000000";
		close;
	}
	else if (KielHyreQuest < 60) {
		if (countitem(7500) < 1) {
			mes "^3355FFThere are locked";
			mes "boxes on these bookshelves.";
			mes "Perhaps if you used this";
			mes "mansions's Master Key, you";
			mes "might be able to open them.^000000";
			next;
			switch(select("Use Key:Pass")) {
			case 1:
				mes "^3355FFWhich box do you";
				mes "want to try to open?^000000";
				next;
				switch(select("First Box:Second Box")) {
				case 1:
					mes "^3355FFYou use the Master Key to";
					mes "unlock the box, and obtain";
					mes "a portait of a woman that";
					mes "looks just like Kiel Hyre's";
					mes "assistant, Allysia.^000000";
					next;
					cutin "kh_ellisia_port",2;
					mes "^3355FFThe message, ''To my love,";
					mes "Allysia. From James.'' is";
					mes "written on the back.^000000";
					getitem 7500,1; //Elysia_Portrait
					close2;
					cutin "",255;
					end;
				case 2:
					mes "^3355FFThis box is empty.^000000";
					close;
				}
			case 2:
				mes "^3355FFThis box is empty.^000000";
				close;
			}
		}
		else {
			mes "^3355FFYou've found a woman's";
			mes "portrait in one of the";
			mes "boxes on this shelf.^000000";
			close;
		}
	}
	else {
		mes "^3355FFYou've found a woman's";
		mes "portrait in one of the";
		mes "boxes on this shelf.";
		mes "This box is now empty.^000000";
		close;
	}
}


//----------------------------------------------------------------------------
// Rosimier Mansion, top floor; Desk
//----------------------------------------------------------------------------
kh_rossi,144,286,0	script	Desk#khr3	111,{
	if (checkweight(7501,1) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "Inventory space first...^000000";
		close;
	}
	if (KielHyreQuest < 58) {
		mes "^3355FFIt's just a desk.^000000";
		close;
	}
	else if (KielHyreQuest < 60) {
		mes "^3355FFThe desk has";
		mes "three drawers.^000000";
		next;
		switch(select("First Drawer:Second Drawer:Third Drawer:Cancel")) {
		case 1:
			mes "^3355FFThe first drawer is locked.^000000";
			close;
		case 2:
			if (countitem(7501) < 1) {
				mes "^3355FFThere is a letter inside";
				mes "this second drawer. It";
				mes "was sent by a person";
				mes "with the initials, K.H.,";
				mes "and addressed to Allysia.^000000";
				getitem 7501,1; //Kyll_Hyre_Letter2
				close;
			}
			else {
				mes "^3355FFThis drawer is now empty.^000000";
				close;
			}
		case 3:
			mes "^3355FFThere is a small note";
			mes "inside this third drawer.";
			mes "It's written by James, and";
			mes "mentions that he wants to";
			mes "marry Allysia, and that she";
			mes "received an engagement ring.^000000";
			close;
		case 4:
			mes "......";
			mes ".........";
			mes "............";
			close;
		}
	}
	else{
		mes "^3355FFThis is the desk where";
		mes "you found a letter written";
		mes "by K.H., and a note scribbled";
		mes "by James Rosimier. Both of";
		mes "these are addressed to";
		mes "the same woman, Allysia.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Rosimier Mansion, top floor; Bookshelf
//----------------------------------------------------------------------------
kh_rossi,148,288,0	script	Bookshelf#khr	111,{
	if (checkweight(7502,1) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "Inventory space first...^000000";
		close;
	}
	if (KielHyreQuest < 58) {
		mes "^3355FFYou encounter a dusty";
		mes "bookshelf filled with";
		mes "numerous books.^000000";
		close;
	}
	else if (KielHyreQuest < 60) {
		if (countitem(7502) < 1) {
			mes "^3355FFYou encounter a dusty";
			mes "bookshelf filled with";
			mes "numerous books. You";
			mes "find a folded note between";
			mes "the books as you examine them.^000000";
			getitem 7502,1; //Piece_Memo_Of_James
			close;
		}
		else {
			mes "^3355FFYou encounter a dusty";
			mes "bookshelf filled with";
			mes "numerous books.^000000";
			close;
		}
	}
	else{
		mes "^3355FFYou encounter a dusty";
		mes "bookshelf filled with";
		mes "numerous books.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Rosimier Mansion, top floor; Bed
//----------------------------------------------------------------------------
kh_rossi,154,286,0	script	Bed#khr	111,{
	if (KielHyreQuest < 58) {
		mes "^3355FFYou found a well made";
		mes "bed that has collected";
		mes "a thick layer of dust";
		mes "after years of disuse.^000000";
		close;
	}
	else if (KielHyreQuest < 60) {
		mes "^3355FFYou found a well made";
		mes "bed that has collected";
		mes "a thick layer of dust";
		mes "after years of disuse.^000000";
		next;
		switch(select("Check Bedsheets:Check Under Bed")) {
		case 1:
			mes "^3355FFYou brush the bed's";
			mes "surface with your hand,";
			mes "causing a cloud of nasty";
			mes "dust to irritate your nose";
			mes "and throat. Eww, yucky!^000000";
			percentheal -10,0;
			close;
		case 2:
			mes "^3355FFYou search underneath";
			mes "the bed, and find an empty";
			mes "engagement ring box.^000000";
			close;
		}
	}
	else {
		mes "^3355FFThis is a dirty bed.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Fisherman
//----------------------------------------------------------------------------
yuno_fild12,232,222,0	script	Old Fisherman	709,{
	if (KielHyreQuest < 60) {
		mes "[Fisherman]";
		mes "These days, it's much";
		mes "harder to catch and fish.";
		mes "Ever since they built";
		mes "this factory, the fish";
		mes "have started to change,";
		mes "and they look different too...";
		close;
	}
	else if (KielHyreQuest == 60) {
		mes "[Fisherman]";
		mes "Eh? You want something?";
		mes "Heh, youngsters! I know";
		mes "how much you love handouts,";
		mes "but you're not getting any.";
		mes "Now, if you bring me some";
		mes "Raw Fish, I'd be more friendly~";
		if (countitem(544) >= 10)  {
			next;
			mes "[Fisherman]";
			mes "Oh, is all this fish";
			mes "for me? Heh, how very";
			mes "generous of you. If you're";
			mes "going to be so kind, then";
			mes "I suppose I have to repay";
			mes "the favor. Ask me anything~";
			next;
			select("30 years ago, a woman killed herself...");
			mes "[Fisherman]";
			mes "Oh? Ohh. Oh yeah.";
			mes "I remember that. Yeah.";
			mes "it was August 20th, my";
			mes "wife's birthday. That day,";
			mes "instead of catching fish,";
			mes "I caught a dead woman.";
			next;
			mes "[Fisherman]";
			mes "Of course, I reported it";
			mes "to the Juno Police!  They told";
			mes "me she killed herself since";
			mes "she was betrayed by her lover,";
			mes "who also happened to be her";
			mes "employer. Really tragic stuff.";
			next;
			mes "[Fisherman]";
			mes "Anyway, when they were";
			mes "moving her body out of the";
			mes "river, her hand dropped";
			mes "some ring. I picked it up,";
			mes "hoping to sell it later for";
			mes "some zeny. I know, I know...";
			next;
			mes "[Fisherman]";
			mes "I was pretty lucky the";
			mes "police didn't see me take";
			mes "it. Later that day, some guy";
			mes "came up to me and offered";
			mes "me a lot of money for it.";
			mes "I guess it was my lucky day!";
			next;
			mes "[Fisherman]";
			mes "I found out later that he was";
			mes "some mechanical repairman--";
			mes "something. He sold everything";
			mes "to buy that ring, so I guess";
			mes "he wanted it desperately.";
			mes "Then he just dissapeared.";
			next;
			select("Do you remember his name?");
			mes "[Fisherman]";
			mes "His name...?";
			mes "It was something like...";
			mes "Heil? Hyre? Anyway, it";
			mes "was a long time ago. Oh,";
			mes "his old house is still around.";
			next;
			mes "[Fisherman]";
			mes "If you're going to be";
			mes "that curious, you might";
			mes "as well check it out.";
			mes "Let's see, he lived in";
			mes "a hut near the northeast";
			mes "forest guard camp.";
			delitem 544,10; //Fish_Slice
			set KielHyreQuest,62;
			close;
		}
		else {
			close;
		}
	}
	else if (KielHyreQuest >= 62) {
		mes "[Fisherman]";
		mes "Don't you remember";
		mes "what I told you? That";
		mes "guy lived in a hut near";
		mes "the northeast forest";
		mes "guard camp! Why don't";
		mes "you check that place out?";
		close;
	}
}

//----------------------------------------------------------------------------
// Kiel Hyre's hut; Wooden Board
//----------------------------------------------------------------------------
yuno_fild09,158,217,0	script	Wooden Board#kh	111,{
	if (checkweight(7503,1) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "Inventory space first...^000000";
		close;
	}
	if ((KielHyreQuest < 62) || (KielHyreQuest >= 64)) {
		mes "^3355FFIt's a useless";
		mes "wooden board";
		mes "in the bushes.^000000";
		close;
	}
	else if (KielHyreQuest == 62) {
		mes "^3355FFYou found a long";
		mes "wooden board carved";
		mes "with the initials, ''K.H.''^000000";
		next;
		cutin "kh_kyel_port",2;
		mes "^3355FFYou find a portrait of";
		mes "a young man, that looks";
		mes "like a younger version";
		mes "of Kiel Hyre, in a broken";
		mes "picture frame underneath";
		mes "the old wooden board.^000000";
		getitem 7503,1;	//Man_Portrait
		set KielHyreQuest,64;
		next;
		cutin "",255;
		mes "^3355FFYou have enough";
		mes "information by now,";
		mes "so you should report";
		mes "back to Mitchell.^000000";
		close;
	}
}

//============================================================================
// Kiehl Hyre's Room and Boss NPCs
//============================================================================
// Beyond here the NPC for the final areas.
// Now, this area is not someplace you wanna slow down so
// you can pick up dialog. I used packet logging to pull
// what I could and for the sake of the two people with me,
// did not bother doing all the proper NPC positioning
// or some of the 'error/wrong option' dialogs.
// All the doors are kind of weird.
//============================================================================

//----------------------------------------------------------------------------
// Kiehl's Room; Receiver (Gives black keycards upon killing mobs)
//----------------------------------------------------------------------------
kh_kiehl01,17,39,0	script	Receiver#kh	111,{
	if (mobcount("kh_kiehl01","Receiver#kh::OnMyMobDead") < 1) {
		mes "^333333*BBBZZZ*^000000";
		if (KielHyreQuest == 74) {
			next;
			mes "[????]";
			mes "^333333*Bzzzz...*";
			mes "I've never seen you";
			mes "before. Did Father send";
			mes "you to kill me? We'll just";
			mes "see about that! Go ahead,";
			mes "try to find me, adventurer.^000000.";
			set KielHyreQuest,76;
		}
		close2;
		monster "kh_kiehl01",16,32,"Alicel",1739,1,"Receiver#kh::OnMyMobDead";
		monster "kh_kiehl01",18,31,"Aliot",1740,1,"Receiver#kh::OnMyMobDead";
		end;
	}

	else {
		end;
	}

OnMyMobDead:
	if (mobcount("kh_kiehl01","Receiver#kh::OnMyMobDead") <1) { 
		makeitem 7506,1,"this",19,36;
	}
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Flower Vase (Gives...password...for Box)
//----------------------------------------------------------------------------
kh_kiehl01,13,40,0	script	Flower Vase#kh1	111,{
	if (KielHyreQuest < 74) {
		mes "^3355FFYou found";
		mes "a flower vase.^000000";
		close;
	}
	if (KielHyreQuest >= 74) {
		mes "^3355FFYou found";
		mes "a flower vase.^000000";
		next;
		switch(select("Pick Up Vase:Break Vase:Turn Vase Upside-down")) {
		case 1:
			mes "^3355FFThe vase is empty.^000000";
			close;
		case 2:
			mes "^3355FFYou can't destroy";
			mes "this vase, even by";
			mes "striking it with all your";
			mes "might. It must have been";
			mes "specially manufactured by";
			mes "the Rekenber Corporation.^000000";
			close;
		case 3:
			mes "^3355FFThe following words";
			mes "are written at the";
			mes "bottom of the vase.^000000";
			next;
			mes "[Vase Message]";
			mes "''The rabbit often";
			mes "observes the door";
			mes "The night eats the";
			mes "pickled orange.''";
			close;
		}
	}
	else{
		mes "^3355FFThe following words";
		mes "are written at the";
		mes "bottom of the vase.^000000";
		next;
		mes "[Vase Message]";
		mes "''The rabbit often";
		mes "observes the door.";
		mes "The night eats the";
		mes "pickled orange.''";
		close;
	}
}


//----------------------------------------------------------------------------
// Kiehl's Room; Box
//----------------------------------------------------------------------------
kh_kiehl01,19,25,0	script	Box#kh1	111,{
	if (checkweight(7505,1) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "Inventory space first...^000000";
		close;
	}
	if (KielHyreQuest < 74) {
		mes "^3355FFYou found a box with";
		mes "a button for each letter";
		mes "of the alphabet on top of it.^000000";
		next;
		input .@KHInput$;
		mes "^3355FFNothing happened.^000000";
		close;
	}
	if (KielHyreQuest >= 74) {
		if (countitem(7505) < 1) {
			mes "^3355FFYou found a box with";
			mes "a button for each letter";
			mes "of the alphabet on top of it.^000000";
			next;
			input .@KHInput$;
			if (.@KHInput$ == "open the door") {
				mes "^3355FFAs soon as you enter the";
				mes "password, the nearby door";
				mes "emits a pleasant chiming";
				mes "sound, and the box pops";
				mes "open to reveal a small key.^000000";
				getitem 7505,1; //Toy_Key
				close;
			}
			else {
				mes "^3355FFNothing happened.^000000";
				close;
			}
		}
		else {
			mes "^3355FFThis is where you";
			mes "found the Toy key^000000";
			close;
		}
	}
	else{
		mes "^3355FFThe box is wide";
		mes "open, and there";
		mes "is nothing in it.^000000";
		close;
	}
}

//----------------------------------------------------------------------------
// Kiehl's Room; Big Door, (First)
// - Anyone can pass through this door
// - Consume one Black KeyCard when opened.
// - Only one person actually needs to open it.
//----------------------------------------------------------------------------
kh_kiehl01,44,33,0	script	Big Door#BigDoorKHQ1	111,{
	if (.KHDoor1Opened == 0) {
		mes "^3355FFThe door is locked,";
		mes "but there is a narrow";
		mes "slot next to the doorknob.^000000";
		next;
		input .@KHInput$;
		if (.@KHInput$ == "Black Keycard") {
			if (countitem(7506) >= 1) {
				mes "^3355FFYou insert the";
				mes "Black Keycard into the";
				mes "slot, and successfully";
				mes "unlock and open the door.^000000";
				delitem 7506,1; //Black_Key_Card
				donpcevent "Big_Door_1_Warp::OnEnable";
				enablenpc "Big_Door_1_Warp";
				set .KHDoor1Opened,1;
				close;
			}

		}
		mes "^3355FFYou try to push the";
		mes "door open with all";
		mes "your might, but fail";
		mes "to make it budge.^000000";
		close;
	}

	else {
		mes "^3355FFThe door is open.^000000";
		close;
	}
}

kh_kiehl01,43,33,0	script	Big_Door_1_Warp	45,1,1,{
OnEnable:
	initnpctimer;
	specialeffect EF_SUMMONSLAVE;
	end;

OnInit:
	disablenpc "Big_Door_1_Warp";
	end;

OnTimer30000:
	stopnpctimer;
	specialeffect EF_SUMMONSLAVE;
	disablenpc "Big_Door_1_Warp";
	set getvariableofnpc(.KHDoor1Opened,"Big Door#BigDoorKHQ1"),0;
	end;

OnTouch:
	warp "kh_kiehl01",55,33;
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Big Door, (second)
// - Consume Toy Key when opened.
// - Only one person actually needs to open it.
//----------------------------------------------------------------------------
kh_kiehl01,174,40,0	script	Big Door#BigDoorKHQ2	111,{
	if (.KHDoor2Opened == 0) {
		mes "^3355FFThe door is locked,";
		mes "but there is a small";
		mes "keyhole next to the knob.^000000";
		next;
		input .@KHInput$;
		if (.@KHInput$ == "Toy Key") {
			if (countitem(7505) >= 1) {
				mes "^3355FFYou insert the key into";
				mes "the keyhole, and the door";
				mes "unlocks with a click as";
				mes "you turn the key.^000000";
				delitem 7505,1; //Toy_Key
				donpcevent "Big_Door_2_Warp::OnEnable";
				enablenpc "Big_Door_2_Warp";
				set .KHDoor2Opened,1;
				close;
			}

		}
		mes "^3355FFYou try to push the";
		mes "door open with all";
		mes "your might, but fail";
		mes "to make it budge.^000000";
		close;
	}
	else {
		mes "^3355FFThe door is open.^000000";
		close;
	}
}

kh_kiehl01,174,39,0	script	Big_Door_2_Warp	45,1,1,{
OnEnable:
	initnpctimer;
	specialeffect EF_SUMMONSLAVE;
	end;

OnInit:
	disablenpc "Big_Door_2_Warp";
	end;

OnTimer30000:
	stopnpctimer;
	specialeffect EF_SUMMONSLAVE;
	disablenpc "Big_Door_2_Warp";
	set getvariableofnpc(.KHDoor2Opened,"Big Door#BigDoorKHQ2"),0;
	end;

OnTouch:
	warp "kh_kiehl01",173,52;
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Big Door, (Third)
// - Consume one Black KeyCard when opened.
// - Only one person actually needs to open it.
//----------------------------------------------------------------------------
kh_kiehl01,77,108,0	script	Big Door#BigDoorKHQ3	111,{
	if (.KHDoor3Opened == 0) {
		mes "^3355FFThe door is locked,";
		mes "but there is a narrow";
		mes "slot next to the doorknob.^000000";
		next;
		input .@KHInput$;
		if (.@KHInput$ == "Black Keycard") {
			if (countitem(7506) >= 1) {
				mes "^3355FFYou insert the";
				mes "Black Keycard into the";
				mes "slot, and successfully";
				mes "unlock and open the door.^000000";
				delitem 7506,1; //Black_Key_Card
				donpcevent "Big_Door_3_Warp::OnEnable";
				enablenpc "Big_Door_3_Warp";
				set .KHDoor3Opened,1;
				close;
			}

		}
		mes "^3355FFYou try to push the";
		mes "door open with all";
		mes "your might, but fail";
		mes "to make it budge.^000000";
		close;
	}
	else {
		mes "^3355FFThe door is open.^000000";
		close;
	}
}

kh_kiehl01,78,108,0	script	Big_Door_3_Warp	45,1,1,{
OnEnable:
	initnpctimer;
	specialeffect EF_SUMMONSLAVE;
	end;

OnInit:
	disablenpc "Big_Door_3_Warp";
	end;

OnTimer30000:
	stopnpctimer;
	specialeffect EF_SUMMONSLAVE;
	disablenpc "Big_Door_3_Warp";
	set getvariableofnpc(.KHDoor3Opened,"Big Door#BigDoorKHQ3"),0;
	end;

OnTouch:
	warp "kh_kiehl01",68,108;
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Big Door, (Fourth)
// - Consume TWO Black KeyCard when opened.
// - Only one person actually needs to open it.
//----------------------------------------------------------------------------
kh_kiehl01,42,177,0	script	Big Door#BigDoorKHQ4	111,{
	if (.KHDoor4Opened == 0) {
		mes "^3355FFThe door is locked,";
		mes "but there is a narrow";
		mes "slot next to the doorknob.^000000";
		next;
		input .@KHInput$;
		if (.@KHInput$ == "Black Keycard") {
			if (countitem(7506) >= 2) {
				mes "^3355FFYou insert the";
				mes "Black Keycard into the";
				mes "slot, and successfully";
				mes "unlock and open the door.^000000";
				delitem 7506,2; //Black_Key_Card
				donpcevent "Big_Door_4_Warp::OnEnable";
				enablenpc "Big_Door_4_Warp";
				set .KHDoor4Opened,1;
				close;
			}
		}
		mes "^3355FFYou try to push the";
		mes "door open with all";
		mes "your might, but fail";
		mes "to make it budge.^000000";
		close;
	}

	else {
		mes "^3355FFThe door is open.^000000";
		close;
	}
}

kh_kiehl01,41,177,0	script	Big_Door_4_Warp	45,1,1,{
OnEnable:
	initnpctimer;
	specialeffect EF_SUMMONSLAVE;
	end;

OnInit:
	disablenpc "Big_Door_4_Warp";
	end;

OnTimer30000:
	stopnpctimer;
	specialeffect EF_SUMMONSLAVE;
	disablenpc "Big_Door_4_Warp";
	set getvariableofnpc(.KHDoor4Opened,"Big Door#BigDoorKHQ4"),0;
	end;

OnTouch:
	warp "kh_kiehl01",49,177;
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Robots
//----------------------------------------------------------------------------
kh_kiehl01,15,179,0	script	Robots#kh1	111,{
	if (mobcount("kh_kiehl01","Robots#kh1::OnMyMobDead") < 1) {
		mes "^3355FFAs soon as you";
		mes "touch the test tube,";
		mes "a bunch of robots";
		mes "suddenly appeared.^000000.";
		close2;
		monster "kh_kiehl01",18,181,"Aliot",1740,1,"Robots#kh1::OnMyMobDead";
		monster "kh_kiehl01",18,180,"Alicel",1739,1,"Robots#kh1::OnMyMobDead";
		monster "kh_kiehl01",18,179,"Aliot",1740,1,"Robots#kh1::OnMyMobDead";
		monster "kh_kiehl01",18,178,"Alicel",1739,1,"Robots#kh1::OnMyMobDead";
		end;
	}
	else  {
		end;
	}

OnMyMobDead:
	if (mobcount("kh_kiehl01","Robots#kh1::OnMyMobDead") < 1) { 
		makeitem 7506,1,"this",18,180;
		}
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Dummy Robots
//----------------------------------------------------------------------------
kh_kiehl01,15,177,0	script	Robots#kh2::RobotsKHQ	111,{
	end;
}
kh_kiehl01,15,180,0	duplicate(RobotsKHQ)	Robots#kh3	111
kh_kiehl01,15,182,0	duplicate(RobotsKHQ)	Robots#kh4	111
kh_kiehl01,35,187,0	duplicate(RobotsKHQ)	Robots#kh5	111
kh_kiehl01,37,187,0	duplicate(RobotsKHQ)	Robots#kh6	111
kh_kiehl01,39,187,0	duplicate(RobotsKHQ)	Robots#kh7	111
kh_kiehl01,41,187,0	duplicate(RobotsKHQ)	Robots#kh8	111

//----------------------------------------------------------------------------
// Kiehl's Room; Big Door, (Fifth, and final)
// - Anyone can pass through this door
// - Consumes 4 Solid Iron Pieces
//----------------------------------------------------------------------------
kh_kiehl01,166,187,0	script	Big Door#BigDoorKHQ5	111,{
	if (($@KHQuestBusy == 0) && (KielHyreQuest >= 74) && (KielHyreQuest <= 106)) {
		if (KielHyreQuest < 86) {
			mes "^3355FFThis large door..";
			mes "is closed shut.";
			mes "If you listen carefully,";
			mes "you can hear the door";
			mes "hinges slightly squeak.^000000";
			next;
			select("Push Door:Kick Door:Shake Door:Pull Door:Lift Door");
			mes "^3355FFA group of monsters";
			mes "suddenly appeared as";
			mes "soon as you applied";
			mes "pressure to the door.";
			mes "This must be some";
			mes "kind of security device.^000000";
			close2;
			set @KHDoorPushAttempt,@KHDoorPushAttempt+1;
			monster "kh_kiehl01",163,183,"Alicel",1739,1;
			monster "kh_kiehl01",163,179,"Aliot",1740,1;
			monster "kh_kiehl01",169,183,"Alicel",1739,1;
			monster "kh_kiehl01",169,179,"Aliot",1740,1;
			if (@KHDoorPushAttempt >= 3) { 
				set KielHyreQuest,86; 
			}
			end;
		}
		else if ((KielHyreQuest > 84) && (KielHyreQuest < 94)) {
			mes "^3355FFYou apply some";
			mes "pressure to the door,";
			mes "and find that you can";
			mes "budge it slightly, but";
			mes "you can't fully open it.^000000";
			next;
			mes "^3355FFIf you wedged something";
			mes "into the gap between the";
			mes "door and its frame, and";
			mes "fully leveraged it, then you";
			mes "should be able to open it.^000000";
			next;
			switch(select("Steel:Rusty Iron Piece:Solid Iron Piece:Iron Piece:Screw:Cancel")) {
			case 1:
				set .@KHPryingItem$,"Steel";
				break;
			case 2:
				set .@KHPryingItem$,"Rusty Iron Piece";
				break;
			case 3:
				if (countitem(7507) >= 1) {
					if (KielHyreQuest < 92) {
						mes "^3355FFYou insert one end of";
						mes "a Solid Iron Piece into the";
						mes "door's gap in a strenuous";
						mes "effort to pry the door open";
						mes "The gap widens a little bit,";
						mes "but you break one of your";
						mes "Solid Iron Pieces.^000000";
						delitem 7507,1; //Hard_Piece_of_Steel
						set KielHyreQuest,KielHyreQuest+2;
						close;
					}
					else if (KielHyreQuest == 92) {
						mes "^3355FFWith a mighty heave,";
						mes "you pry a Solid Iron";
						mes "Piece into the door jamb,";
						mes "and fling the door wide open";
						mes "Unable the withstand the";
						mes "awesome force, this Solid";
						mes "Iron Piece shatters into dust.^000000";
						delitem 7507,1; //Hard_Piece_of_Steel
						set KielHyreQuest,94;
						close;
					}
				}
				else {
					mes "^3355FFIf only you had a Solid";
					mes "Iron Piece you could use to";
					mes "pry open this door.^000000";
					close;
				}
			case 4:
				set .@KHPryingItem$,"Iron Piece";
				break;
			case 5:
				set .@KHPryingItem$,"Screw";
				break;
			case 6:
				mes "^3355FFLet's look for something";
				mes "heavy we can use to pry";
				mes "open this door.^000000";
				close;
			}

			mes "^3355FFThis "+.@KHPryingItem$+" is far";
			mes "to weak for what you're using it for";
			mes "and breaks.^000000";
			close;
		}
		else if ((KielHyreQuest >= 94) && (KielHyreQuest <= 104)) {
			if (.KHDoor5Opened == 0) {
				mes "^3355FFThe large door";
				mes "is wide open, and.";
				mes "you may now enter.^000000";
				next;
				switch(select("Yes:No")) {
				case 1:
					close2;
					donpcevent "Big_Door_5_Warp::OnEnable";
					enablenpc "Big_Door_5_Warp";
					set .KHDoor5Opened,1;
					end;
				case 2:
					mes "^3355FFWho knows what is on the";
					mes "other side of this door. Let's";
					mes "think about it before barging in..^000000";
					close;
				}
			}
			else {
				mes "^3355FFThe door is open.^000000";
				close;
			}
		}
		else {
			mes "^3355FFThis large door..";
			mes "is closed shut.";
			mes "If you listen carefully,";
			mes "you can hear the door";
			mes "hinges slightly squeak.^000000";
			close;
		}
	}
	else {
		mes "^3355FFThis large door..";
		mes "is closed shut.";
		mes "If you listen carefully,";
		mes "you can hear the door";
		mes "hinges slightly squeak.^000000";
		close;
	}
}

kh_kiehl01,166,186,0	script	Big_Door_5_Warp	45,1,1,{
	end;

OnEnable:
	initnpctimer;
	specialeffect EF_SUMMONSLAVE;
	end;

OnTimer30000:
	stopnpctimer;
	specialeffect EF_SUMMONSLAVE;
	disablenpc "Big_Door_5_Warp";
	set getvariableofnpc(.KHDoor5Opened,"Big Door#BigDoorKHQ5"),0;
	end;

OnInit:
	disablenpc "Big_Door_5_Warp";
	end;

OnTouch:
	if (KielHyreQuest >= 46)
		warp "kh_kiehl02",50,7;
	else
		warp "kh_kiehl01",166,183;
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Kiehl_Room_Trap (Entry way trap)
//----------------------------------------------------------------------------
kh_kiehl02,49,10,0	script	Kiehl_Room_Trap	-1,5,3,{
	end;

OnTouch:
	if (.KHTrapSprung < 1) {
		set .KHTrapSprung,1;
		set $@KHQuestBusy,1;
		initnpctimer;
		monster "kh_kiehl02",47,13,"Aliot",1740,1;
		monster "kh_kiehl02",45,13,"Alicel",1739,1;
		monster "kh_kiehl02",49,13,"Constant",1745,1;
		monster "kh_kiehl02",51,13,"Aliot",1740,1;
		monster "kh_kiehl02",53,13,"Alicel",1739,1;
		monster "kh_kiehl02",49,13,"Constant",1745,1;
	}
	end;

OnTimer300000:
OnTimer600000:
OnTimer900000:
	if (getmapusers("kh_kiehl02") == 0) {
		donpcevent "KiehlRoom::OnReset";
		stopnpctimer;
	}
	end;

OnTimer1200000:
	donpcevent "KiehlRoom::OnReset";
	stopnpctimer;
	end;

OnGlobalTimerOff:
	stopnpctimer;
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Kiehl
// - Timer will drop to 3 minutes once Kiehl is defeated.
//----------------------------------------------------------------------------
kh_kiehl02,50,52,4	script	Kiehl#Original	902,{
	if (checkweight(908,200) == 0) {
		mes "^3355FFJust a second...";
		mes "You're carrying too";
		mes "many items with you";
		mes "right now, so you'll";
		mes "need to free up more";
		mes "Inventory space first...^000000";
		close;
	}
	cutin "kh_kiel01",2;
	if ((KielHyreQuest < 94) || (KielHyreQuest >= 106)) {
		mes "[Kiehl]";
		mes "......";
		mes ".........";
		mes "............";
		close2;
		cutin "",255;
		end;
	}
	if ((KielHyreQuest == 94) && (getvariableofnpc(.KHKilled,"KiehlRoom") < 5)) {
		mes "[Kiehl]";
		mes "I'm surprised you made";
		mes "it this far, adventurer~";
		mes "I bid you welcome to my";
		mes "humble room. I assume that";
		mes "you've come for the Condensed";
		mes "Memory Scroll... my mind.";
		next;
		mes "[Kiehl]";
		mes "You can understand";
		mes "why I can't let you have it,";
		mes "so if you really want the";
		mes "Condensed Memory Scroll,";
		mes "then show me what you've got!";
		close2;
		cutin "",255;
		set getvariableofnpc(.KHKilled,"KiehlRoom"),0;
		monster "kh_kiehl02",50,52,"Aliot",1740,1,"KiehlRoom::OnKiehlMobDead";
		monster "kh_kiehl02",50,52,"Alicel",1739,1,"KiehlRoom::OnKiehlMobDead";
		monster "kh_kiehl02",50,52,"Constant",1745,1,"KiehlRoom::OnKiehlMobDead";
		monster "kh_kiehl02",50,52,"Aliot",1740,1,"KiehlRoom::OnKiehlMobDead";
		monster "kh_kiehl02",50,52,"Alicel",1739,1,"KiehlRoom::OnKiehlMobDead";
		monster "kh_kiehl02",50,52,"Constant",1745,1,"KiehlRoom::OnKiehlMobDead";
		monster "kh_kiehl02",50,52,"Aliot",1740,1,"KiehlRoom::OnKiehlMobDead";
		hideonnpc "Kiehl#Original";
		end;
	}
	else if ((KielHyreQuest == 94) && (getvariableofnpc(.KHKilled,"KiehlRoom") >= 5)) {
		cutin "kh_kiel03",2;
		mes "[Kiehl]";
		mes "Hmpf! You're pretty good.";
		mes "Father must have spent";
		mes "a lot of money to hire";
		mes "you. So has he sent";
		mes "you to kill me?";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "Kiel Hyre sent me to ask";
		mes "you to stop turning all of";
		mes "the Third Generation robots";
		mes "into killing machines! How";
		mes "can do something like that";
		mes "to other robots like you?";
		next;
		cutin "kh_kiel01",2;
		mes "[Kiehl]";
		mes "Why not? It's said that man";
		mes "was made in the image of God.";
		mes "Well, robots were made in the";
		mes "image of man. You humans kill";
		mes "each other as much as you";
		mes "like, as far as I can tell.";
		next;
		mes "[Kiehl]";
		mes "It might not be ethical";
		mes "for me to provide weapons";
		mes "to humans that need them...";
		mes "But that's what they are.";
		mes "Weapons. It's more humane";
		mes "for robots to fight than humans.";
		next;
		mes "[Kiehl]";
		mes "Robots don't naturally";
		mes "feel pain or emotions...";
		mes "Not unless they're specially";
		mes "programmed. Sorry, but I don't";
		mes "plans to stop what I'm doing.";
		next;
		cutin "kh_kiel04",2;
		mes "[Kiehl]";
		mes "I am sorry, but I don't have a plan to stop what I am doing.";
		mes "Aside from that, my father showed me a great example of";
		mes "how far a human could go for his own selfinishness by destroying a family.";
		mes "And therefore I don't think that he could create better robots than mine.";
		next;
		mes "["+strcharinfo(0)+"]";
		mes "Humankind may not be";
		mes "perfect, but think about";
		mes "who you're working with!";
		mes "Rekenber is the epitome of";
		mes "human evil! How can you";
		mes "support them like this?";
		next;
		cutin "kh_kiel02",2;
		mes "[Kiehl]";
		mes "I've had a long relationship";
		mes "with Rekenber. I'm fully aware";
		mes "of their capabilities. Do you";
		mes "remember the first room you";
		mes "passed on your way here, the";
		mes "one with all the toys?";
		next;
		mes "[Kiehl]";
		mes "I bet you didn't know that there";
		mes "were 5 Second Generation";
		mes "robots. Me, and my four other";
		mes "brothers and sisters. Father";
		mes "built that room so that all";
		mes "five of us could live together.";
		next;
		cutin "kh_kiel03",2;
		mes "[Kiehl]";
		mes "I was the only one to";
		mes "survive. I returned to";
		mes "Father and even got a";
		mes "name. But yes, I know";
		mes "how bad Rekenber really is...";
		next;
		mes "[Kiehl]";
		mes "I don't... I don't want";
		mes "to talk about this any more.";
		mes "You've made me... Just leave.";
		mes "I think I will let you live.";
		next;
		cutin "",255;
		mes "[Mitchell]";
		mes "Freeze!";
		mes "Kiehl Hyre, you're";
		mes "under arrest for creating";
		mes "and trading illegal weapons!";
		set KielHyreQuest,100;
		hideoffnpc "Mitchell#KiehlRoom";
		hideoffnpc "Agent#KHAgent1";
		hideoffnpc "Agent#KHAgent2";
		hideoffnpc "Agent#KHAgent3";
		hideoffnpc "Agent#KHAgent4";
		next;
	}
	if ((KielHyreQuest == 100) && (getvariableofnpc(.KHKilledBoss,"KiehlRoom") < 1)) {
		set getvariableofnpc(.KHKilledBoss,"KiehlRoom"),0;
		cutin "kh_kiel01",2;
		mes "[Kiehl]";
		mes "Ah, Schwaltzvalt Republic";
		mes "agents. Heh. I haven't had";
		mes "this many guests before.";
		mes "Well, I guess this means";
		mes "we'll have to fight after";
		mes "all, you and I. *Sigh* Pity.";
		next;
		mes "[Kiehl]";
		mes "First, in all fairness,";
		mes "let me take care of these";
		mes "nuisances. They're just";
		mes "mindlessly doing their";
		mes "jobs--sort of like robots-- but";
		mes "don't worry, they won't be hurt.";
		next;
		mes "[Mitchell]";
		mes "Nooooo!";
		specialeffect PF_FOGWALL,AREA,"Mitchell#KiehlRoom";
		specialeffect PF_FOGWALL,AREA,"Agent#KHAgent1";
		specialeffect PF_FOGWALL,AREA,"Agent#KHAgent2";
		specialeffect PF_FOGWALL,AREA,"Agent#KHAgent3";
		specialeffect PF_FOGWALL,AREA,"Agent#KHAgent4";
		next;
		cutin "kh_kiel03",2;
		mes "[Kiehl]";
		mes "And now, you and I can";
		mes "have a proper duel, human.";
		mes "I'm interested in seeing just";
		mes "how strong you really are~";
		close2;
		cutin "",255;
		monster "kh_kiehl02",50,52,"Kiehl",1733,1,"KiehlRoom::OnKiehlDead";
		hideonnpc "Kiehl#Original";
		end;
	}
	else if ((KielHyreQuest == 100) && (getvariableofnpc(.KHKilledBoss,"KiehlRoom") == 1)) {
		cutin "kh_kiel02",2;
		mes "[Kiehl]";
		mes "D-damn...!";
		mes "Well played, adventurer.";
		mes "Well played. I should have";
		mes "known that Father would send";
		mes "the very best after me. Still,";
		mes "you've failed to truly defeat me.";
		next;
		cutin "kh_kiel03",2;
		mes "[Kiehl]";
		mes "I still have a few";
		mes "trump cards left";
		mes "I think... I'll take you";
		mes "to hell with me... Well,";
		mes "if robots can go there~";
		next;
		mapannounce "kh_kiehl02","*Jeeeezzzgggg~ Geezzz~ Grrrr~ Clank~*",bc_map,"0xFF0000";
		mes "[Mitchell]";
		mes "No...! We're locked";
		mes "in the room! We're...";
		mes "We're trapped in here!";
		next;
		mes "[Kiehl]";
		mes "Yay~ Let's burn";
		mes "everything down~";
		next;
		mes "[Mitchell]";
		mes "Quick, "+strcharinfo(0)+",";
		mes "use Kiel Hyre's power";
		mes "device, the one that's";
		mes "supposed to mess with";
		mes "Kiehl's power supply!";
		mes "Hurry, use it right now!";
		next;
		mapannounce "kh_kiehl02","*Gzzzz~ Gzzzz~*",bc_map,"0xFF0000";
		mes "[Kiehl]";
		mes "Wh-what? I c-can't";
		mes "move! This day is just";
		mes "full of surprises. Oh, well.";
		mes "I guess it's time for me to";
		mes "use my other trump card.";
		next;
		mes "[Mitchell]";
		mes "What...?";
		mes "How many trump";
		mes "cards do you have?";
		next;
		mes "[????]";
		mes "I'm so disappointed...";
		mes "I can't believe none";
		mes "of you thought of this.";
		next;
		mes "[Mitchell]";
		mes "Who are you...?";
		mes "Show yourself!";
		next;
		mes "[????]";
		mes "Please.";
		mes "Don't insult me.";
		mes "You know this voice.";
		mes "It's been talking to";
		mes "you this entire time~";
		next;
		mes "[Mitchell]";
		mes "Impossible...";
		mes "How can there";
		mes "be two of you...?!";
		next;
		hideoffnpc "Kiehl#Copy";
		next;
		cutin "kh_kiel01",0;
		mes "[Kiehl]";
		mes "Hahahahaha!";
		mes "I'm a robot!";
		mes "I can make extra";
		mes "bodies, switch brains";
		mes "with them. It's awfully";
		mes "convenient, let me tell you.";
		next;
		cutin "kh_kiel03",2;
		mes "[Kiehl]";
		mes "Anyway, I don't mean to show";
		mes "off, but I suppose I better";
		mes "reveal to you my final trump";
		mes "card. First of all, I know all";
		mes "about you, Ms. Mitchell Layla~";
		next;
		mes "[Mitchell]";
		mes "What? How do you";
		mes "know my name?";
		next;
		mes "[Kiehl]";
		mes "Well, I have a few";
		mes "spies of my own...";
		mes "I'll allow him to explain...";
		next;
		mes "[Masked Man]";
		mes "Mitchell...";
		mes "I'm sorry that";
		mes "you had to get";
		mes "involved in all this...";
		next;
		mes "[Mitchell]";
		mes "Wolkeus? Wolkeus Kaiser?!";
		mes "You're the spy?! But you risked";
		mes "your life to save our president!";
		mes "No! Oh, God! How can this be";
		mes "happening?! Everything's just...";
		mes "This is all crazy! All of it!";
		next;
		mes "[Wolkeus]";
		mes "This is just the result";
		mes "of elaborate plans that";
		mes "were made years ago. I didn't";
		mes "expect you to be this surprised,";
		mes "Mitchell. It's the way the game";
		mes "is played. You know that.";
		next;
		mes "[Mitchell]";
		mes "Mister President...";
		mes "I failed you... I'm sorry...";
		next;
		mes "[Kiehl]";
		mes "Well, Kaiser, she took";
		mes "it pretty badly, but at least";
		mes "you're being gentlemanly";
		mes "about it. Well, I'd like for";
		mes "all of us to get better";
		mes "acquainted, but...";
		next;
		cutin "kh_kiel01",2;
		mes "[Kiehl]";
		mes "We'd better say our";
		mes "farewells here. This";
		mes "place will be gone in";
		mes "five minutes. Ah, and";
		mes "Ms. Layla, you're coming";
		mes "with us. We have questions~";
		next;
		mes "[Kiehl]";
		mes "I'm curious as to what";
		mes "the president's plans are.";
		mes "Mister Kaiser, if you'll";
		mes "escort Ms. Layla, please...";
		next;
		mes "[Wolkeus Kaiser]";
		mes "...............................";
		mes "Sorry, Mitchell.";
		mes "I gotta do it.";
		next;
		mes "[Mitchell]";
		mes "No, get away! Let me go!";
		mes "Let go of me, Wolkeus!";
		hideonnpc "Mitchell#KiehlRoom";
		hideonnpc "Agent#KHAgent1";
		hideonnpc "Agent#KHAgent2";
		hideonnpc "Agent#KHAgent3";
		hideonnpc "Agent#KHAgent4";
		next;
		cutin "kh_kiel02",2;
		mes "[Kiehl]";
		mes "Great, we're done with";
		mes "that ugly business. Now,";
		mes "where was I? Ah, right.";
		mes "Yes. I'm sorry. We don't";
		mes "have any more time to play.";
		next;
		mes "[Kiehl]";
		mes "Here, adventurer.";
		mes "I'm aware that my father";
		mes "sent you here to get this.";
		mes "Consider it my final gift";
		mes "to him. I'm surprised he left";
		mes "this ring inside me, though...";
		next;
		cutin "kh_kiel04",2;
		mes "[Kiehl]";
		mes "I imagine that it must";
		mes "be precious to him. But";
		mes "I wonder why he placed";
		mes "it inside me? Well, anyway,";
		mes "I have a message I'd like";
		mes "for you to deliver to him.";
		next;
		cutin "kh_kiel01",2;
		mes "[Kiehl]";
		mes "First... I guess we";
		mes "should get rid of this";
		mes "old thing. It was a good";
		mes "body, and it's served me";
		mes "well for 23 years. I'll miss";
		mes "it. Rest well, old Kiehl.";
		next;
		specialeffect EF_DEVIL;
		next;
		mes "[Kiehl]";
		mes "Now, this was the body";
		mes "that my father made.";
		mes "Please tell him that";
		mes "this means that we're";
		mes "no longer related to";
		mes "each other at all.";
		next;
		mes "[Kiehl]";
		mes "The body I'm using right now?";
		mes "I made it myself with the most";
		mes "advanced technology. Consider";
		mes "it... a Fourth Generation robot";
		mes "body if you will. Father will";
		mes "understand what I mean.";
		next;
		mes "[Kiehl]";
		mes "Anyway, please tell him";
		mes "that, and get his old ring";
		mes "out of my old robot body,";
		mes "and then give it to him. For";
		mes "now, let's get out of here: we";
		mes "just have 3 minutes to evacuate.";
		next;
		mes "[Kiehl]";
		mes "You're a worthy opponent,";
		mes "and a human I respect.";
		mes "I don't know if we'll meet";
		mes "again, but who knows?";
		mes "Anyway, I'll open up the";
		mes "exit for you. Farewell~";
		delitem 7504,1; //Toy_Motor
		set KielHyreQuest,104;
		hideonnpc "Kiehl#Copy";
		donpcevent "Kiehl_Room_Exit::OnEnable";
		enablenpc "Kiehl_Room_Exit";
		initnpctimer;
		cutin "",255;
		close;
	}
	if (KielHyreQuest == 104) {
		cutin "kh_kiel02",2;
		mes "^3355FFYou retrieve the";
		mes "ring from the heart of";
		mes "Kiehl's old robotic body.^000000";
		getitem 7508,1; //Elysia_Ring
		set KielHyreQuest,106;
		close2;
		cutin "",255;
		end;
	}
	else{
		cutin "kh_kiel02",2;
		mes "^3355FFKiehl's old";
		mes "robotic body";
		mes "stands alone,";
		mes "lifeless and silent.^000000";
		close2;
		cutin "",255;
		end;
	}


OnTimer180000:
	stopnpctimer;
	mapannounce "kh_kiehl02","Beeeeeeeeeeeeep~",bc_npc,0xFF0000;
	donpcevent "KiehlRoom::OnReset";
	end;

OnTimer179000:
	mapannounce "kh_kiehl02","1 second remaining until detonation",bc_npc,0xFF0000;
	end;

OnTimer178000:
	mapannounce "kh_kiehl02","2 seconds remaining until detonation",bc_npc,0xFF0000;
	end;

OnTimer177000:
	mapannounce "kh_kiehl02","3 seconds remaining until detonation",bc_npc,0xFF0000;
	end;

OnTimer176000:
	mapannounce "kh_kiehl02","4 seconds remaining until detonation",bc_npc,0xFF0000;
	end;

OnTimer175000:
	mapannounce "kh_kiehl02","5 seconds remaining until detonation",bc_npc,0xFF0000;
	end;

OnTimer170000:
	mapannounce "kh_kiehl02","10 seconds remaining until detonation",bc_npc,0xFF0000;
	end;

OnTimer160000:
	mapannounce "kh_kiehl02","20 seconds remaining until detonation",bc_npc,0xFF0000;
	end;

OnTimer150000:
	mapannounce "kh_kiehl02","30 seconds remaining until detonation",bc_npc,0xFF0000;
	end;

OnTimer120000:
	mapannounce "kh_kiehl02","1 minute remaining until detonation.",bc_npc,0xFF0000;
	end;

OnTimer60000:
	mapannounce "kh_kiehl02","2 minutes remaining until detonation.",bc_npc,0xFF0000;
	end;

OnTimer1000:
	mapannounce "kh_kiehl02","3 minutes remaining until detonation.",bc_npc,0xFF0000;
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; NPC for mob control, timers, and other junk.
//----------------------------------------------------------------------------
kh_kiehl02,1,1,0	script	KiehlRoom	-1,{
	end;

OnKiehlMobDead:
	set .KHKilled,.KHKilled+1;
	if (.KHKilled == 5) { 
		hideoffnpc "Kiehl#Original"; 
	}
	end;

OnKiehlDead:
	set .KHKilledBoss,1;
	hideoffnpc "Kiehl#Original";
	end;
	
OnReset:
	donpcevent "Kiehl_Room_Trap::OnGlobalTimerOff";
	if (getmapusers("kh_kiehl02") > 0)
		mapwarp "kh_kiehl02","lighthalzen",192,200;
	killmonsterall "kh_kiehl02";
	disablenpc "Kiehl_Room_Exit";
	hideonnpc "Mitchell#KiehlRoom";
	hideonnpc "Agent#KHAgent1";
	hideonnpc "Agent#KHAgent2";
	hideonnpc "Agent#KHAgent3";
	hideonnpc "Agent#KHAgent4";
	hideonnpc "Kiehl#Copy";
	hideoffnpc "Kiehl#Original"; 
	set .KHKilledBoss,0;
	set .KHKilled,0;
	set getvariableofnpc(.KHTrapSprung,"Kiehl_Room_Trap"),0;
	set $@KHQuestBusy,0;
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Mitchell and Agents.
//----------------------------------------------------------------------------
kh_kiehl02,49,55,6	script	Mitchell#KiehlRoom	727,{
	end;
OnInit:
	hideonnpc strnpcinfo(0);
	end;
}
kh_kiehl02,53,52,4	duplicate(Mitchell#KiehlRoom)	Agent#KHAgent1	880
kh_kiehl02,51,49,1	duplicate(Mitchell#KiehlRoom)	Agent#KHAgent2	880
kh_kiehl02,47,50,0	duplicate(Mitchell#KiehlRoom)	Agent#KHAgent3	880
kh_kiehl02,46,53,6	duplicate(Mitchell#KiehlRoom)	Agent#KHAgent4	880

//----------------------------------------------------------------------------
// Kiehl's Room; Copy of Kiehl.
//----------------------------------------------------------------------------
kh_kiehl02,48,53,6	script	Kiehl#Copy	902,{
	end;

OnInit:
	hideonnpc "Kiehl#Copy";
	end;
}

//----------------------------------------------------------------------------
// Kiehl's Room; Kiehl_Room_Exit
//----------------------------------------------------------------------------
kh_kiehl02,50,59,0	script	Kiehl_Room_Exit	45,1,1,{
OnTouch:
	if (getmapusers("kh_kiehl02") < 1)
		donpcevent "KiehlRoom::OnReset";
	warp "lighthalzen",193,202;
	end;

OnEnable:
	specialeffect EF_SUMMONSLAVE;
	end;

OnInit:
	disablenpc "Kiehl_Room_Exit";
	end;
}

//============================================================ 
// Old changelog
//============================================================ 
//= 1.0 First version, needs testing [Playtester]
//= 1.1 Copied over some changes made by -Tsuyuki- [L0ne_W0lf]
//=     Reworked variables slightly so that the permenents ones aside from the 
//=     main tracking variable, are deleted when no longer needed. Renamed
//=     several variables that handle strings to @KHInput$. [L0ne_W0lf]
//= 1.2 Removed duplicate NPCs. [Toms]
//= 1.3 More Bug fixes, fixed typo. Updated Additional comments. [L0ne_W0lf]
//= 1.4 Fixed doors not resetting in kh_kiehl01 after 30 second timer is up. [L0ne_W0lf]
//= 1.5 Another bug fixed (&& instead of ||). [L0ne_W0lf]
//= 1.6 More squashed bugs with if checking. [L0ne_W0lf]
//= 1.7 Corrected some spelling mistakes. [Balish]
//=     Corrected Exploit with the pub man, giving infinite wine and money.
//=     Corrected pool and map not showing text for some states of the quest.
//=     Corrected Elly showing cutin but not text for some states of the quest (causing players to log off to continue).
//=     Let fisherman talk to you when you have 10 fishes OR MORE.
//=     Corrected not letting you enter the tombstone after finishing the quest.
//= 1.8 Elly now deletes the Iron_Box, and Kiel Hyre deletes the Pin. [L0ne_W0lf]
//=     More security on the 5th Big Door, now makes sure no one outside of who-
//=     acticated it initially can use it. Resets after 10 minutes to make it.
//=     Made it so that you need to be at least step 84 to activate the final door.
//=     Corrected not deleting Allysia's Ring from inventory.
//= 1.9 Exit will now enable if you are just retrieving the Ring, keeps you from getting stuck. [L0ne_W0lf]
//=     Corrected "KH_Kielh02", was setting off a debug, invalid map index. Should have been "kh_Kiehl02"
//=     Made .KHQuestBusy$ into a temp global variable. $@KHQuestBusy$. 
//= 2.0 Changed the labels on the "Big Doors" to "Identifier Names" to prevent an error with using getvariableofnpc [L0ne_W0lf]
//= 2.1 Fifth door now checks for a variable HIGHER or EQUAL to 74 not 84, as pointed out by Stollen. [L0ne_W0lf]
//= 2.2 Another fix for Elly, no longer RESETS to 26 when you talk to her. [L0ne_W0lf]
//= 2.3 Should NOT have been setting .KHQuestBusy at all. It's not used or accessed anymore. Removed. [L0ne_W0lf]
//= 2.4 Lots of fixes (4ish) from Valandi. [L0ne_W0lf]
//=     Added a getmapuser check to the mapwarp in KHTimerEnd so it's not trying to warp out 0 users. [L0ne_W0lf]
//= 2.5 Fixed several small issues (and large one) such as typos in cutins, typos in dialog, etc. [L0ne_W0lf]
//=     Added some of the missing dialogs for several NPCs, and fixed a few NPC locations.
//=     ALL books can now trigger the wall.
//=     Allysia will now summon 4 (was 2) G_CONSTANTS instead of REGULAR constants.
//=     Fixed where Golden_Key and Kiel_Button are deleted.
//=     Removed KHTimerEnd, and instead use OnReset.
//=     Fixed typo in the second NPC that gives Black Keycards.
//=     Added Monster Warps. (Keeps monsters from being in dungeon quest area.) [Non-functional]
//= 2.6 Stupid mistake, accidentally had 4 copies of the same script in 1... [L0ne_W0lf the bonehead]
//= 2.7 Fixed the wrong name being displayed for Kiel Hyre in one dialog. 
//=     Removed $@KH_DoorInvoker entirely. The quest is now working like it should according to iRO.
//=     Fixed up a few more NPC headers. Facing direction fixes mostly this time.
//=     More progression changes to Kiehl Hyre. He no longer stops dialog after the agents appear.
//= 2.8 Fixed the weight checking in Vandt, and added official dialog. [L0ne_W0lf]
//=     Added weight checks for all NPCs that give items. Semi-official dialog.
//=     Got the missing portion of dialog for Mills'.
//=     Will add further proper dialogs as I get to them on the second runthrough of the quest.
//= 2.8a minor optimization with extra goto, else or empty switch [Lupus]
//= 2.9 Fixed the "enablenpc" problem with the missing spaces. No idea how it happened. [L0ne_W0lf]
//= 3.0 Fixed a typo in Elly, in her room. (was <= should have been <) [L0ne_W0lf]
//=     Added an 'end;' to the cookie basket. Kiel Hyre's final dialog will now delete all quest-related items.
//= 3.1 Moved the "delitem" for all related quest items to the proper NPC. [L0ne_W0lf]
//= 3.2 Fixed error with Allysia teling you to "Go away." maybe. [L0ne_W0lf]
//= 3.2b Fixed some typos and grammar mistakes. [SinSloth]
//= 3.3 Fixed the receiver log out bugs. [L0ne_W0lf]
//= 3.4 Fixed bug when u can't get a Yellow Keycard if u got the Blue one at first [Lupus]
//=     Note: There are many condition checks that should be omitted in the future fixed item names in item_db.txt / txt resources according the quest
//=     for items, should be used bitwise methods in a single variable. So let's fix the rest possible bugs (if they exist) and then optimize ^_-
//= 3.5 Changed the way the Black Keycard distibuting NPCs work slighty. [L0ne_W0lf]
//= 3.6 Keil Hyre removes ALL outstanding quest items when he is talked [L0ne_W0lf]
//=     to after finishing the quest.
//= 3.7 Corrected NPC names to fall within proper restrictions. [L0ne_W0lf]
//= 3.8 Corrected some delitems. (bugreport:690) [Samuray22]
//= 3.9 Fixed a cutin not being erased. (bugreport:1539) [L0ne_W0lf]
//============================================================
