Browse Source

fixed typos, added missing NEXT;, optimized Niflheim. Clear nif vars garbage

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@8819 54d463be-8e91-2dee-dedb-b68131a5f0ec
Lupus 18 years ago
parent
commit
a402eb2a81

+ 6 - 0
npc/Changelog.txt

@@ -32,6 +32,12 @@ Playtester
 
 Date		Added
 ======
+09/20
+	* Final optimization of Niflheim quests [Lupus]
+	- Book of Devil Quest uses bit-wise var MISC_QUEST | 256. Removed extra vars
+	- Piano Quest uses 1 bit-wise temp var instead of 5.
+	- Clear Niflheim garbage vars in Global_Functions.txt 
+	- Added few missing NEXT; into job quests, thanks to $ephiroth
 09/19
 	* Fixed rpsroulette.txt, giving 10 blue potions as prize instead of the 20 it said. Also fixed
 	  a missing variable in sphinx_mask.txt. Noticed by JTE and fixed by Warian [erKURITA]

+ 12 - 7
npc/cities/einbroch.txt

@@ -123,6 +123,7 @@ s_Tower2:
 	
 s_Apple:
 	if(Zeny < 20)goto s_NEnough;
+	set Zeny,Zeny - 20;
 	mes "["+ @Tower_Name$ +"]";
 	mes "Before I guide you to";
 	mes "the tower, let me check";
@@ -130,7 +131,6 @@ s_Apple:
 	mes "your safety before I give";
 	mes "you the Apple Combo Set.";
 	next;
-	set Zeny,Zeny - 20;
 	getitem 512,1;
 	goto s_Tower2;
 	
@@ -221,11 +221,17 @@ s_Goback:
 	mes "Thank you for using";
 	mes "our services.";
 	close2;
-	set @towerwarp,rand(1,3);
-	if(@towerwarp == 0)warp "einbroch.gat",218,196;
-	if(@towerwarp == 1)warp "einbroch.gat",178,172;
-	if(@towerwarp == 3)warp "einbroch.gat",172,228;
-	end;
+	switch(rand(1,3)){
+	case 0:
+		warp "einbroch.gat",218,196;
+		end;
+	case 1:
+		warp "einbroch.gat",178,172;
+		end;
+	case 3:
+		warp "einbroch.gat",172,228;
+		end;
+	}
 
 OnHide:
 	specialeffect 16;
@@ -278,7 +284,6 @@ OnUnhide:
 	misceffect 215;
 	end;
 
-
 }
 
 einbroch.gat,232,255,5	script	Khowropher	847,{

+ 7 - 10
npc/cities/gonryun.txt

@@ -16,9 +16,6 @@
 //============================================================
 
 
-
-//Event–¢’²�¸�I
-
 alberta.gat,245,69,4	script	Public Relations#01	776,{
 	mes "[Waba]";
 	mes "Hello there! I have traveled far from the Kingdom of Gonryun, my hometown.";
@@ -42,14 +39,14 @@ alberta.gat,245,69,4	script	Public Relations#01	776,{
 		next;
 		menu "Let's Go!",-, "Actually... I changed my mind, sorry.",M_End;
 		
-			if (Zeny < 10000) goto L_NoZeny;
+			if (Zeny < 10000){
+				mes "[Waba]";
+				mes "I am sorry if it seems like a lot, but the ^0000ff10,000 zeny^000000 we request is necessary in order to make the trip.";
+				close;
+			}
 			set Zeny,Zeny-10000;
 			warp "gon_fild01.gat",258,82;
 			end;
-		L_NoZeny:
-			mes "[Waba]";
-			mes "I am sorry if it seems like a lot, but the ^0000ff10,000 zeny^000000 we request is necessary in order to make the trip.";
-			close;
 	M_End:
 		mes "[Waba]";	
 		mes "Please see me again if you want to visit! I am pleased just to meet an honored guest from the Continent.";
@@ -102,7 +99,7 @@ gonryun.gat,153,64,0	script	Public Relations#04	776,{
 }
 
 //===============================================================================
-//In �h
+//Inn
 //===============================================================================
 
 gon_in.gat,153,35,4	script	Hotel Manager	702,{
@@ -190,7 +187,7 @@ gonryun.gat,113,127,6	script	Guardsman#02	780,{
 }
 
 //===============================================================================
-//‘º’·‘î
+//???
 //===============================================================================
 
 gon_in.gat,18,27,4	script	Elder's Wife	771,{

+ 1 - 1
npc/cities/louyang.txt

@@ -721,12 +721,12 @@ s_Yes:
 		mes "I am sorry, but you don't have enough money.";
 		close;
 	}
+	set Zeny,Zeny - 500;
 	mes "Thank for your patronage.";
 	mes "We are trying to provide you with";
 	mes "the best service, Please";
 	mes "come again.";
 	close2;
-	set Zeny,Zeny - 500;
 	warp "lou_in01.gat",16,19;
 	end;
 

+ 6 - 6
npc/cities/lutie.txt

@@ -683,7 +683,7 @@ Xmas10:
 		getitem 529,5;
 		mes "[Jack Frost]";
 		mes "Wow -Congratulations!!";
-		mes "^3355FF- 5 Candy  -^000000!";
+		mes "^3355FF- 5 Candy -^000000!";
 		mes "Dear my friend,";
 		mes "Please visit me from time to time, and take a chitchat with me.";
 		mes "See you soon -";
@@ -693,7 +693,7 @@ Xmas10:
 		getitem 529,10;
 		mes "[Jack Frost]";
 		mes "Wow -Congratulations!!";
-		mes "^3355FF- 10 Candy  -^000000!";
+		mes "^3355FF- 10 Candy -^000000!";
 		mes "Dear my friend,";
 		mes "Please visit me from time to time, and take a chitchat with me.";
 		mes "See you soon -";
@@ -703,7 +703,7 @@ Xmas10:
 		getitem 530,5;
 		mes "[Jack Frost]";
 		mes "Wow -Congratulations!!";
-		mes "^3355FF- 5 Candy  Cane-^000000!";
+		mes "^3355FF- 5 Candy Cane-^000000!";
 		mes "Dear my friend,";
 		mes "Please visit me from time to time, and take a chitchat with me.";
 		mes "See you soon -";
@@ -713,7 +713,7 @@ Xmas10:
 		getitem 530,10;
 		mes "[Jack Frost]";
 		mes "Wow -Congratulations!!";
-		mes "^3355FF- 10 Candy  Cane-^000000!";
+		mes "^3355FF- 10 Candy Cane-^000000!";
 		mes "Dear my friend,";
 		mes "Please visit me from time to time, and take a chitchat with me.";
 		mes "See you soon -";
@@ -723,7 +723,7 @@ Xmas10:
 		getitem 539,1;
 		mes "[Jack Frost]";
 		mes "Wow -Congratulations!!";
-		mes "^3355FF- 1 Piece_of_Cake-^000000!";
+		mes "^3355FF- 1 Piece of Cake-^000000!";
 		mes "Dear my friend,";
 		mes "Please visit me from time to time, and take a chitchat with me.";
 		mes "See you soon -";
@@ -733,7 +733,7 @@ Xmas10:
 		getitem 539,2;
 		mes "[Jack Frost]";
 		mes "Wow -Congratulations!!";
-		mes "^3355FF- 2 Piece_of_Cake-^000000!";
+		mes "^3355FF- 2 Piece of Cake-^000000!";
 		mes "Dear my friend,";
 		mes "Please visit me from time to time, and take a chitchat with me.";
 		mes "See you soon -";

+ 17 - 102
npc/cities/niflheim.txt

@@ -24,28 +24,6 @@
 //= 1.3 Moved Book of Devil and Piano quest to quests/quests_niflheim.txt [Evera]
 //============================================================ 
 
-//prontera.gat,164,161,4	script	Traveler::NifTrav	68,{
-//	mes "[Traveler]";
-//	mes "I've come across some strange things in my time. Things you'd have to see to believe. Have you heard of Niffleheim, the City of the Dead?";
-//	next;
-//	menu "Show me, please...",M_show, "Sounds scary...Never mind...",-;
-//
-//	mes "[Traveler]";
-//	mes "A wise choice by any means...";
-//	close;
-//M_show:
-//	warp "niflheim.gat",202,171;
-//	close;
-//}
-//-	script	EDNifTrav	-1,{
-//OnInit:
-//OnMinute00:
-//	disablenpc "NifTrav";
-//	end;
-//OnMinute56:
-//	enablenpc "NifTrav";
-//	end;
-//}
 
 niflheim.gat,52,174,3	script	Kirz	796,{
 	mes "[Kirz]";
@@ -73,29 +51,6 @@ niflheim.gat,130,176,0	duplicate(spirits)	Spirit#7	802
 niflheim.gat,173,110,0	duplicate(spirits)	Spirit#8	802
 niflheim.gat,182,167,0	duplicate(spirits)	Spirit#9	802
 
-nif_fild01.gat,213,268,5	script	Little Boy	797,{
-	mes "[Marius]";
-	if(niflheimlost == 1) goto L_alreadydone;
-	if(lostgirl == 1) goto L_sure2;
-	mes "Sairin...where are you?";
-	close;
-L_alreadydone:
-	mes "Thank you for helping us!";
-	close;
-L_sure2:
-	mes "Who are you?";
-	mes "...";
-	mes "You found Sairin?";
-	mes "She ran to Niflheim?";
-	next;
-	set niflheimlost,1;
-	mes "[Marius]";
-	mes "Could you tell her that I am on my way?";
-	mes "I am a little slow, and its very important that she knows.";
-	menu "Yes",L_alreadydone, "No",-;
-
-	close;
-}
 
 niflheim.gat,195,211,5	script	Gigantia	796,{
 	mes "[Gigantia]";
@@ -209,57 +164,31 @@ L_book2:
 
 L_book3:
 	set @nif_t,0;
-	set @nif_random1,rand(1,10);
 	mes "[Ashe Bruce]";
 	mes "Ahahaha.... I see you are brave!!";
 	mes "Start reading your prayersahahahah!!";
 	next;
-L_MENU1:
-	menu "Clover.",L_MENU1_1,"Klaatu.",L_MENU1_2,"Kleitos.",L_MENU1_3;
-
-	L_MENU1_1:
-	goto L_MENU2;
-
-	L_MENU1_2:
-	set @nif_t,@nif_t + 10;
-	goto L_MENU2;
-
-	L_MENU1_3: 
-	goto L_MENU2;
-
-L_MENU2:
-	menu "Verit.",L_MENU2_1,"Veritas.",L_MENU2_2,"Verata.",L_MENU2_3;
-	
-	L_MENU2_1:
-	goto L_MENU3;
+	if(select("Clover.:Klaatu.:Kleitos.")==2)
+		set @nif_t,@nif_t + 10;
 
-	L_MENU2_2: 
-	goto L_MENU3;
+	if(select("Verit.:Veritas.:Verata.")==3)
+		set @nif_t,@nif_t + 10;
 
-	L_MENU2_3:
-	set @nif_t,@nif_t + 10;
-	goto L_MENU3;
+	if(select("Necktie.:Necklace.:Nero.:^FFFFFFNictu.^000000")==4)
+		set @nif_t,@nif_t + 10;
 
-L_MENU3:
-	menu "Necktie.",L_MENU3_1,"Necklace.",L_MENU3_2,"Nero.",L_MENU3_3,"^FFFFFFNictu.^000000",L_MENU3_4;
-
-	L_MENU3_1: 
-	goto L_score;
-
-	L_MENU3_2: 
-	goto L_score;
-
-	L_MENU3_3:
-	goto L_score;
-
-	L_MENU3_4:
-	set @nif_t,@nif_t + 10;
-	goto L_score;
-
-
-L_score:
-	if (@nif_t == 30) goto L_sucess1;
 	mes "[Ashe Bruce]";
+	if(@nif_t == 30){
+		if(rand(9)){
+			mes "Your prayers were correctaaahhhh...";
+			mes "but your curse still remainsaaahhhh!!";
+			mes "Haahahahaha.....!!!";
+			close;
+		}
+	       mes "Hahahaha!! Your curse has been lifted!!";
+	       mes "Gahahahaha.....!!!";
+	       close;
+	}
 	mes "Hahahaha!! Your prayers were wrong!!";
 	mes "Time to face deathohohohoho,";
 	mes "May you be cursed forevahahahaha!!";
@@ -272,20 +201,6 @@ L_score:
 	monster "niflheim.gat",347,259,"Orc Skeleton",1462,1,"mymob";
 	close;
 
-L_sucess1:
-	if (@nif_random1 == 10) goto L_sucess2;
-	mes "[Ashe Bruce]";
-	mes "Your prayers were correctaaahhhh...";
-	mes "but your curse still remainsaaahhhh!!";
-	mes "Haahahahaha.....!!!";
-	close;
-
-L_sucess2:
-       mes "[Ashe Bruce]";
-       mes "Hahahaha!! Your curse has been lifted!!";
-       mes "Gahahahaha.....!!!";
-       close;
-
 L_back:
 	mes "[Ashe Bruce]";
 	mes "Ahahahaha! Not bad thinking at alllhhhaahaaa...";

+ 1 - 0
npc/jobs/1-1e/ninja.txt

@@ -35,6 +35,7 @@ N_Question:
 	if(@qnumber==2) goto N_Q2;
 	if(@qnumber==3) goto N_Q3;
 	mes "Where can you find a Poison Toad?";
+	next;
 	menu "Amatsu Field",N_C,"Louyang Field",N_W,"Prontera Field",N_W,"Einbroch Field",N_W;
 N_Q1:
 	mes "Which of these places does not have its own fields?";

+ 2 - 1
npc/jobs/2-1e/StarGladiator.txt

@@ -27,6 +27,7 @@ L_Taekwon:
 	mes "Oooh, a Taekwon!";
 	mes "I don't see many of those around.";
 	mes "I don't suppose you're interested in becoming even stronger?";
+	next;
 	menu "Oh..?",-,"No, not really.",L_No;
 
 	mes "[MooHyun]";
@@ -235,7 +236,7 @@ L_Talk3:
 	mes "I am here to teach you about";
 	mes "the multiple energies that";
 	mes "come from the stars.";
-	//goto L_Itemcheck;
+	next;
 
 L_Itemcheck:
 	if(countitem(1000) < 1 || countitem(1001) < 1) goto L_Noitem3;

+ 1 - 0
npc/jobs/2-2/dancer.txt

@@ -116,6 +116,7 @@ Larcher:
 	mes "[Aire]";
 	mes "So what do you say?";
 	mes "Are you proposing you become a dancer? or will you be leaving like many before you.";
+	next;
 	menu "Fill in the form",L1,"Leave",-;
 		mes "[Aire]";
 		mes "If you do reconsider please return to me.";

+ 1 - 0
npc/jobs/2-2e/SoulLinker.txt

@@ -37,6 +37,7 @@ L_Taekwon:
 	mes "[Little Boy]";
 	mes "Excuse me. *sniff*";
 	mes "I don't suppose you couldvhelp me?";
+	next;
 	menu "Go on...",L_Goon,"No, I'm busy.",L_No;
 
 L_No:

+ 9 - 10
npc/merchants/inn.txt

@@ -107,23 +107,22 @@ function	script	F_InnMaid	{
 		savepoint getarg(2),getarg(3),getarg(4);
 		close;
 	Mrent:
-		if(Zeny < 5000) goto NoZeny;
 		mes getarg(0);
+		if(Zeny < 5000){
+			mes "I'm sorry, but the service charge";
+			mes "is 5,000 zeny. Please make sure";
+			mes "that you have enough money to check";
+			mes "in next time, okay?";
+			close;
+		}
+		set Zeny,Zeny - 5000;
+		percentheal 100,100;
 		mes "Thank you.";
 		mes "I hope you";
 		mes "enjoy your rest~";
 		close2;
-		set Zeny,Zeny - 5000;
-		percentheal 100,100;
 		return;
 
-		NoZeny:
-			mes getarg(0);
-			mes "I'm sorry, but the service charge";
-			mes "is 5,000 zeny. Please make sure";
-			mes "that you have enough money to check";
-			mes "in next time, okay?";
-			close;
 	Mend:
 		mes getarg(0);
 		mes "I am waiting for a job to do.";

+ 6 - 1
npc/other/Global_Functions.txt

@@ -3,7 +3,7 @@
 //===== By: ================================================== 
 //= Lupus, kobra_k88
 //===== Current Version: ===================================== 
-//= 2.04
+//= 2.05
 //===== Compatible With: ===================================== 
 //= eAthena 1.0
 //===== Description: ========================================= 
@@ -26,6 +26,7 @@
 //= 2.02 Added $dtsglobalelig and $dts|(1<<6) to F_ClearGarbage [Evera]
 //= 2.03 Added Gunslinger vars to F_ClearJobVar [Lupus]
 //= 2.04 Added dtseligible 2 (becomes MISC_QUEST|128) to F_ClearGarbage [Evera]
+//= 2.05 Book of Devil -> MISC_QUEST|256, clear other Niflheim garbage vars [Lupus]
 //============================================================ 
 
 
@@ -83,6 +84,10 @@ function	script	F_ClearGarbage	{
 	if(MORGEN >= 2) {set MISC_QUEST,MISC_QUEST | 4; set MORGEN,0;}
 	set nif_t,0;
 	set QSK1,0; set QSK2,0; set QSK3,0; set QSK4,0;
+	if(niflheimlost2) set MISC_QUEST,MISC_QUEST | 256;
+	set niflheimlost2,0; set niflheimlost,0; set lostgirl,0;
+	set nif_random,0; set nif_random1,0;
+	if(MISC_QUEST&32){set nif_quest1,0; set nif_quest2,0; set nif_quest3,0; set nif_quest4,0; set nif_quest5,0;}
 	return;
 }
 

+ 5 - 5
npc/quest_variables.txt

@@ -48,11 +48,6 @@ Info:		The only way from Niflheim to Umbala.
 How to set: 	set MISC_QUEST,MISC_QUEST | 32;
 How to check: 	if(MISC_QUEST & 32){}
 
-Quest: 		Piano Quest
-Info:		The only way from Niflheim to Umbala.
-How to set: 	set MISC_QUEST,MISC_QUEST | 32;
-How to check: 	if(MISC_QUEST & 32){}
-
 Quest: 		Bio Ethics Quest
 Info:		Bio Ethics quest for homunculus
 		skill for alchemists. This bit
@@ -69,6 +64,11 @@ Info:		Not really a quest, but to
 How to set: 	set MISC_QUEST,MISC_QUEST|128;
 How to check: 	if(MISC_QUEST&128){}
 
+Quest: 		Book of Devil
+Info:		The Lost Girl in Niflheim.
+How to set: 	set MISC_QUEST,MISC_QUEST | 256;
+How to check: 	if(MISC_QUEST & 256){}
+
 Quest: 		?
 Info:		?
 How to set: 	set MISC_QUEST,MISC_QUEST | ?;

+ 114 - 100
npc/quests/quests_niflheim.txt

@@ -1,15 +1,19 @@
 //===== eAthena Script ======================================= 
 //= Quest NPCs related to Niflheim
 //===== By: ================================================== 
-//= Evera and The eAthena Dev Team
+//= The eAthena Dev Team
 //===== Current Version: ===================================== 
-//= 1.0
+//= 1.1
 //===== Compatible With: ===================================== 
 //= eAthena 7.15 +
 //===== Description: ========================================= 
-//= Book of Devil and Piano Key quest
+//= Book of Devil		(MISC_QUEST | 256)
+//= Piano Key Ouest		(MISC_QUEST | 32)
 //===== Additional Comments: ================================= 
-//= 1.0 Initial release, moved Book of Devil and Piano quest from npc/cities/niflheim.txt [Evera]
+//= 1.0 Initial release, moved Book of Devil and Piano quest
+//=	from npc/cities/niflheim.txt [Evera]
+//= 1.1 Optimized Book of Devil quest. used bit-wise var,
+//=	Optimized Piano Quest - now uses 1 variable [Lupus]
 //============================================================ 
 
 //=============================================================
@@ -17,14 +21,32 @@
 //=============================================================
 niflheim.gat,184,199,5	script	Little Girl#02	793,{
 	mes "[Sairin]";
-	if(niflheimlost2 == 1) goto L_thanks;
-	if(niflheimlost == 1) goto L_foundhim;
-	if(lostgirl == 1) goto L_sure2;
+	if(MISC_QUEST & 256){
+		mes "Thanks again!";
+		close;
+	}
+	if(@niflheimlost == 2){
+		mes "You found him?";
+		mes "Oh thank you!";
+		mes "Please, take this as a token of my appreciation.";
+		getitem 642,1;//Items: Book of Devil,
+		set MISC_QUEST,MISC_QUEST | 256;
+		set @niflheimlost,0;
+		close;
+	}
+	if(@niflheimlost == 1){
+M_YES:
+		set @niflheimlost,1;
+		mes "Please find him and tell him where I am! I saw him last in Niflheim Field, the first one...";
+		close;
+	}
 	mes "Sir, will you please help me?";
-	if(BaseJob==Job_Novice) mes "Oh... you are lost, too..."; //Exploit fix
-	if(BaseJob==Job_Novice) close;
+	if(BaseJob==Job_Novice){
+		mes "Oh... you are lost, too...";
+		close;
+	}
 	next;
-	menu "Yes",-, "No",M_no;
+	menu "Yes",-, "No",M_NO;
 
 	mes "[Sairin]";
 	mes "My friend and I went for a hike and ended up wandering into a strange field.";
@@ -38,22 +60,37 @@ niflheim.gat,184,199,5	script	Little Girl#02	793,{
 	mes "[Sairin]";
 	mes "No one here will help me, and there are ghosts everywhere! Could you help me find my friend?";
 	next;
-	menu "Sure",-, "No",M_no;
-L_sure2:
-	set lostgirl,1;
-	mes "Please find him and tell him where I am! I saw him last in Niflheim Field, the first one...";
+	menu "Sure",M_YES, "No",M_NO;
+M_NO:
 	close;
+}
 
-L_foundhim:
-	mes "You found him?";
-	mes "Oh thank you!";
-	mes "Please, take this as a token of my appreciation.";
-	getitem 642,1;//Items: Book of Devil,
-	set niflheimlost2,1;
-	close;
-L_thanks:
-	mes "Thanks again!";
-M_no:
+nif_fild01.gat,213,268,5	script	Little Boy	797,{
+	if(MISC_QUEST & 256){
+L_DONE:
+		set @niflheimlost,2;
+		mes "[Marius]";
+		mes "Thank you for helping us!";
+		close;
+	}
+	if(@niflheimlost == 2) goto L_PART2;
+	if(@niflheimlost == 1){
+		mes "[Marius]";
+		mes "Who are you?";
+		mes "...";
+		mes "You found Sairin?";
+		mes "She ran to Niflheim?";
+		next;
+L_PART2:
+		mes "[Marius]";
+		mes "Could you tell her that I am on my way?";
+		mes "I am a little slow, and its very important that she knows.";
+		next;
+		menu "Yes",L_DONE, "No",-;
+		close;	
+	}
+	mes "[Marius]";
+	mes "Sairin... where are you?";
 	close;
 }
 
@@ -69,7 +106,7 @@ niflheim.gat,224,243,3	script	Alager	795,{
 	mes "I'm going to eat you...";
 	next;
 	mes "-Chomp bite slurp-";
-	if (nif_quest1 == 1 || (MISC_QUEST & 32)) goto L_end;
+	if(nif_piano&1 || (MISC_QUEST & 32)) goto L_end;
 	percentheal -60,0;
 	next;
 	mes "[Alager]";
@@ -84,7 +121,7 @@ niflheim.gat,224,243,3	script	Alager	795,{
 	mes "Ah, let me thank you with this,";
 	mes "I found it on the ground, hoho~";
 	getitem 7184,1;//Items: Piano Key,
-	set nif_quest1, 1;
+	set nif_piano, 1;
 	close;
 L_end:
 	percentheal -30,0;
@@ -103,64 +140,53 @@ nif_in.gat,105,81,3	script	Crayu	794,{
 	mes "^FF0000The beautiful melody surrounding thy soul,^000000";
 	mes "^FF0000Is the key from Lord Death's wrath.^000000";
 	next;
-	if (nif_quest2 == 1 || (MISC_QUEST & 32)) goto L_end;
-	set @nif_random,rand(1,4);
 	mes "[Crayu]";
+	if(nif_piano&2 || (MISC_QUEST & 32)){
+		mes "I wonder what does it mean...";
+		mes "If you read it carefully,";
+		mes "it seems to have a deep meaning,";
+		mes "as if there is a mysterious secret";
+		mes "hidden within these words...";
+		close;
+	}
+	set @nif_random,rand(1,4);
 	mes "Heh, let me give you a little exam!";
 	mes "Repeat line no. " + @nif_random + " of the poem";
 	mes "that you have just heard to me!";
 	next;
 	input @inputstr1$;
-	if (@nif_random == 2) goto L_RAN_2;
-	if (@nif_random == 3) goto L_RAN_3;
-	if (@nif_random == 4) goto L_RAN_4;
-	//if (@nif_random == 1) goto L_RAN_1;	
-	L_RAN_1:
+	switch(@nif_random){
+	case 1:
 		set @str1$,"When the sun sets in the western hills,";
-		goto L_RAN_B;
-	
-	L_RAN_2:
+		break;
+	case 2:
 		set @str1$,"Where points the velvet gloom of dawn,";
-		goto L_RAN_B;
-
-	L_RAN_3:
+		break;
+	case 3:
 		set @str1$,"The beautiful melody surrounding thy soul,";
-		goto L_RAN_B;
-
-	L_RAN_4:
+		break;
+	case 4:
 		set @str1$,"Is the key from Lord Death's wrath.";
-		goto L_RAN_B;
-
-	L_RAN_B:
-		if (@inputstr1$ == @str1$) goto L_RAN_SC;
-		mes "[Crayu]";
-		mes "Aih... If you had paid more attention,";
-		mes "you would have known the correct answer!";
-		mes "Come back for the challenge again,";
-		mes "when you have thought over it!";
-		close;
-
-	L_RAN_SC:
-		mes "[Crayu]";
+		break;
+	}
+	mes "[Crayu]";
+	if(@inputstr1$ == @str1$){
 		mes "Hoho... I see you have paid attention!";
 		mes "I am Grey, a wandering poet of yore,";
 		mes "you are the best audience I have had so far,";
 		mes "here, take this as a reward.";
 		getitem 7184,1;//Items: Piano Key,
-		set nif_quest2, 1;
+		set nif_piano, nif_piano|2;
 		next;
 		mes "[Crayu]";
 		mes "I hope you will treat other poets";
 		mes "as well as you treated me, farewell.";
 		close;
-
-L_end:
-	mes "[Crayu]";
-	mes "I wonder what does it mean...";
-	mes "If you read it carefully,";
-	mes "it seems to have a deep meaning,";
-	mes "as if there is a mysterious secret";
-	mes "hidden within these words...";
+	}
+	mes "Aih... If you had paid more attention,";
+	mes "you would have known the correct answer!";
+	mes "Come back for the challenge again,";
+	mes "when you have thought over it!";
 	close;
 }
 
@@ -169,13 +195,13 @@ nif_in.gat,31,20,3	script	Kurtz	794,{
 	mes "Business nowadays is really bad...";
 	mes "Back when I used to be alive,";
 	mes "my business was this bad too~!";
-	if (nif_quest3 == 1 || (MISC_QUEST & 32)) close;
+	if(nif_piano&4 || (MISC_QUEST & 32)) close;
 	next;
 	mes "[Kurtz]";
 	mes "Hey! You there! Dump this for me";
 	mes "on the way out will you!";
 	getitem 7184,1;//Items: Piano Key,
-	set nif_quest3, 1;
+	set nif_piano, nif_piano|4;
 	next;
 	mes "[Kurtz]";
 	mes "Why is business so bad lately...";
@@ -184,7 +210,7 @@ nif_in.gat,31,20,3	script	Kurtz	794,{
 }
 
 niflheim.gat,169,71,5	script	#1	111,2,2{
-	if (MISC_QUEST & 32 || nif_quest4 == 1) end;
+	if(MISC_QUEST & 32 || nif_piano&8) end;
 
 	mes "- In the nearby tombs -";
 	mes "- you see something -";
@@ -195,16 +221,26 @@ niflheim.gat,169,71,5	script	#1	111,2,2{
 	mes "- Pick it up? -";
 	menu "Yes",-,"No",L_end;
 	getitem 7184,1;//Items: Piano Key,
-	set nif_quest4, 1;
+	set nif_piano, nif_piano|8;
 L_end:
 	close;
 }
 
 niflheim.gat,208,103,5	script	#2	111,2,2{
-	if (MISC_QUEST & 32) end;
-	if (nif_quest5 == 1) goto L_key2;
-	if (nif_quest5 >= 2) end;
-
+	if(MISC_QUEST & 32 || nif_piano&32) end;
+	if(nif_piano&16){
+		mes "- In the hole you have dug -";
+		mes "- there is something else -";
+		mes "- buried deep in the ground -";
+		mes "- Looks like its another fragment -";
+		next;
+		mes "- Pick it up? -";
+		menu "Yes",-,"No",L_end;
+		getitem 7184,1;//Items: Piano Key,
+		set nif_piano, nif_piano|32;
+	L_end:
+		close;
+	}
 	mes "- In the nearby tombs -";
 	mes "- you see something -";
 	mes "- half buried in the ground -";
@@ -214,40 +250,19 @@ niflheim.gat,208,103,5	script	#2	111,2,2{
 	mes "- Pick it up? -";
 	menu "Yes",-,"No",L_end;
 	getitem 7184,1;//Items: Piano Key,
-	set nif_quest5, 1;
-	close;
-L_key2:
-	mes "- In the hole you have dug -";
-	mes "- there is something else -";
-	mes "- buried deep in the ground -";
-	mes "- Looks like its another fragment -";
-	next;
-	mes "- Pick it up? -";
-	menu "Yes",-,"No",L_end;
-	getitem 7184,1;//Items: Piano Key,
-	set nif_quest5, 2;
-L_end:
+	set nif_piano, nif_piano|16;
 	close;
 }
 
 nif_in.gat,115,181,5	script	#4	111,3,3{
 	mes "- You see a huge old piano -";
-	if ((MISC_QUEST & 32)==0) mes "- with a few keys missing  -";
-	if (MISC_QUEST & 32) mes "- with one key missing -";
-	if ((MISC_QUEST & 32)==0 && countitem(7184) > 5) goto L_event;//Items: Piano Key,
-	close;
+	if((MISC_QUEST & 32)==0) mes "- with a few keys missing  -";
+	if(MISC_QUEST & 32) mes "- with one key missing -";
+	if(MISC_QUEST & 32 || countitem(7184) < 6) close;
 
-L_event:
-	delitem 7184,6;//Items: Piano Key,
+	delitem 7184,countitem(7184);//Items: Piano Key,
 	set MISC_QUEST,MISC_QUEST | 32;
-	//clear auxiliary vars now
-	set nif_quest1, 0;
-	set nif_quest2, 0;
-	set nif_quest3, 0;
-	set nif_quest4, 0;
-	set nif_quest5, 0;
-	set nif_random,0; //clear garbage from the previous version of the script
-	set nif_random1,0; //clear garbage
+	set nif_piano, 0;
 	mes "- You slide the 6 piano keys one -";
 	mes "- by one into the missing slots  -";
 	mes "- on the piano, but you realize  -";
@@ -258,7 +273,6 @@ L_event:
 
 nif_in.gat,118,151,5	script	#5	111,3,3{
 	if((MISC_QUEST & 32)==0) end;
-
 	mes "- The very moment the long shadow -";
 	mes "- of your body falls on the piano -";
 	next;