summaryrefslogtreecommitdiff
path: root/world/map
diff options
context:
space:
mode:
authorJessica Tölke <jtoelke@mail.upb.de>2013-02-12 23:06:27 +0100
committerJessica Tölke <jtoelke@mail.upb.de>2013-02-12 23:06:27 +0100
commit627a802f4eeb0872ab84d32ef952ca8884cea795 (patch)
treeb62300599d9f82f986769d0b501d9b18c83123f6 /world/map
parent776515d46c6ffe47334537c32fc1b55f26fe47e4 (diff)
parente0e679a8a695641d1845c28bebe1c7e83c21a39f (diff)
downloadserverdata-627a802f4eeb0872ab84d32ef952ca8884cea795.tar.gz
serverdata-627a802f4eeb0872ab84d32ef952ca8884cea795.tar.bz2
serverdata-627a802f4eeb0872ab84d32ef952ca8884cea795.tar.xz
serverdata-627a802f4eeb0872ab84d32ef952ca8884cea795.zip
Merge branch 'variables'
Several older scripts were changed to use bitmasking for the player variables. Variables that are or became unused were added to the clear_vars function.
Diffstat (limited to 'world/map')
-rw-r--r--world/map/db/const.txt1
-rw-r--r--world/map/npc/001-1/bernard.txt35
-rw-r--r--world/map/npc/001-1/gossip.txt43
-rw-r--r--world/map/npc/001-1/mikhail.txt54
-rw-r--r--world/map/npc/001-1/sandra.txt43
-rw-r--r--world/map/npc/001-1/sarah.txt43
-rw-r--r--world/map/npc/001-1/vincent.txt54
-rw-r--r--world/map/npc/001-2/troupe_leader.txt33
-rw-r--r--world/map/npc/002-1/lieutenant_dausen.txt98
-rw-r--r--world/map/npc/002-1/nickos.txt83
-rw-r--r--world/map/npc/002-1/sandstorm_mine_barrier.txt14
-rw-r--r--world/map/npc/002-1/stewen.txt25
-rw-r--r--world/map/npc/002-3/mine_triggerone.txt44
-rw-r--r--world/map/npc/002-3/mine_triggerthree.txt44
-rw-r--r--world/map/npc/002-3/mine_triggertwo.txt46
-rw-r--r--world/map/npc/002-3/naem.txt93
-rw-r--r--world/map/npc/002-3/nathan.txt83
-rw-r--r--world/map/npc/002-3/underground_palace_barrier.txt14
-rw-r--r--world/map/npc/002-4/chest.txt31
-rw-r--r--world/map/npc/002-4/miners.txt45
-rw-r--r--world/map/npc/008-1/hinnak.txt82
-rw-r--r--world/map/npc/009-1/jack.txt63
-rw-r--r--world/map/npc/009-1/milly.txt18
-rw-r--r--world/map/npc/009-1/old_man.txt25
-rw-r--r--world/map/npc/009-1/old_woman.txt58
-rw-r--r--world/map/npc/009-1/sabine.txt18
-rw-r--r--world/map/npc/009-2/alan.txt76
-rw-r--r--world/map/npc/009-2/doctor.txt27
-rw-r--r--world/map/npc/009-2/inspector.txt99
-rw-r--r--world/map/npc/009-2/lena.txt64
-rw-r--r--world/map/npc/009-2/nurse.txt39
-rw-r--r--world/map/npc/011-4/bl_barrier.txt11
-rw-r--r--world/map/npc/011-6/bryant.txt41
-rw-r--r--world/map/npc/013-3/barrier.txt27
-rw-r--r--world/map/npc/013-3/mask_chest.txt63
-rw-r--r--world/map/npc/013-3/sword_chest.txt9
-rw-r--r--world/map/npc/018-2/angus.txt12
-rw-r--r--world/map/npc/018-2/books.txt15
-rw-r--r--world/map/npc/018-2/caul.txt11
-rw-r--r--world/map/npc/018-2/miners.txt34
-rw-r--r--world/map/npc/018-2/receptionist.txt24
-rw-r--r--world/map/npc/018-3/bookcase.txt25
-rw-r--r--world/map/npc/021-2/kylian.txt7
-rw-r--r--world/map/npc/functions/clear_vars.txt81
44 files changed, 1201 insertions, 654 deletions
diff --git a/world/map/db/const.txt b/world/map/db/const.txt
index d2f45290..e50dfb24 100644
--- a/world/map/db/const.txt
+++ b/world/map/db/const.txt
@@ -533,6 +533,7 @@ FLAG_ROSSI_COMPLETED 128 // Completed the Rossi Quest
FLAG_TUTORIAL_DONE 256 // player completed tutorial (or entered the tutorial area from outside after it was added)
FLAG_SNOWMAN 512 // player gave candy to the snowman
FLAG_SANTAS_HELPER 1024 // player gave presents to Santa's helper
+FLAG_HURNSMINE_CHEST 2048 // player opened the chest with the short sword in Hurnscald mines
DOCK_tulimshar 1
DOCK_hurnscald 2
diff --git a/world/map/npc/001-1/bernard.txt b/world/map/npc/001-1/bernard.txt
index 23b39f5c..0d65e6d2 100644
--- a/world/map/npc/001-1/bernard.txt
+++ b/world/map/npc/001-1/bernard.txt
@@ -1,10 +1,16 @@
-//
+// Variables used: nibble 0 of QUEST_SouthTulimshar
001-1.gat,37,44,0|script|Bernard|117,{
- if(TMW_Quest >= 4) goto L_Done2;
- if(TMW_Quest == 3) goto L_Progress2;
- if(TMW_Quest == 2) goto L_Done1;
- if(TMW_Quest == 1) goto L_Progress;
+
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+
+ if(@state >= 4) goto L_Done2;
+ if(@state == 3) goto L_Progress2;
+ if(@state == 2) goto L_Done1;
+ if(@state == 1) goto L_Progress;
set @TEMP, rand(2);
if(@TEMP == 0) goto L_Opening0;
@@ -45,7 +51,8 @@ L_Req1:
goto L_Set;
L_Set:
- set TMW_Quest,1;
+ set @state, 1;
+ callsub S_Update_Var;
mes "[Bernard]";
mes "\"Please bring it to me!\"";
goto L_Close;
@@ -60,7 +67,10 @@ L_Progress:
delitem "RoastedMaggot", 1;
getexp 100, 0;
getitem "CherryCake", 5;
- set TMW_Quest, 2;
+ set @state, 2;
+ callsub S_Update_Var;
+ next;
+ mes "\"Now let's see...\"";
goto L_Close;
L_Progress2:
@@ -73,7 +83,8 @@ L_Progress2:
delitem "MaggotSlime", 3;
getexp 100, 0;
getitem "Beer", 3;
- set TMW_Quest, 4;
+ set @state, 4;
+ callsub S_Update_Var;
goto L_Close;
L_NotEnough:
@@ -93,7 +104,8 @@ L_Done1:
next;
mes "\"I need 3 Maggot Slimes for that.\"";
mes "\"Bring them to me, and I'll give you something nice.\"";
- set TMW_Quest,3;
+ set @state, 3;
+ callsub S_Update_Var;
goto L_Close;
L_Done2:
@@ -105,6 +117,7 @@ L_Done2:
L_Close:
set @TEMP, 0;
+ set @state, 0;
close;
L_TooMany:
@@ -112,4 +125,8 @@ L_TooMany:
mes "[Bernard]";
mes "\"You don't have room for my reward. I'll wait until you do.\"";
goto L_Close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_0_MASK) | (@state << NIBBLE_0_SHIFT));
+ return;
}
diff --git a/world/map/npc/001-1/gossip.txt b/world/map/npc/001-1/gossip.txt
index a5b43329..468b8b48 100644
--- a/world/map/npc/001-1/gossip.txt
+++ b/world/map/npc/001-1/gossip.txt
@@ -1,6 +1,16 @@
// NPC to provide hints on progression of linear quest chain in Tulimshar
001-1.gat,49,31,0|script|Gladys|154,{
+
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @guards, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+ set @bermik, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+ set @sarah, ((QUEST_SouthTulimshar & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT);
+ set @vincent, ((QUEST_SouthTulimshar & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
+ set @sandra, ((QUEST_SouthTulimshar & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
mes "[Gladys, Town Gossip]";
mes "\"Hello deary! I hear some of the most fascinating rumors and bits of news. I just heard a bit more today!\"";
mes "\"Would you like me to let you in on the good stuff?\"";
@@ -9,18 +19,18 @@
"No thanks.", L_No;
L_Yes:
- if (TMW_Quest >=40) goto L_Ferry;
- if (TMW_Quest >=12) goto L_Desert;
- if (TMW_Quest >=10) goto L_Sandra;
- if (TMW_Quest >=8) goto L_Vinc;
- if (TMW_Quest >=6) goto L_Sarah;
- if (TMW_Quest >=4) goto L_Mik;
- if (TMW_Quest <1) goto L_Intro;
+ if (@bermik < 4) goto L_Intro;
+ if (@bermik < 6) goto L_Mik;
+ if (@sarah < 2) goto L_Sarah;
+ if (@vincent < 2) goto L_Vinc;
+ if (@sandra < 2) goto L_Sandra;
+ if (@guards < 28) goto L_Desert;
+ goto L_Ferry;
L_No:
mes "[Gladys, Town Gossip]";
mes "\"Very well. Come back whenever you like. I am always getting juicy bits of news!\"";
- close;
+ goto L_Close;
L_Intro:
mes "[Gladys, Town Gossip]";
@@ -30,7 +40,7 @@ L_Intro:
mes "\"I also overheard some of the children in the square talking today. I think they are having trouble with some of their chores. Kids these days...\"";
next;
mes "The old lady trails off and starts muttering to herself about hills and snow. Perhaps it's best to leave her alone for now.";
- close;
+ goto L_Close;
L_Mik:
mes "[Gladys, Town Gossip]";
@@ -38,7 +48,7 @@ L_Mik:
next;
mes "[Gladys, Town Gossip]";
mes "\"One of the ladies in my quilting club mentioned giving a task to her grandson. I have my doubts about whether he ever finished it...\"";
- close;
+ goto L_Close;
L_Sarah:
mes "[Gladys, Town Gossip]";
@@ -46,12 +56,12 @@ L_Sarah:
next;
mes "[Gladys, Town Gossip]";
mes "\"Do you believe what parents will let their kids do these days?! I heard about this girl at the far side of town who does nothing but eat sweets all day! Honestly, what is the world coming to?\"";
- close;
+ goto L_Close;
L_Vinc:
mes "[Gladys, Town Gossip]";
mes "\"I just got news of an exciting new business opportunity! There's supposed to be a new entrepreneur in town somewhere making toys. You should get in on the ground floor!\"";
- close;
+ goto L_Close;
L_Sandra:
mes "[Gladys, Town Gossip]";
@@ -59,7 +69,7 @@ L_Sandra:
next;
mes "[Gladys, Town Gossip]";
mes "\"I've been hearing reports of you all over town! I think there's only one little girl you haven't assisted, but she's a strange one...always messing about with bugs. Yuck!\"";
- close;
+ goto L_Close;
L_Desert:
if (Sex == 0) set @person$, "gal";
@@ -76,9 +86,14 @@ L_Desert:
L_Ferry:
mes "[Gladys, Town Gossip]";
mes "I heard that there is a handsome sailor in the north of town who will take people to exotic new places! I'm saving my pennies!\"";
- close;
+ goto L_Close;
L_Close:
set @person$, "";
+ set @guards, 0;
+ set @bermik, 0;
+ set @sarah, 0;
+ set @vincent, 0;
+ set @sandra, 0;
close;
}
diff --git a/world/map/npc/001-1/mikhail.txt b/world/map/npc/001-1/mikhail.txt
index ced945cf..3980ac9b 100644
--- a/world/map/npc/001-1/mikhail.txt
+++ b/world/map/npc/001-1/mikhail.txt
@@ -1,21 +1,23 @@
-//
+// Variables used: nibble 0 of QUEST_SouthTulimshar
001-1.gat,50,46,0|script|Mikhail|120,{
- if (TMW_Quest >= 6) goto L_Done;
- if (TMW_Quest == 5) goto L_Progress;
- if (TMW_Quest == 4) goto L_Start;
- if (TMW_Quest < 4) goto L_Convince_Mikhail_First;
- // If this happens, something is wrong with the above case handling.
- mes "Mikhail looks confused.";
- close;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+
+ if (@state >= 6) goto L_Done;
+ if (@state == 5) goto L_Progress;
+ if (@state == 4) goto L_Start;
+ if (@state < 4) goto L_Convince_Mikhail_First;
L_Convince_Mikhail_First:
mes "[Mikhail]";
mes "\"Hello...\"";
mes "";
mes "It seems that the boy would like to say more, but does not dare to open up to you. Maybe you should help someone else first, so that he sees your intentions are good.";
- close;
+ goto L_Close;
L_Start:
mes "[Mikhail]";
@@ -24,16 +26,13 @@ L_Start:
mes "\"You look like a nice person. Would you go get them for me?\"";
menu
"Of course, I'll go get them for you.", L_accept,
- "I've got other things to do right now.", L_close;
- close;
-
-L_close:
- close;
+ "I've got other things to do right now.", L_Close;
L_accept:
mes "[Mikhail]";
mes "\"Thank you so much! I'll wait for you here.\"";
- set TMW_Quest, 5;
+ set @state, 5;
+ callsub S_Update_Var;
close;
L_Progress:
@@ -42,27 +41,34 @@ L_Progress:
next;
menu
"Yes, here they are, kiddo!", L_try,
- "Not yet, but I'll be back soon.", L_close;
- close;
+ "Not yet, but I'll be back soon.", L_Close;
L_try:
- if countitem("MaggotSlime") >= 5 goto L_get;
+ if (countitem("MaggotSlime") >= 5)
+ goto L_get;
mes "[Mikhail]";
mes "\"It doesn't look like you have them all...\"";
- close;
+ goto L_Close;
L_get:
delitem "MaggotSlime", 5;
- set TMW_Quest, 6;
+ getexp 100, 0;
+ set @state, 6;
+ callsub S_Update_Var;
mes "[Mikhail]";
mes "\"Ooh! Thank you so much! I can get back to my grandma now!\"";
- next;
- getexp 100, 0;
- mes "You get 100 xp.";
- close;
+ goto L_Close;
L_Done:
mes "[Mikhail]";
mes "\"Thanks again for helping me get those Maggot Slimes!\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_0_MASK) | (@state << NIBBLE_0_SHIFT));
+ return;
}
diff --git a/world/map/npc/001-1/sandra.txt b/world/map/npc/001-1/sandra.txt
index 10d014dd..021f8519 100644
--- a/world/map/npc/001-1/sandra.txt
+++ b/world/map/npc/001-1/sandra.txt
@@ -1,15 +1,19 @@
-//
+// Variables used: nibble 3 of QUEST_SouthTulimshar
001-1.gat,110,71,0|script|Sandra|114,{
- if (TMW_Quest >= 12) goto L_Done;
- if (TMW_Quest == 11) goto L_Progress;
- if (TMW_Quest == 10) goto L_Start;
+
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
+ if (@state >= 2) goto L_Done;
+ if (@state == 1) goto L_Progress;
mes "[Sandra]";
- mes "\"Hunting monsters for potion ingredients can sometimes be a difficult task. Maybe you could help me at some point.\"";
- goto L_Close;
+ mes "\"Hunting monsters for potion ingredients can sometimes be a difficult task.\"";
+ next;
-L_Start:
set @TEMP, rand(4);
if(@TEMP == 0) goto L_Opening0;
if(@TEMP == 1) goto L_Opening1;
@@ -17,25 +21,21 @@ L_Start:
if(@TEMP == 3) goto L_Opening3;
L_Opening0:
- mes "[Sandra]";
mes "\"In the outskirts of Tulimshar, there are some scorpions... I need help! Will you help?\"";
next;
goto L_Ask;
L_Opening1:
- mes "[Sandra]";
mes "\"When you venture to the outskirts of Tulimshar, you can spot scorpions. Will you help me kill some?\"";
next;
goto L_Ask;
L_Opening2:
- mes "[Sandra]";
mes "\"The Scorpion Stinger carries many properties used in potions. Would you get some for me?\"";
next;
goto L_Ask;
L_Opening3:
- mes "[Sandra]";
mes "\"You look sturdy enough, will you help me get something?\"";
next;
goto L_Ask;
@@ -70,21 +70,25 @@ L_Req2:
goto L_Set;
L_Set:
- set TMW_Quest,11;
- mes "[Sandra]";
+ set @state, 1;
+ callsub S_Update_Var;
mes "\"Please get them for me!\"";
goto L_Close;
L_Progress:
- if (countitem("ScorpionStinger") < 5) goto L_NotEnough;
+ if (countitem("ScorpionStinger") < 5)
+ goto L_NotEnough;
mes "[Sandra]";
- mes "\"Excellent! You brought me 5 Scorpion Stingers!\"";
+ mes "\"Excellent! You brought me 5 Scorpion Stingers!";
+ mes "Here's something for you.\"";
getinventorylist;
- if (@inventorylist_count + (countitem("ScorpionStinger") == 5) - (countitem("Arrow") == 0) > 99) goto L_TooMany;
+ if (@inventorylist_count + (countitem("ScorpionStinger") == 5) - (countitem("Arrow") == 0) > 99)
+ goto L_TooMany;
delitem "ScorpionStinger", 5;
getitem "Bow", 1;
getitem "Arrow", 100;
- set TMW_Quest, 12;
+ set @state, 2;
+ callsub S_Update_Var;
goto L_Close;
L_NotEnough:
@@ -99,6 +103,7 @@ L_Done:
L_Close:
set @TEMP, 0;
+ set @state, 0;
close;
L_TooMany:
@@ -106,4 +111,8 @@ L_TooMany:
mes "[Sandra]";
mes "\"You don't have room for my reward. I'll wait until you do.\"";
goto L_Close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_3_MASK) | (@state << NIBBLE_3_SHIFT));
+ return;
}
diff --git a/world/map/npc/001-1/sarah.txt b/world/map/npc/001-1/sarah.txt
index 8a84df47..3d2cb806 100644
--- a/world/map/npc/001-1/sarah.txt
+++ b/world/map/npc/001-1/sarah.txt
@@ -1,37 +1,29 @@
-//
+// Variables used: nibble 1 of QUEST_SouthTulimshar
001-1.gat,137,78,0|script|Sarah|106,{
- if (TMW_Quest >= 8) goto L_Done;
- if (TMW_Quest == 7) goto L_Progress;
- if (TMW_Quest == 6) goto L_Start;
- if (TMW_Quest < 6) goto L_Convince_Sarah_First;
- // If this is shown, something is wrong with the above case handling.
- mes "Sarah looks confused.";
- goto L_Close;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT);
+
+ if (@state >= 2) goto L_Done;
+ if (@state == 1) goto L_Progress;
-L_Convince_Sarah_First:
mes "[Sarah]";
mes "\"Boy, am I hungry or what!\"";
next;
- mes "\"The girl suddenly looks at you suspiciously.\"";
- next;
- mes "\"My mommy says not to talk to strangers!\"";
- goto L_Close;
-L_Start:
set @TEMP, rand(2);
if(@TEMP == 0) goto L_Opening0;
if(@TEMP == 1) goto L_Opening1;
L_Opening0:
- mes "[Sarah]";
mes "\"Cherry Cake is the best!\"";
next;
goto L_Ask;
L_Opening1:
- mes "[Sarah]";
mes "\"Mmm, Cherry Cake... I love it!\"";
next;
goto L_Ask;
@@ -46,16 +38,15 @@ L_Req0:
mes "[Sarah]";
mes "\"Yippee! Bring me a piece of Cherry Cake, and I'll give you a nice hat!\"";
next;
- goto L_Set;
-
-L_Set:
- set TMW_Quest,7;
+ set @state, 1;
+ callsub S_Update_Var;
mes "[Sarah]";
mes "\"Please bring it to me!\"";
goto L_Close;
L_Progress:
- if (countitem("CherryCake") < 1) goto L_NotEnough;
+ if (countitem("CherryCake") < 1)
+ goto L_NotEnough;
mes "[Sarah]";
mes "\"Whee!\"";
next;
@@ -64,8 +55,9 @@ L_Progress:
getinventorylist;
if ((@inventorylist_count - (countitem("CherryCake") == 1)) > 99) goto L_TooMany;
delitem "CherryCake", 1;
- getitem "serfhat", 1;
- set TMW_Quest, 8;
+ getitem "SerfHat", 1;
+ set @state, 2;
+ callsub S_Update_Var;
goto L_Close;
L_NotEnough:
@@ -81,6 +73,7 @@ L_Done:
L_Close:
set @TEMP, 0;
+ set @state, 0;
close;
L_TooMany:
@@ -88,4 +81,8 @@ L_TooMany:
mes "[Sarah]";
mes "\"You don't have room for my reward. I'll wait until you do.\"";
goto L_Close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_1_MASK) | (@state << NIBBLE_1_SHIFT));
+ return;
}
diff --git a/world/map/npc/001-1/vincent.txt b/world/map/npc/001-1/vincent.txt
index e2a53a31..4ed4adfc 100644
--- a/world/map/npc/001-1/vincent.txt
+++ b/world/map/npc/001-1/vincent.txt
@@ -1,4 +1,4 @@
-//
+// Variables used: nibble 2 of QUEST_SouthTulimshar
001-1.gat,135,42,0|script|Vincent|113,{
set @hw2011_npc_id, $@hw2011_npc_vincent;
@@ -6,23 +6,19 @@
goto L_TrickOrTreat;
L_Begin:
- if (TMW_Quest >= 10) goto L_Done;
- if (TMW_Quest == 9) goto L_Progress;
- if (TMW_Quest == 8) goto L_Start;
- if (TMW_Quest < 8) goto L_Convince_Vincent_First;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
- // If this happens, something is wrong with the above code.
- mes "Vincent looks confused.";
- goto L_Close;
+ set @state, ((QUEST_SouthTulimshar & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
+
+ if (@state >= 2) goto L_Done;
+ if (@state == 1) goto L_Progress;
L_Convince_Vincent_First:
mes "[Vincent]";
mes "\"I'm making an action figure. I'm almost done with it.\"";
- mes "";
- mes "Vincent seems distracted with his near-completed figurine for now.";
- goto L_Close;
+ next;
-L_Start:
set @TEMP, rand(4);
if(@TEMP == 0) goto L_Opening1;
if(@TEMP == 1) goto L_Opening2;
@@ -30,41 +26,36 @@ L_Start:
if(@TEMP == 3) goto L_Opening4;
L_Opening1:
- mes "[Vincent]";
mes "\"I just need 10 more Bug Legs to finish my action figure!\"";
next;
goto L_Ask;
L_Opening2:
- mes "[Vincent]";
mes "\"This maggot action figure is awesome! I just need to attach 10 Bug Legs.\"";
next;
goto L_Ask;
L_Opening3:
- mes "[Vincent]";
mes "\"This is a great action figure! A must have! All I need is a few parts...\"";
next;
goto L_Ask;
L_Opening4:
- mes "[Vincent]";
mes "\"Can you get me 10 Bug Legs? I need them to replace the action figure parts.\"";
next;
goto L_Ask;
L_Ask:
- mes "[Vincent]";
mes "\"Will you help me find 10 Bug Legs?\"";
next;
menu
- "Yes", L_Sure,
- "No", -;
- goto L_Close;
+ "Yes.", L_Sure,
+ "No.", L_Close;
L_Sure:
- set TMW_Quest, 9;
- set @TEMP,rand(4);
+ set @state, 1;
+ callsub S_Update_Var;
+ set @TEMP, rand(4);
if(@TEMP == 0) goto L_Req1;
if(@TEMP == 1) goto L_Req2;
if(@TEMP == 2) goto L_Req3;
@@ -90,29 +81,31 @@ L_Req3:
L_Req4:
mes "[Vincent]";
- mes "\"I'm sure I will give a small reward. :D\"";
+ mes "\"I'm sure I will give a small reward.\"";
next;
goto L_Wait;
L_Wait:
- mes "[Vincent]";
mes "\"Now please go get me 10 Bug Legs.\"";
goto L_Close;
L_Progress:
- if(countitem("BugLeg") >= 10) goto L_Have;
+ if(countitem("BugLeg") >= 10)
+ goto L_Have;
mes "[Vincent]";
- mes "\"Please help me collect 10 Bug Legs!\"";
+ mes "\"Please help me collect 10 Bug Legs! I need them to complete my action figure.\"";
goto L_Close;
L_Have:
mes "[Vincent]";
mes "\"Excellent! Finally I can complete the model!!\"";
next;
- if(countitem("BugLeg") < 10) goto L_Progress;
+ if(countitem("BugLeg") < 10)
+ goto L_Progress;
delitem "BugLeg", 10;
set Zeny, Zeny + 1000;
- set TMW_Quest, 10;
+ set @state, 2;
+ callsub S_Update_Var;
mes "[Vincent]";
mes "\"Here you go, a little of my appreciation!\"";
@@ -127,8 +120,13 @@ L_Done:
L_Close:
set @TEMP, 0;
+ set @state, 0;
close;
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_2_MASK) | (@state << NIBBLE_2_SHIFT));
+ return;
+
L_TrickOrTreat:
callfunc "TrickOrTreat2011";
goto L_Begin;
diff --git a/world/map/npc/001-2/troupe_leader.txt b/world/map/npc/001-2/troupe_leader.txt
index f34408d3..f69629a5 100644
--- a/world/map/npc/001-2/troupe_leader.txt
+++ b/world/map/npc/001-2/troupe_leader.txt
@@ -1,12 +1,16 @@
//
001-2.gat,34,25,0|script|Troupe Leader|165,{
- if (Inspector == 4) goto L_NohMask_Troupe;
- if (Inspector == 13) goto L_NohMask_Found;
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
+ if (@inspector == 4) goto L_NohMask_Troupe;
+ if (@inspector == 13) goto L_NohMask_Found;
mes "[Troupe Leader]";
mes "\"Hello. I'm the leader of a traveling theater troupe. We'll be staying here in Tulimshar for a while.\"";
- close;
+ goto L_Close;
L_NohMask_Troupe:
mes "[Troupe Leader]";
@@ -15,19 +19,19 @@ L_NohMask_Troupe:
menu
"Any ideas on who might have taken it?", L_NohMask_Idea,
"Are you sure one of your troupe members didn't hide it and commit those robberies?", L_NohMask_Accuse,
- "Hmm...", -;
- close;
+ "Hmm...", L_Close;
L_NohMask_Idea:
- set Inspector, 5;
+ set @inspector, 5;
+ callsub S_Update_Mask;
mes "[Troupe Leader]";
mes "\"Hm...I did see an old man hang out near the theater after our last show.\"";
- close;
+ goto L_Close;
L_NohMask_Accuse:
mes "[Troupe Leader]";
mes "\"I am absolutely positive. None of my troupe have left the city since we got here. Good day!\"";
- close;
+ goto L_Close;
L_NohMask_Found:
mes "[Troupe Leader]";
@@ -36,16 +40,25 @@ L_NohMask_Found:
if (@inventorylist_count == 100) goto L_NohMask_TooMany;
mes "[1500 experience points]";
getexp 1500, 0;
- set Inspector, 14;
+ set @inspector, 14;
+ callsub S_Update_Mask;
getitem "NohMask", 1;
next;
mes "[Troupe Leader]";
mes "\"We don't need it anymore. We're doing different shows here.\"";
- close;
+ goto L_Close;
L_NohMask_TooMany:
next;
mes "[Troupe Leader]";
mes "\"Except, you don't seem to have any room for it. I'll hold onto it for you until you do have room.\"";
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
+
+S_Update_Mask:
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_3_MASK)) | (@inspector << NIBBLE_3_SHIFT);
+ return;
}
diff --git a/world/map/npc/002-1/lieutenant_dausen.txt b/world/map/npc/002-1/lieutenant_dausen.txt
index 95e2bb02..515cd76a 100644
--- a/world/map/npc/002-1/lieutenant_dausen.txt
+++ b/world/map/npc/002-1/lieutenant_dausen.txt
@@ -1,41 +1,55 @@
// Lieutenant in charge of monitoring the monster threat surrounding the city.
+// Variables used: nibble 4 and 5 of QUEST_SouthTulimshar
002-1.gat,54,27,0|script|Lieutenant Dausen|122,{
- if (TMW_Quest == 33) goto L_LD_Key;
- if (TMW_Quest == 19) goto L_LD_Miners;
- if (TMW_Quest == 18) goto L_LD_Orders;
- if (TMW_Quest == 17) goto L_LD_Nickos_Waits;
- if (TMW_Quest == 16) goto L_LD_Nickos;
- if (TMW_Quest == 15) goto L_LD_Waits;
- if (TMW_Quest == 14) goto L_LD_Woe_Is_Me;
- if (TMW_Quest == 13) goto L_LD_Drinks;
- if (TMW_Quest == 12) goto L_LD_Start;
- if (TMW_Quest < 12) goto L_LD_Get_Rep_First;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
- mes "[Lieutenant Dausen]";
- mes "\"Hello. I am Lieutenant Dausen. I monitor the monster threat around the city to ensure the safety of its citizens.\"";
- close;
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state == 21) goto L_LD_Key;
+ if (@state == 7) goto L_LD_Miners;
+ if (@state == 6) goto L_LD_Orders;
+ if (@state == 5) goto L_LD_Nickos_Waits;
+ if (@state == 4) goto L_LD_Nickos;
+ if (@state == 3) goto L_LD_Waits;
+ if (@state == 2) goto L_LD_Woe_Is_Me;
+ if (@state == 1) goto L_LD_Drinks;
+
+ set @bermik, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+ set @sarah, ((QUEST_SouthTulimshar & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT);
+ set @vincent, ((QUEST_SouthTulimshar & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
+ set @sandra, ((QUEST_SouthTulimshar & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
+ if ((@bermik >= 6) && (@sarah >= 2) && (@vincent >= 2) && (@sandra >= 2))
+ goto L_LD_Start;
-L_LD_Get_Rep_First:
mes "[Lieutenant Dausen]";
mes "\"Hello. I am Lieutenant Dausen. I monitor the monster threat around the city to ensure the safety of its citizens.\"";
next;
+
+ if (@state)
+ goto L_Close;
mes "[Lieutenant Dausen]";
mes "\"I may have a job for you, stranger, but first I would like to learn more about you. Go walk among the citizens of Tulimshar, see if any of them could use some help. Once you have established a good reputation, word will get to me.\"";
- close;
+ goto L_Close;
L_LD_Start:
- set TMW_Quest, 13;
+ set @state, 1;
+ callsub S_Update_Var;
mes "[Lieutenant Dausen]";
mes "\"Out here in the desert, it sure does get hot! My men and I get thirsty rather quickly. Cactus Drinks are our favourite; if you can get some for us, we'd surely appreciate your effort. About 10 would do.\"";
- close;
+ goto L_Close;
L_LD_Drinks:
- if (countitem ("CactusDrink") < 10) goto L_LD_NotEnough_Drink;
+ if (countitem ("CactusDrink") < 10)
+ goto L_LD_NotEnough_Drink;
getinventorylist;
- if (@inventorylist_count - (countitem("CactusDrink") == 10) > 99) goto L_LD_TooMany;
- set TMW_Quest, 14;
+ if (@inventorylist_count - (countitem("CactusDrink") == 10) > 99)
+ goto L_LD_TooMany;
+ set @state, 2;
+ callsub S_Update_Var;
delitem "CactusDrink", 10;
getitem "Boots", 1;
mes "[Lieutenant Dausen]";
@@ -47,17 +61,16 @@ L_LD_Drinks:
menu
"I can help you out, since you helped me too.", L_LD_Help,
"Thanks for the boots, gotta run now.", L_LD_NoHelp;
- close;
L_LD_NotEnough_Drink:
mes "[Lieutenant Dausen]";
mes "\"Hi again. My men and I sure are thirsty for our favorite drink, the Cactus Drink. If we had about 10, it would help us out a great deal in this sandstorm.\"";
- close;
+ goto L_Close;
L_LD_TooMany:
mes "[Lieutenant Dausen]";
mes "\"Oh, it seems you have too many items for me to give you a reward. Come back after you drop or sell some items.\"";
- close;
+ goto L_Close;
L_LD_Woe_Is_Me:
mes "[Lieutenant Dausen]";
@@ -65,54 +78,69 @@ L_LD_Woe_Is_Me:
menu
"I can help you out, since you helped me out too.", L_LD_Help,
"Bye-bye.", L_LD_NoHelp;
- close;
L_LD_Help:
- set TMW_Quest, 15;
+ set @state, 3;
+ callsub S_Update_Var;
mes "[Lieutenant Dausen]";
mes "\"Oh! Would you? You are ever most helpful! Could you let Stewen know first? I'm the most worried about the monsters from the eastern desert and he should know first to hold his post. Come back to me after you see him. Hope to hear from you soon!\"";
- close;
+ goto L_Close;
L_LD_NoHelp:
mes "[Lieutenant Dausen]";
mes "\"See you later then.\"";
- close;
+ goto L_Close;
L_LD_Waits:
mes "[Lieutenant Dausen]";
mes "\"I do hope Stewen holds his post. If you could tell them to do so, it would help me out a great deal.\"";
- close;
+ goto L_Close;
L_LD_Nickos:
- set TMW_Quest, 17;
+ set @state, 5;
+ callsub S_Update_Var;
mes "[Lieutenant Dausen]";
mes "\"Thanks for letting Stewen know. Can you now tell Nickos to hold his post too? He guards the mine to the south, monitoring the monster threat and protecting the miners when he can.\"";
- close;
+ goto L_Close;
L_LD_Nickos_Waits:
mes "[Lieutenant Dausen]";
mes "\"Could you let Nickos know to hold his post? It would be very helpful. He is guarding the mine south of here.\"";
- close;
+ goto L_Close;
L_LD_Orders:
- set TMW_Quest, 19;
+ set @state, 7;
+ callsub S_Update_Var;
set Zeny, Zeny + 500;
mes "[Lieutenant Dausen]";
mes "\"Thank you for clearing up the orders to my men! Here's some gold for your efforts.\"";
next;
mes "\"If you think you can handle the monsters lurking out here, I'm sure Nickos and the miners could use some help. Talk to you later.\"";
- close;
+ goto L_Close;
L_LD_Miners:
mes "[Lieutenant Dausen]";
mes "\"I monitor the monster threat around the city to ensure the safety of its citizens.\"";
next;
mes "\"If you think you can handle the monsters lurking out here, I'm sure Nickos and the miners could use some help. Talk to you later.\"";
- close;
+ goto L_Close;
L_LD_Key:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "[Lieutenant Dausen]";
mes "\"Oh, Naem lost his key? Here, take this spare. It should help you get into the underground palace.\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
+ set @bermik, 0;
+ set @sarah, 0;
+ set @vincent, 0;
+ set @sandra, 0;
close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@state << BYTE_2_SHIFT));
+ return;
}
diff --git a/world/map/npc/002-1/nickos.txt b/world/map/npc/002-1/nickos.txt
index 011fc5ad..67ac2d63 100644
--- a/world/map/npc/002-1/nickos.txt
+++ b/world/map/npc/002-1/nickos.txt
@@ -1,21 +1,27 @@
// Sandstorm mine guard
+// Variables used: nibble 4 and 5 of QUEST_SouthTulimshar
002-1.gat,28,94,0|script|Nickos|123,{
- if (TMW_Quest == 32) goto L_Nickos_UGQ;
- if (TMW_Quest == 31) goto L_Nickos_AS_Done;
- if (TMW_Quest == 30) goto L_Nickos_AS_Start;
- if (TMW_Quest >= 23) && (TMW_Quest < 30) goto L_Nickos_Guards;
- if (TMW_Quest == 22) goto L_Nickos_Check_Happy;
- if (TMW_Quest > 19) && (TMW_Quest < 22) goto L_Nickos_Waits;
- if (TMW_Quest == 19) goto L_Nickos_Mine;
- if (TMW_Quest == 18) goto L_Nickos_Orders_Received;
- if (TMW_Quest == 17) goto L_Nickos_Orders;
- if (TMW_Quest < 17) goto L_Nickos_See_Dausen_First;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state == 20) goto L_Nickos_UGQ;
+ if (@state == 19) goto L_Nickos_AS_Done;
+ if (@state == 18) goto L_Nickos_AS_Start;
+ if (@state >= 11) && (@state < 18) goto L_Nickos_Guards;
+ if (@state == 10) goto L_Nickos_Check_Happy;
+ if (@state > 7) && (@state < 10) goto L_Nickos_Waits;
+ if (@state == 7) goto L_Nickos_Mine;
+ if (@state == 6) goto L_Nickos_Orders_Received;
+ if (@state == 5) goto L_Nickos_Orders;
+ if (@state < 5) goto L_Nickos_See_Dausen_First;
mes "[Nickos]";
mes "\"I'm watching this mine to make sure the monsters don't harm the miners.\"";
- close;
+ goto L_Close;
L_Nickos_See_Dausen_First:
mes "[Nickos]";
@@ -23,19 +29,19 @@ L_Nickos_See_Dausen_First:
next;
mes "[Nickos]";
mes "\"The mines are closed from tourists due to the monster threat. If you want to get in you will need to prove yourself first. Talk to Lieutenant Dausen, my superior, if you want to make a formal complaint.\"";
- close;
-
+ goto L_Close;
L_Nickos_Orders:
- set TMW_Quest, 18;
+ set @state, 6;
+ callsub S_Update_Var;
mes "[Nickos]";
mes "\"I have to hold my post longer? Argh! I was looking forward to my break. Oh well, thanks for letting me know.\"";
- close;
+ goto L_Close;
L_Nickos_Orders_Received:
mes "[Nickos]";
mes "\"Thanks for letting me know Lieutenant Dausen wants me to stick it out for a while longer. Even though I would've liked my break, I'm sure these miners could use my watchful eye.\"";
- close;
+ goto L_Close;
L_Nickos_Mine:
mes "[Nickos]";
@@ -46,68 +52,81 @@ L_Nickos_Mine:
menu
"Yes.", L_Nickos_Mine_Open,
"No.", L_Nickos_Disappoint;
- close;
L_Nickos_Disappoint:
mes "Nickos looks disappointed.";
- close;
+ goto L_Close;
L_Nickos_Mine_Open:
- set TMW_Quest, 20;
+ set @state, 8;
+ callsub S_Update_Var;
mes "[Nickos]";
mes "\"Excellent! You now have my permission to enter the mine. Your assistance helps ease my worries.\"";
- close;
+ goto L_Close;
L_Nickos_Waits:
mes "[Nickos]";
mes "\"Please be sure to get word from Nathan and Naem to make sure everthing is okay down there. Your assistance helps ease my worries.\"";
- close;
+ goto L_Close;
L_Nickos_Check_Happy:
- set TMW_Quest, 23;
+ set @state, 11;
+ callsub S_Update_Var;
set Zeny, Zeny + 500;
mes "[Nickos]";
mes "\"Oh, everything is okay? That's great! I think they are pretty busy and could use some help. Feel free to give them a hand. Here's some gold for your troubles.\"";
- close;
+ goto L_Close;
L_Nickos_Guards:
mes "[Nickos]";
mes "\"I'm watching this mine to make sure the monsters don't harm the miners.\"";
next;
mes "\"Talk to Nathan the miner, I'm sure the miners could use some help down there.\"";
- close;
+ goto L_Close;
L_Nickos_AS_Start:
- set TMW_Quest, 31;
+ set @state, 19;
+ callsub S_Update_Var;
mes "[Nickos]";
mes "\"Oh, the angry scorpions are becoming a problem? We could thin down their numbers a bit. I can make it worth your time, but of course, I'll need something to show your work. Bring me 10 Angry Scorpion Stingers to demonstrate your effectiveness, and you will be rewarded for your efforts.\"";
- close;
+ goto L_Close;
L_Nickos_AS_Done:
- if (countitem ("AngryScorpionStinger") < 10) goto L_Nickos_AS_NotDone;
+ if (countitem ("AngryScorpionStinger") < 10)
+ goto L_Nickos_AS_NotDone;
getinventorylist;
- if (@inventorylist_count - (countitem("AngryScorpionStinger") == 10) > 99) goto L_Nickos_TooMany;
- set TMW_Quest, 32;
+ if (@inventorylist_count - (countitem("AngryScorpionStinger") == 10) > 99)
+ goto L_Nickos_TooMany;
+ set @state, 20;
+ callsub S_Update_Var;
delitem "AngryScorpionStinger", 10;
getitem "LeatherShield", 1;
mes "[Nickos]";
mes "\"Ah, you are a fine combatant! Take this Leather Shield, it might be useful for your future battles.\"";
next;
mes "\"You might be ready to take on the underground palace. If you are interested, go talk to Naem about unlocking the barrier, he's got the key and the code to open it.\"";
- close;
+ goto L_Close;
L_Nickos_AS_NotDone:
mes "[Nickos]";
mes "\"Bring me 10 Angry Scorpion Stingers and I'll know their numbers are down. You will be rewarded for your efforts.\"";
- close;
+ goto L_Close;
L_Nickos_TooMany:
mes "[Nickos]";
mes "\"Oh, it seems you have too many items. Please get rid some some and I'll give you a reward.\"";
- close;
+ goto L_Close;
L_Nickos_UGQ:
mes "[Nickos]";
mes "\"You might be ready to take on the underground palace. If you are interested, talk to the miners about unlocking the barrier, they've got the key to open it.\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@state << BYTE_2_SHIFT));
+ return;
}
diff --git a/world/map/npc/002-1/sandstorm_mine_barrier.txt b/world/map/npc/002-1/sandstorm_mine_barrier.txt
index 9814ffb9..49c9b733 100644
--- a/world/map/npc/002-1/sandstorm_mine_barrier.txt
+++ b/world/map/npc/002-1/sandstorm_mine_barrier.txt
@@ -2,11 +2,21 @@
002-1.gat,20,94,0|script|#Sandstorm_Mine_Barrier|45,0,0,{
- if (TMW_Quest >= 20) goto L_Sandstorm_Barrier_Open;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state >= 8) goto L_Sandstorm_Barrier_Open;
+
message strcharinfo(0), "Some force seems to block your entrance.";
- end;
+ goto L_End;
L_Sandstorm_Barrier_Open:
warp "002-3.gat",37,31;
+ goto L_End;
+
+L_End:
+ set @state, 0;
end;
}
diff --git a/world/map/npc/002-1/stewen.txt b/world/map/npc/002-1/stewen.txt
index b0c98ebe..0aa04b34 100644
--- a/world/map/npc/002-1/stewen.txt
+++ b/world/map/npc/002-1/stewen.txt
@@ -1,22 +1,37 @@
// East sandstorm guard
+// Variables used: nibble 4 and 5 of QUEST_SouthTulimshar
002-1.gat,106,76,0|script|Stewen|123,{
- if (TMW_Quest == 16) goto L_TMW_Quest_Received;
- if (TMW_Quest == 15) goto L_TMW_Quest;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state == 4) goto L_TMW_Quest_Received;
+ if (@state == 3) goto L_TMW_Quest;
mes "[Stewen]";
mes "\"I'm keeping a watchful eye on the monsters to the east so they don't threaten Tulimshar's citizens. They are pretty strong.\"";
- close;
+ goto L_Close;
L_TMW_Quest:
- set TMW_Quest, 16;
+ set @state, 4;
+ callsub S_Update_Var;
mes "[Stewen]";
mes "\"I don't get a break?! Lieutenant Dausen needs to ask the Wizard's Council for more help out here. Either that or give me a raise! Oh well. Thanks for letting me know.\"";
- close;
+ goto L_Close;
L_TMW_Quest_Received:
mes "[Stewen]";
mes "\"Thanks again for letting me know Lieutenant Dausen isn't letting me take a break. Once I get out of here, I'll let him know I want a raise!\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@state << BYTE_2_SHIFT));
+ return;
}
diff --git a/world/map/npc/002-3/mine_triggerone.txt b/world/map/npc/002-3/mine_triggerone.txt
index b757c453..c4e7569f 100644
--- a/world/map/npc/002-3/mine_triggerone.txt
+++ b/world/map/npc/002-3/mine_triggerone.txt
@@ -1,13 +1,19 @@
//Sandstorm mine trigger 1 Trigger 002-3 35,43 (127)
+// Variables used: nibble 4 and 5 of QUEST_SouthTulimshar
002-3.gat,30,47,0|script|Button|127,0,0,{
- if (TMW_Quest == 36) goto L_Trigger_Wrong_1;
- if (TMW_Quest == 35) goto L_Trigger_Wrong_1;
- if (TMW_Quest == 34) goto L_Trigger_1;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state == 24) goto L_Trigger_Wrong_1;
+ if (@state == 23) goto L_Trigger_Wrong_1;
+ if (@state == 22) goto L_Trigger_1;
mes "There is a large button on the ground. A key hole appears on the button.";
- close;
+ goto L_Close;
L_Trigger_Wrong_1:
mes "There is a large button on the ground. A key hole appears on the button.";
@@ -15,17 +21,18 @@ L_Trigger_Wrong_1:
"Put the key in, turn right.", L_Right_Wrong_1,
"Put the key in, turn left.", L_Left_Wrong_1,
"Do nothing.", L_Nothing_1;
- close;
L_Right_Wrong_1:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "You turn the key right.";
- close;
+ goto L_Close;
L_Left_Wrong_1:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "You turn the key left.";
- close;
+ goto L_Close;
L_Trigger_1:
mes "There is a large button on the ground. A key hole appears on the button.";
@@ -33,19 +40,28 @@ L_Trigger_1:
"Put the key in, turn right.", L_Right_1,
"Put the key in, turn left.", L_Left_1,
"Do nothing.", L_Nothing_1;
- close;
L_Right_1:
- set TMW_Quest, 35;
+ set @state, 23;
+ callsub S_Update_Var;
mes "You turn the key right. A clicking sound echoes throughout the mine.";
- close;
+ goto L_Close;
L_Left_1:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "You turn the key left.";
- close;
+ goto L_Close;
L_Nothing_1:
mes "You leave the button alone.";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@state << BYTE_2_SHIFT));
+ return;
}
diff --git a/world/map/npc/002-3/mine_triggerthree.txt b/world/map/npc/002-3/mine_triggerthree.txt
index c1b7b3c6..bd234617 100644
--- a/world/map/npc/002-3/mine_triggerthree.txt
+++ b/world/map/npc/002-3/mine_triggerthree.txt
@@ -1,13 +1,19 @@
//Sandstorm mine trigger 3 Trigger 002-3 98,42 (127)
+// Variables used: nibble 4 and 5 of QUEST_SouthTulimshar
002-3.gat,91,99,0|script|Button|127,0,0,{
- if (TMW_Quest == 36) goto L_Trigger_Wrong_3;
- if (TMW_Quest == 35) goto L_Trigger_3;
- if (TMW_Quest == 34) goto L_Trigger_Wrong_3;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state == 24) goto L_Trigger_Wrong_3;
+ if (@state == 23) goto L_Trigger_3;
+ if (@state == 22) goto L_Trigger_Wrong_3;
mes "There is a large button on the ground. A key hole appears on the button.";
- close;
+ goto L_Close;
L_Trigger_Wrong_3:
mes "There is a large button on the ground. A key hole appears on the button.";
@@ -15,17 +21,18 @@ L_Trigger_Wrong_3:
"Put the key in, turn right.", L_Right_Wrong_3,
"Put the key in, turn left.", L_Left_Wrong_3,
"Do nothing.", L_Nothing_3;
- close;
L_Right_Wrong_3:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "You turn the key right.";
- close;
+ goto L_Close;
L_Left_Wrong_3:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "You turn the key left.";
- close;
+ goto L_Close;
L_Trigger_3:
mes "There is a large button on the ground. A key hole appears on the button.";
@@ -33,19 +40,28 @@ L_Trigger_3:
"Put the key in, turn right.", L_Right_3,
"Put the key in, turn left.", L_Left_3,
"Do nothing.", L_Nothing_3;
- close;
L_Right_3:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "You turn the key right.";
- close;
+ goto L_Close;
L_Left_3:
- set TMW_Quest, 36;
+ set @state, 24;
+ callsub S_Update_Var;
mes "You turn the key left. A clicking sound echoes throughout the mine.";
- close;
+ goto L_Close;
L_Nothing_3:
mes "You leave the button alone.";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@state << BYTE_2_SHIFT));
+ return;
}
diff --git a/world/map/npc/002-3/mine_triggertwo.txt b/world/map/npc/002-3/mine_triggertwo.txt
index 478351b1..0cc43552 100644
--- a/world/map/npc/002-3/mine_triggertwo.txt
+++ b/world/map/npc/002-3/mine_triggertwo.txt
@@ -1,13 +1,21 @@
//Sandstorm mine trigger
+// Variables used:
+// - nibble 4 and 5 of QUEST_SouthTulimshar
+// - in FLAGS, FLAG_OPENED_UNDERGROUND
002-3.gat,100,37,0|script|Button|127,0,0,{
- if (TMW_Quest == 36) goto L_Trigger_2;
- if (TMW_Quest == 35) goto L_Trigger_Wrong_2;
- if (TMW_Quest == 34) goto L_Trigger_Wrong_2;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state == 24) goto L_Trigger_2;
+ if (@state == 23) goto L_Trigger_Wrong_2;
+ if (@state == 22) goto L_Trigger_Wrong_2;
mes "There is a large button on the ground. A key hole appears on the button.";
- close;
+ goto L_Close;
L_Trigger_Wrong_2:
mes "There is a large button on the ground. A key hole appears on the button.";
@@ -15,17 +23,18 @@ L_Trigger_Wrong_2:
"Put the key in, turn right.", L_Right_Wrong_2,
"Put the key in, turn left.", L_Left_Wrong_2,
"Do nothing.", L_Nothing_2;
- close;
L_Right_Wrong_2:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "You turn the key right.";
- close;
+ goto L_Close;
L_Left_Wrong_2:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "You turn the key left.";
- close;
+ goto L_Close;
L_Trigger_2:
mes "There is a large button on the ground. A key hole appears on the button.";
@@ -33,20 +42,29 @@ L_Trigger_2:
"Put the key in, turn right.", L_Right_2,
"Put the key in, turn left.", L_Left_2,
"Do nothing.", L_Nothing_2;
- close;
L_Right_2:
- set TMW_Quest, 34;
+ set @state, 22;
+ callsub S_Update_Var;
mes "You turn the key right.";
- close;
+ goto L_Close;
L_Left_2:
- set TMW_Quest, 37;
+ set @state, 25;
+ callsub S_Update_Var;
set FLAGS, FLAGS | FLAG_OPENED_UNDERGROUND;
mes "You turn the key left. A clicking sound echoes throughout the mine, followed by a loud thump.";
- close;
+ goto L_Close;
L_Nothing_2:
mes "You leave the button alone.";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@state << BYTE_2_SHIFT));
+ return;
}
diff --git a/world/map/npc/002-3/naem.txt b/world/map/npc/002-3/naem.txt
index d5ddbd2b..bfcde613 100644
--- a/world/map/npc/002-3/naem.txt
+++ b/world/map/npc/002-3/naem.txt
@@ -1,39 +1,49 @@
-//
+// Variables used:
+// - nibble 4 and 5 of QUEST_SouthTulimshar
+// - in FLAGS, bits FLAG_GOT_NAEM_GLOVES and FLAG_OPENED_UNDERGROUND
002-3.gat,85,97,6|script|Naem|109,{
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
if (FLAGS & FLAG_GOT_NAEM_GLOVES) goto L_Naem_Complete;
if (FLAGS & FLAG_OPENED_UNDERGROUND) goto L_Naem_Gloves;
- if (TMW_Quest == 34) goto L_Naem_Code;
- if (TMW_Quest == 33) goto L_Naem_Lt;
- if (TMW_Quest == 32) goto L_Naem_Memory;
- if (TMW_Quest > 29) && (TMW_Quest < 31)goto L_Naem_Great;
- if (TMW_Quest == 29) goto L_Naem_Waits_3;
- if (TMW_Quest == 28) goto L_Naem_Help_3;
- if (TMW_Quest == 27) goto L_Naem_Waits_2;
- if (TMW_Quest == 26) goto L_Naem_Help_2;
- if (TMW_Quest == 25) goto L_Naem_Waits_1;
- if (TMW_Quest == 24) goto L_Naem_Help_1;
- if (TMW_Quest == 22) goto L_Naem_Cool;
- if (TMW_Quest == 21) goto L_Naem_Okay;
+ if (@state == 22) goto L_Naem_Code;
+ if (@state == 21) goto L_Naem_Lt;
+ if (@state == 20) goto L_Naem_Memory;
+ if ((@state > 17) && (@state < 19))
+ goto L_Naem_Great;
+ if (@state == 17) goto L_Naem_Waits_3;
+ if (@state == 16) goto L_Naem_Help_3;
+ if (@state == 15) goto L_Naem_Waits_2;
+ if (@state == 14) goto L_Naem_Help_2;
+ if (@state == 13) goto L_Naem_Waits_1;
+ if (@state == 12) goto L_Naem_Help_1;
+ if (@state == 10) goto L_Naem_Cool;
+ if (@state == 9) goto L_Naem_Okay;
mes "[Naem]";
mes "\"I'm just mining away here. Lots of work to do.\"";
- close;
+ goto L_Close;
L_Naem_Okay:
- set TMW_Quest, 22;
+ set @state, 10;
+ callsub S_Update_Var;
mes "[Naem]";
mes "\"Oh, hello there. Nickos wanted you to check on me? Yeah, you can tell him I'm okay.\"";
- close;
+ goto L_Close;
L_Naem_Cool:
mes "[Naem]";
mes "\"Yeah, I'm cool. Just mining away here.\"";
- close;
+ goto L_Close;
L_Naem_Help_1:
- set TMW_Quest, 25;
+ set @state, 13;
+ callsub S_Update_Var;
mes "[Naem]";
mes "\"Oh, you are here to help move my bags? Cool, I've got a few ready to go. Go ahead and take this one!\"";
next;
@@ -41,43 +51,45 @@ L_Naem_Help_1:
next;
mes "[Naem]";
mes "\"After you deliver that one to Nathan, come on back, I've got a couple more ready to go.\"";
- close;
+ goto L_Close;
L_Naem_Waits_1:
mes "[Naem]";
mes "\"After you deliver that bag of ore to Nathan, come on back, I've got a couple more ready to go.\"";
- close;
+ goto L_Close;
L_Naem_Help_2:
- set TMW_Quest, 27;
+ set @state, 15;
+ callsub S_Update_Var;
mes "Naem gives you a bag of ore.";
next;
mes "[Naem]";
mes "\"Just one more after this one and we'll be all caught up!\"";
- close;
+ goto L_Close;
L_Naem_Waits_2:
mes "[Naem]";
mes "\"Just one more bag of ore after the one you got and we'll be all caught up!\"";
- close;
+ goto L_Close;
L_Naem_Help_3:
- set TMW_Quest, 29;
+ set @state, 17;
+ callsub S_Update_Var;
mes "[Naem]";
mes "Hands a bag of ore to you.";
next;
mes "\"Last one!\"";
- close;
+ goto L_Close;
L_Naem_Waits_3:
mes "[Naem]";
mes "\"You got my last sack already. Just give it to Nathan and we'll have caught up.\"";
- close;
+ goto L_Close;
L_Naem_Great:
mes "[Naem]";
mes "\"Hi ho! It's off to work I go! I work every day for meager pay, a miner's life for me...\"";
- close;
+ goto L_Close;
L_Naem_Memory:
mes "You see Naem grimacing in pain as you approach.";
@@ -87,45 +99,54 @@ L_Naem_Memory:
menu
"Don't you have a key so I can go to the underground palace?", L_Naem_Palace_No,
"You should be more careful.", L_Naem_Duh;
- close;
L_Naem_Duh:
mes "[Naem]";
mes "\"I guess I should...\"";
- close;
+ goto L_Close;
L_Naem_Palace_No:
- set TMW_Quest, 33;
+ set @state, 21;
+ callsub S_Update_Var;
mes "[Naem]";
mes "\"Oh no! I lost the key! Don't worry though, talk to Lieutenant Dausen about getting the spare key.\"";
- close;
+ goto L_Close;
L_Naem_Lt:
mes "[Naem]";
mes "\"I hurt my head pretty bad. I also lost my key. If you want to get into the underground palace, you'll have to talk to Lieutenant Dausen about getting the spare.\"";
- close;
+ goto L_Close;
L_Naem_Code:
mes "[Naem]";
mes "\"Oh, you got the key. That is good! But my head still hurts... All I remember about the code is you have to put the key into the key hole buttons around the mine in a certain order and turn them in a certain order and it will unlock the underground palace. Sorry, that's all I have for you. Good luck!\"";
- close;
+ goto L_Close;
L_Naem_Gloves:
getinventorylist;
- if (@inventorylist_count == 100) goto L_Nathan_TooMany;
+ if (@inventorylist_count == 100)
+ goto L_Nathan_TooMany;
set FLAGS, FLAGS | FLAG_GOT_NAEM_GLOVES;
getitem "MinerGloves", 1;
mes "[Naem]";
mes "\"Hey, good job on getting that together! Take these gloves, they might prove useful in the underground palace.\"";
- close;
+ goto L_Close;
L_Naem_TooMany:
mes "[Naem]";
mes "\"You have too many items for me to give you a reward.\"";
- close;
+ goto L_Close;
L_Naem_Complete:
mes "[Naem]";
mes "\"Yo-ho-ho, a miner's life for me!\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@state << BYTE_2_SHIFT));
+ return;
}
diff --git a/world/map/npc/002-3/nathan.txt b/world/map/npc/002-3/nathan.txt
index 7a6b5fd5..b668f7b7 100644
--- a/world/map/npc/002-3/nathan.txt
+++ b/world/map/npc/002-3/nathan.txt
@@ -1,76 +1,87 @@
-//
+// Variables used: nibble 4 and 5 of QUEST_SouthTulimshar
002-3.gat,35,35,6|script|Nathan|109,{
- if (TMW_Quest >= 32) goto L_Nathan_Complete;
- if (TMW_Quest == 31) goto L_Nathan_UGQ_Naem;
- if (TMW_Quest == 30) goto L_Nathan_Help_Cool;
- if (TMW_Quest == 29) goto L_Nathan_Help_Done;
- if (TMW_Quest == 28) goto L_Nathan_Waits_3;
- if (TMW_Quest == 27) goto L_Nathan_Help_3;
- if (TMW_Quest == 26) goto L_Nathan_Waits_2;
- if (TMW_Quest == 25) goto L_Nathan_Help_2;
- if (TMW_Quest == 24) goto L_Nathan_Waits_1;
- if (TMW_Quest == 23) goto L_Nathan_Help_1;
- if (TMW_Quest == 21) goto L_Nathan_Cool;
- if (TMW_Quest == 20) goto L_Nathan_Okay;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state >= 20) goto L_Nathan_Complete;
+ if (@state == 19) goto L_Nathan_UGQ_Naem;
+ if (@state == 18) goto L_Nathan_Help_Cool;
+ if (@state == 17) goto L_Nathan_Help_Done;
+ if (@state == 16) goto L_Nathan_Waits_3;
+ if (@state == 15) goto L_Nathan_Help_3;
+ if (@state == 14) goto L_Nathan_Waits_2;
+ if (@state == 13) goto L_Nathan_Help_2;
+ if (@state == 12) goto L_Nathan_Waits_1;
+ if (@state == 11) goto L_Nathan_Help_1;
+ if (@state == 9) goto L_Nathan_Cool;
+ if (@state == 8) goto L_Nathan_Okay;
mes "[Nathan the Miner]";
mes "\"It's very dangerous in here. We had a big earthquake here just recently, too... so be careful!\"";
- close;
+ goto L_Close;
L_Nathan_Okay:
- set TMW_Quest, 21;
+ set @state, 9;
+ callsub S_Update_Var;
mes "[Nathan]";
mes "\"Hey there! Just mining away down here. You say Nickos was worried about us? Nothing down here we can't handle, but you should try to be safe down here yourself. The monsters can be rather aggressive. Come to think of it, you might want to check on Naem to make sure he's okay. You can find him in the southeast parts of the mine.\"";
- close;
+ goto L_Close;
L_Nathan_Cool:
mes "[Nathan]";
mes "\"Hey, be careful down here, the monsters can be rather aggressive! You might want to check on Naem too. He's at the southeast parts of the mine.\"";
- close;
+ goto L_Close;
L_Nathan_Help_1:
- set TMW_Quest, 24;
+ set @state, 12;
+ callsub S_Update_Var;
mes "[Nathan]";
mes "\"Oh, hey again! Nickos told you we need some help down here too? Yeah, Naem could use a spare pair of hands moving his bags of ore to me. He's got a lot of work built up. Just go talk to him and he'll give you the bags. You might have to make a few trips, but I'll make it worth your troubles.\"";
- close;
+ goto L_Close;
L_Nathan_Waits_1:
mes "[Nathan]";
mes "\"Naem could use some help moving his bags of ore to me. He's got a lot of work built up. Just go talk to him and he'll give you the bags. You might have to make a few trips, but I'll make it worth your troubles.\"";
- close;
+ goto L_Close;
L_Nathan_Help_2:
- set TMW_Quest, 26;
+ set @state, 14;
+ callsub S_Update_Var;
mes "You give the bag of ore to Nathan";
next;
mes "[Nathan]";
mes "\"Ah, thank you. Just a couple more and we'll have caught up!\"";
- close;
+ goto L_Close;
L_Nathan_Waits_2:
mes "[Nathan]";
mes "\"Just a couple more and we'll be all caught up!\"";
- close;
+ goto L_Close;
L_Nathan_Help_3:
- set TMW_Quest, 28;
+ set @state, 16;
+ callsub S_Update_Var;
mes "You hand the bag of ore to Nathan.";
next;
mes "[Nathan]";
mes "\"Just one more bag and you'll be done!\"";
- close;
+ goto L_Close;
L_Nathan_Waits_3:
mes "[Nathan]";
mes "\"Just get one more bag of ore from Naem and bring it to me and you'll be done.\"";
- close;
+ goto L_Close;
L_Nathan_Help_Done:
getinventorylist;
- if (@inventorylist_count == 100) goto L_Nathan_TooMany;
- set TMW_Quest, 30;
+ if (@inventorylist_count == 100)
+ goto L_Nathan_TooMany;
+ set @state, 18;
+ callsub S_Update_Var;
getitem "MinersHat", 1;
mes "[Nathan]";
mes "You hand the bag of ore to Nathan.";
@@ -78,25 +89,33 @@ L_Nathan_Help_Done:
mes "\"Ah, that should be it! Thank you for your help. Here, take this Miner's Hat. You're a real miner now!\"";
next;
mes "\"Oh, and I noticed a problem with these angry scorpions down here, they seem to make things much more difficult. Maybe you could tell Nickos about it on your way out?\"";
- close;
+ goto L_Close;
L_Nathan_TooMany:
mes "[Nathan]";
mes "\"You have too many items for me to give you a reward.\"";
- close;
+ goto L_Close;
L_Nathan_Help_Cool:
mes "[Nathan]";
mes "\"Be safe down here, it's dangerous for the unexperienced. Mining is a dangerous job, but somebody's got to do it!\"";
- close;
+ goto L_Close;
L_Nathan_UGQ_Naem:
mes "[Nathan]";
mes "\"Thanks for thinning down the angry scorpion population. It sure has made mining a little easier down here! Oh, you say Nickos has given you permission to check out the underground palace? Talk to Naem, he's got the key and the code.\"";
- close;
+ goto L_Close;
L_Nathan_Complete:
mes "[Nathan]";
mes "\"Mining is a dangerous job, but somebody's got to do it!\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@state << BYTE_2_SHIFT));
+ return;
}
diff --git a/world/map/npc/002-3/underground_palace_barrier.txt b/world/map/npc/002-3/underground_palace_barrier.txt
index 60befa87..a56fe801 100644
--- a/world/map/npc/002-3/underground_palace_barrier.txt
+++ b/world/map/npc/002-3/underground_palace_barrier.txt
@@ -2,11 +2,21 @@
002-3.gat,68,98,0|script|#UGP_Barrier|45,0,0,{
- if (TMW_Quest >= 37) goto L_Underground_Palace_Barrier_Open;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state >= 25) goto L_Underground_Palace_Barrier_Open;
+
message strcharinfo(0), "Some force seems to block your entrance.";
- end;
+ goto L_End;
L_Underground_Palace_Barrier_Open:
warp "002-4.gat",34,98;
+ goto L_End;
+
+L_End:
+ set @state, 0;
end;
}
diff --git a/world/map/npc/002-4/chest.txt b/world/map/npc/002-4/chest.txt
index f61ee889..c2fec840 100644
--- a/world/map/npc/002-4/chest.txt
+++ b/world/map/npc/002-4/chest.txt
@@ -1,36 +1,47 @@
-//
+// Variables used: nibble 4 and 5 of QUEST_SouthTulimshar
002-4.gat,93,37,0|script|Treasure|111,{
- if (TMW_Quest >= 38) goto L_Finished;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state >= 26) goto L_Finished;
mes "There is a chest here.";
mes "Do you want to try to open it?";
next;
menu
"Yes.", L_Yes,
- "No.", -;
- close;
+ "No.", L_Close;
L_Yes:
- if(countitem("TreasureKey") < 3) goto L_Not_Enough;
+ if (countitem("TreasureKey") < 3)
+ goto L_Not_Enough;
getinventorylist;
- if (@inventorylist_count == 100 && countitem("TreasureKey") > 3) goto L_TooMany;
+ if (@inventorylist_count == 100 && countitem("TreasureKey") > 3)
+ goto L_TooMany;
mes "You opened the chest and found a short bow!";
delitem "TreasureKey", 3;
getitem "ShortBow", 1;
- set TMW_Quest, 38;
- close;
+ set @state, 26;
+ callsub S_Update_Var;
+ goto L_Close;
L_Not_Enough:
mes "It seems that you do not have the right key for this chest yet...";
- close;
+ goto L_Close;
L_Finished:
mes "You have already opened this chest.";
- close;
+ goto L_Close;
L_TooMany:
mes "You do not have enough room to loot this chest. Maybe you should try again later.";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
}
diff --git a/world/map/npc/002-4/miners.txt b/world/map/npc/002-4/miners.txt
index 2078cb7b..401a7bbc 100644
--- a/world/map/npc/002-4/miners.txt
+++ b/world/map/npc/002-4/miners.txt
@@ -1,14 +1,19 @@
-//
+// Variables used: nibble 4 and 5 of QUEST_SouthTulimshar
002-4.gat,32,94,6|script|Sema|340,{
- if (TMW_Quest >= 40) goto L_Sema_Done;
- if (TMW_Quest == 39) goto L_Sema_Happy;
- if (TMW_Quest == 38) goto L_Sema_GCM;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_SouthTulimshar & BYTE_2_MASK) >> BYTE_2_SHIFT);
+
+ if (@state >= 28) goto L_Sema_Done;
+ if (@state == 27) goto L_Sema_Happy;
+ if (@state == 26) goto L_Sema_GCM;
mes "[Sema the Miner]";
mes "\"Hello adventurer. I do not know exactly where, but somewhere in this cave there is a chest. And wouldn't you know it! The archants have eaten all the spare keys for the chest. Go and do what you must do.\"";
- close;
+ goto L_Close;
L_Sema_GCM:
mes "[Sema the Miner]";
@@ -16,44 +21,52 @@ L_Sema_GCM:
menu
"Yes.", L_Sema_Yes,
"No.", L_Sema_No;
- close;
L_Sema_No:
mes "[Sema the Miner]";
mes "\"Ahh! I am very scared now!\"";
- close;
+ goto L_Close;
L_Sema_Yes:
- set TMW_Quest, 39;
+ set @state, 27;
+ callsub S_Update_Var;
monster "002-4.gat", 70, 90, "", 1059, 1;
mes "[Sema the Miner]";
mes "\"Good luck. To prove you killed it, please bring the Iten it swallowed when it ate the miner. Be careful, there could be more than one.\"";
- close;
+ goto L_Close;
L_Sema_Happy:
- if (countitem ("Iten") < 1) goto L_Sema_Not_Happy;
+ if (countitem("Iten") < 1)
+ goto L_Sema_Not_Happy;
getinventorylist;
- if (@inventorylist_count - (countitem ("Iten") == 1) > 99) goto L_Sema_TooMany;
+ if (@inventorylist_count - (countitem("Iten") == 1) > 99)
+ goto L_Sema_TooMany;
delitem "Iten", 1;
getitem "DesertShirt", 1;
- set TMW_Quest, 40;
+ set @state, 28;
+ callsub S_Update_Var;
mes "[Sema the Miner]";
mes "\"You killed it! What a relief! I wish I had more to give, but please accept this Desert Shirt as reward.\"";
- close;
+ goto L_Close;
L_Sema_TooMany:
mes "[Sema the Miner]";
mes "\"You have too many items for me to give you a reward. Please drop or sell something so I can give it to you. Oh and yes, you can also store items at the nearest bank.\"";
- close;
+ goto L_Close;
L_Sema_Not_Happy:
- set TMW_Quest, 38;
+ set @state, 26;
+ callsub S_Update_Var;
itemheal -Hp, 0;
mes "A stone falls on your head.";
- close;
+ goto L_Close;
L_Sema_Done:
mes "[Sema the Miner]";
mes "\"You made this cave safer, you are kind beyond belief. Others may need you. Happy adventuring.\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
}
diff --git a/world/map/npc/008-1/hinnak.txt b/world/map/npc/008-1/hinnak.txt
index 9e2c8cde..d2551e5a 100644
--- a/world/map/npc/008-1/hinnak.txt
+++ b/world/map/npc/008-1/hinnak.txt
@@ -1,39 +1,38 @@
-//#################################################################################
-//# #
-//# this script file contains the npc scripts for the quest to obtain a scythe. #
-//# #
-//# Needed: 10 Pink Antenna #
-//# #
-//# Reward: Scythe #
-//# #
-//#################################################################################
-
-//Farmer
+// This script file contains the npc scripts for the quest to obtain a scythe.
+//
+// Needed: 10 Pink Antenna
+// Reward: Scythe
+//
+// Variables used: Nibble 1 of QUEST_Hurnscald (previously QUEST_Scythe_state)
008-1.gat,101,30,0|script|Hinnak|142,{
- if (Inspector == 10) goto L_NohMask;
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
+ if (@inspector == 10) goto L_NohMask;
L_No_NohMask:
- if (QUEST_Scythe_state == 1) goto L_Exchange;
- if (QUEST_Scythe_state == 2) goto L_ThanksAgain;
+ set @state, ((QUEST_Hurnscald & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT);
+
+ if (@state == 1) goto L_Exchange;
+ if (@state == 2) goto L_ThanksAgain;
if (getequipid(equip_head) == 751) goto L_Intro_Hat;
mes "[Farmer Hinnak]";
mes "\"Argh! I hate them! I @#$% hate them! I @#$% hate these @#$% pinkies!\"";
next;
menu
- "You need some anger control therapy.", -,
+ "You need some anger control therapy.", L_Close,
"Why do you hate them?", L_Reason;
- close;
L_Intro_Hat:
mes "The farmer lunges at you with a farming implement.";
next;
heal -50, 0;
menu
- "I'm out of here.", -,
+ "I'm out of here.", L_Close,
"Whoa, what are you doing?", L_Intro_Hat_Explain;
- close;
L_Intro_Hat_Explain:
mes "[Farmer Hinnak]";
@@ -48,24 +47,23 @@ L_Reason:
next;
menu
"Want me to help you?", L_Help,
- "Well, life ain't fair.", -;
- close;
+ "Well, life ain't fair.", L_Close;
L_Help:
mes "[Farmer Hinnak]";
mes "\"Yes, you look quite fast. Maybe you can catch some of them. That will pay them a lesson.";
mes "Slay some of them and bring me 10 of their antennae.\"";
- set QUEST_Scythe_state, 1;
+ set @state, 1;
+ callsub S_Update_Mask;
next;
menu
- "Sure, I'm on my way", -,
+ "Sure, I'm on my way", L_Close,
"How much is this worth to you?", L_Reward;
- close;
L_Reward:
mes "[Farmer Hinnak]";
mes "\"Well, I can't offer you much. But I got an old scythe laying around. Maybe you can use it as a weapon.\"";
- close;
+ goto L_Close;
L_Exchange:
if (getequipid(equip_head) != 751)
@@ -78,9 +76,8 @@ L_Exchange_Start:
mes "\"Have you got the 10 antennae?\"";
next;
menu
- "Not yet, but I am working on it.", -,
+ "Not yet, but I am working on it.", L_Close,
"Sure, here they are!", L_Exchange_Exchange;
- close;
L_Exchange_Exchange:
if (countitem("PinkAntenna") < 10)
@@ -90,20 +87,21 @@ L_Exchange_Exchange:
goto L_Exchange_TooMany;
delitem "PinkAntenna", 10;
getitem "Scythe", 1;
- set QUEST_Scythe_state, 2;
+ set @state, 2;
+ callsub S_Update_Mask;
mes "[Farmer Hinnak]";
mes "\"Thank you very much. I've got something for you. My old scythe. Maybe you can use it as a weapon. It is a bit cumbersome but its strikes are deadly.\"";
- close;
+ goto L_Close;
L_Exchange_Notenough:
mes "[Farmer Hinnak]";
mes "\"It doesn't look like you do.\"";
- close;
+ goto L_Close;
L_Exchange_TooMany:
mes "[Farmer Hinnak]";
mes "\"Looks like you don't have room for this. Come back later to receive your reward. Hold on to the antennea until then.\"";
- close;
+ goto L_Close;
L_ThanksAgain:
if (getequipid(equip_head) == 751)
@@ -202,43 +200,51 @@ L_GiveBeer:
L_Sagatha_hahaha:
mes "[Farmer Hinnak]";
mes "\"Yeah, funny now... But you should've seen that stare! Ah, well, never mind.\"";
- close;
+ goto L_Close;
L_Sagatha_scary:
mes "[Farmer Hinnak]";
mes "\"Yeah, you could say that...\"";
mes "He stares into his empty beer jug, as if wishing it weren't empty yet.";
- close;
+ goto L_Close;
L_Sagatha_word:
mes "[Farmer Hinnak]";
mes "\"Oh, I can't be sure... but something like '" + getspellinvocation("summon-maggots") + "', I think.\"";
- close;
+ goto L_Close;
L_NoBeer:
mes "[Farmer Hinnak]";
mes "\"Ah... no beer? Oh well.\"";
- close;
+ goto L_Close;
L_Bye:
mes "[Farmer Hinnak]";
mes "\"Bye!\"";
- close;
+ goto L_Close;
L_NohMask:
menu
"Did you see anyone in a mask come by here at night?", L_NohMask_Mask,
"Did you see anyone with a large satchel come by here at night?", L_NohMask_Satchel,
- "Hello", L_No_NohMask;
- close;
+ "Hello.", L_No_NohMask;
L_NohMask_Mask:
mes "[Farmer Hinnak]";
mes "\"No. It tends to be too dark to see a mask.\"";
- close;
+ goto L_Close;
L_NohMask_Satchel:
mes "[Farmer Hinnak]";
mes "\"Yes, I saw someone with a large sack on their back go to the mining camp.\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
+ set @inspector, 0;
close;
+
+S_Update_Mask:
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_1_MASK)) | (@state << NIBBLE_1_SHIFT);
+ return;
}
diff --git a/world/map/npc/009-1/jack.txt b/world/map/npc/009-1/jack.txt
index 6f08c719..9e1ebbe1 100644
--- a/world/map/npc/009-1/jack.txt
+++ b/world/map/npc/009-1/jack.txt
@@ -15,6 +15,8 @@
// Lumberjack
009-1.gat,40,45,0|script|Jack|141,{
+ callfunc "ClearVariables";
+
set @RAWLOGS_AMOUNT, 40;
set @SHIELD_COST, 5000;
set @QUEST_SHIELD_EXP, 2500;
@@ -28,6 +30,8 @@
set @Q_Forestbow, ((QUEST_Forestbow_state & @Q_Forestbow_MASK) >> @Q_Forestbow_SHIFT);
set @Q_Woodenshield, ((QUEST_Forestbow_state & @Q_Woodenshield_MASK) >> @Q_Woodenshield_SHIFT);
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
if (@Q_Woodenshield >= 3) goto L_Shield_state_3;
if (@Q_Woodenshield == 2) goto L_Shield_state_2;
if (@Q_Woodenshield == 1) goto L_Shield_state_1;
@@ -35,9 +39,11 @@
mes "[Jack Lumber]";
mes "\"Hello there, my name is Jack Lumber, the enemy of all trees. If you need some firewood just let me know.\"";
- if (Inspector == 1) callsub S_NohMask_Ask;
+ if (@inspector == 1)
+ callsub S_NohMask_Ask;
next;
- if (@Q_Forestbow < 1) close;
+ if (@Q_Forestbow < 1)
+ goto L_Close;
menu
"I heard you aren't delivering any more living wood. Why not?", -;
mes "[Jack Lumber]";
@@ -83,15 +89,16 @@
"Southwest you say? OK, thank you.", -;
set @Q_Forestbow, 2;
callsub S_Update_Mask;
- close;
+ goto L_Close;
L_Bow_state_2:
// Bow state 4: The player has found a perfect piece of wood.
if (@Q_Forestbow > 3) goto L_Bow_state_4;
mes "\"Good luck hunting those tree monsters - you will need it.\"";
- if (Inspector == 1) callsub S_NohMask_Ask;
- close;
+ if (@inspector == 1)
+ callsub S_NohMask_Ask;
+ goto L_Close;
L_Bow_state_4:
mes "[Jack Lumber]";
@@ -114,7 +121,7 @@ L_Bow_state_4:
L_Bow_state_4_reaffirm:
mes "[Jack Lumber]";
mes "\"You should go talk to Alan again.\"";
- close;
+ goto L_Close;
L_Shield_state_0:
set @Q_Woodenshield, 1;
@@ -134,24 +141,22 @@ L_Shield_state_1:
mes "[Jack Lumber]";
mes "\"I have an idea. What would you say about a new shield?\"";
next;
- if (Inspector == 1)
+ if (@inspector == 1)
menu
- "No thanks.", L_End,
- "Yes, please!", -,
+ "No thanks.", L_Close,
+ "Yes, please!", L_Yes,
"Actually, I'd like to know if you've seen any strange happenings in town.", L_NohMask_Answer;
- if (Inspector != 1)
- menu
- "No thanks.", L_End,
- "Yes, please!", -;
+ menu
+ "No thanks.", L_Close,
+ "Yes, please!", L_Yes;
+
+L_Yes:
mes "[Jack Lumber]";
mes "\"All I need is " + @RAWLOGS_AMOUNT + " raw logs. This needn't be highest-quality wood; pretty much any log you can find should work. Oh, and I'll also need " + @SHIELD_COST + " GP for other materials.\"";
next;
set @Q_Woodenshield, 2;
callsub S_Update_Mask;
- close;
-
-L_End:
- close;
+ goto L_Close;
L_Shield_state_2:
mes "[Jack Lumber]";
@@ -187,33 +192,35 @@ L_Shield_state_2:
mes "\"Enjoy your new shield!\"";
mes "[" + @QUEST_SHIELD_EXP + " experience points]";
next;
- goto L_End;
+ goto L_Close;
L_Not_enough_logs:
mes "[Jack Lumber]";
mes "\"You don't have enough wood for me to craft this shield; I need a total of " + @RAWLOGS_AMOUNT + " raw logs.\"";
- close;
+ goto L_Close;
L_Not_enough_money:
mes "[Jack Lumber]";
mes "\"You don't have enough gold, I'm afraid. I need " + @SHIELD_COST + " GP to finish your shield.\"";
- close;
+ goto L_Close;
L_TooMany:
mes "[Jack Lumber]";
mes "\"You don't have enough room for the shield. Come back when you do.\"";
- close;
+ goto L_Close;
L_Shield_state_3:
mes "[Jack Lumber]";
mes "\"I hope that my shield will serve you well!\"";
+ if (@inspector != 1)
+ goto L_Close;
next;
- if (Inspector == 1)
- menu
- "Me too.", -,
- "Have you seen anything that might be connected to the recent robberies in town?", L_NohMask_Answer;
- close;
+ menu
+ "Me too.", L_Close,
+ "Have you seen anything that might be connected to the recent robberies in town?", L_NohMask_Answer;
+// This is an ugly violation of the scripting standards,
+// but it's somewhat complicated to fix.
S_NohMask_Ask:
next;
menu
@@ -224,6 +231,10 @@ S_NohMask_Ask:
L_NohMask_Answer:
mes "[Jack Lumber]";
mes "\"Sorry, no.\"";
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
S_Update_Mask:
diff --git a/world/map/npc/009-1/milly.txt b/world/map/npc/009-1/milly.txt
index 1f75eed2..df0d31be 100644
--- a/world/map/npc/009-1/milly.txt
+++ b/world/map/npc/009-1/milly.txt
@@ -1,24 +1,30 @@
009-1.gat,81,41,0|script|Milly|114,{
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
mes "[Milly]";
mes "\"Hello.\"";
next;
- if (Inspector == 1) goto L_NohMask;
- close;
+ if (@inspector != 1)
+ goto L_Close;
-L_NohMask:
menu
"Have you seen anything strange lately?", L_NohMask_Strange,
"Do you know anything about the recent robberies?", L_NohMask_Robbery,
- "Hello", -;
- close;
+ "Hello.", L_Close;
L_NohMask_Strange:
mes "[Milly]";
mes "\"I haven't seen anything strange.\"";
- close;
+ goto L_Close;
L_NohMask_Robbery:
mes "[Milly]";
mes "\"No, sorry.\"";
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
}
diff --git a/world/map/npc/009-1/old_man.txt b/world/map/npc/009-1/old_man.txt
index 97679b35..e799cc89 100644
--- a/world/map/npc/009-1/old_man.txt
+++ b/world/map/npc/009-1/old_man.txt
@@ -1,34 +1,41 @@
// Old man
009-1.gat,85,51,0|script|Old Man|159,{
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
mes "[Old Man]";
mes "\"Don't let those monsters get to you.\"";
next;
- if (Inspector == 1) goto L_NohMask_Ask;
- if (Inspector == 6) goto L_NohMask_Accuse;
- close;
+ if (@inspector == 1) goto L_NohMask_Ask;
+ if (@inspector == 6) goto L_NohMask_Accuse;
+ goto L_Close;
L_NohMask_Ask:
menu
"Have you seen anything strange lately?", L_NohMask_Ask_Nothing,
"Do you know anything about the recent robberies?", L_NohMask_Ask_Nothing,
- "I won't, thank you.", -;
- close;
+ "I won't, thank you.", L_Close;
L_NohMask_Ask_Nothing:
mes "[Old Man]";
mes "\"I'm sorry, but I didn't see anything. You should ask my old woman.\"";
- close;
+ goto L_Close;
L_NohMask_Accuse:
menu
"The leader of the troupe said you hung around them a lot while they were in town.", L_NohMask_Accuse_Respond,
- "I won't, thank you.", -;
- close;
+ "I won't, thank you.", L_Close;
L_NohMask_Accuse_Respond:
mes "[Old Man]";
mes "\"Yes, I hung around the theater a lot. I was an actor when I was younger. But I wasn't there that night. Me and the wife were at home all night.\"";
- set Inspector, 7;
+ set @inspector, 7;
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_3_MASK)) | (@inspector << NIBBLE_3_SHIFT);
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
}
diff --git a/world/map/npc/009-1/old_woman.txt b/world/map/npc/009-1/old_woman.txt
index abca82c4..fbd0e7aa 100644
--- a/world/map/npc/009-1/old_woman.txt
+++ b/world/map/npc/009-1/old_woman.txt
@@ -1,68 +1,88 @@
// Old woman
009-1.gat,29,43,0|script|Old Woman|154,{
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
if (BaseLevel < 40) goto L_Lower;
mes "[Old Woman]";
mes "\"Hello deary.\"";
next;
-
-L_Continue:
- if ((Inspector >= 1 && Inspector <= 7) || Inspector == 9) goto L_NohMask;
- close;
+ goto L_Continue;
L_Lower:
mes "[Old Woman]";
mes "\"Watch out for these flowers. They don't like to be messed with.\"";
next;
- goto L_Continue;
+
+L_Continue:
+ if ((@inspector >= 1 && @inspector <= 7) || @inspector == 9)
+ goto L_NohMask;
+ goto L_Close;
L_NohMask:
- if (Inspector == 7) goto L_NohMask_Alibi;
+ if (@inspector == 7)
+ goto L_NohMask_Alibi;
callfunc "ProcessEquip";
if (@torsoC == cDarkBlue && @legsC == cDarkBlue)
goto L_NohMask_Fake;
- if (Inspector >= 3 && Inspector <= 6) close;
+ if (@inspector >= 3 && @inspector <= 6)
+ goto L_Close;
menu
"Have you seen anything strange lately?", L_NohMask_FirstAsk,
"Do you know anything about the recent robberies?", L_NohMask_FirstAsk,
- "Hello", -;
- close;
+ "Hello", L_Close;
L_NohMask_FirstAsk:
mes "[Old Woman]";
mes "\"Yes, but I'm only talking to the inspector himself!\"";
- if (Inspector == 1) set Inspector, 2;
- close;
+ if (@inspector != 1)
+ goto L_Close;
+ set @inspector, 2;
+ callsub S_Update_Mask;
+ goto L_Close;
L_NohMask_Alibi:
menu
"Was your husband with you at home all night the last night that the troupe was in town?", -;
mes "[Old Woman]";
mes "\"Yes, we were both at home all night.\"";
- set Inspector, 8;
- close;
+ set @inspector, 8;
+ callsub S_Update_Mask;
+ goto L_Close;
L_NohMask_Fake:
- if (Inspector == 9) goto L_NohMask_Fake_Satchel;
- if (Inspector >= 3 && Inspector <= 6) goto L_NohMask_Filler;
+ if (@inspector == 9) goto L_NohMask_Fake_Satchel;
+ if (@inspector >= 3 && @inspector <= 6) goto L_NohMask_Filler;
mes "[Old Woman]";
mes "\"I saw someone sneaking around town wearing a theater mask. It looked like one of the masks used by the troupe that was in town recently.\"";
- set Inspector, 3;
- close;
+ set @inspector, 3;
+ callsub S_Update_Mask;
+ goto L_Close;
L_NohMask_Filler:
mes "[Old Woman]";
mes "\"I hope you catch that naughty person!\"";
- close;
+ goto L_Close;
L_NohMask_Fake_Satchel:
mes "[Old Woman]";
mes "\"I've remembered something else. The night the troupe left, I saw someone with a theater mask take a large satchel out of town. He was heading north.\"";
- set Inspector, 10;
+ set @inspector, 10;
+ callsub S_Update_Mask;
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
+S_Update_Mask:
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_3_MASK)) | (@inspector << NIBBLE_3_SHIFT);
+ return;
+
OnPCDieEvent:
if (countitem(E10_TOKEN_ID) < 1) end;
delitem E10_TOKEN_ID, 1;
diff --git a/world/map/npc/009-1/sabine.txt b/world/map/npc/009-1/sabine.txt
index 9fa5e20f..d67c55b0 100644
--- a/world/map/npc/009-1/sabine.txt
+++ b/world/map/npc/009-1/sabine.txt
@@ -1,26 +1,32 @@
// Girl sitting on bench
009-1.gat,88,27,0|script|Sabine|106,{
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
mes "[Sabine]";
mes "\"Isn't this place pretty? I love hanging out here!\"";
next;
- if (Inspector == 1) goto L_NohMask;
- close;
+ if (@inspector != 1)
+ goto L_Close;
-L_NohMask:
menu
"Have you seen anything strange lately?", L_NohMask_Strange,
"Do you know anything about the recent robberies?", L_NohMask_Robbery,
- "Yes, it is.", -;
- close;
+ "Yes, it is.", L_Close;
L_NohMask_Strange:
mes "[Sabine]";
mes "\"I haven't seen anything strange.\"";
- close;
+ goto L_Close;
L_NohMask_Robbery:
mes "[Sabine]";
mes "\"No, sorry.\"";
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
}
diff --git a/world/map/npc/009-2/alan.txt b/world/map/npc/009-2/alan.txt
index 1715fe72..53715527 100644
--- a/world/map/npc/009-2/alan.txt
+++ b/world/map/npc/009-2/alan.txt
@@ -9,6 +9,8 @@
// Archer Shop Master
009-2.gat,99,23,0|script|Alan|125,{
+ callfunc "ClearVariables";
+
set @Q_MASK, NIBBLE_0_MASK;
set @Q_SHIFT, NIBBLE_0_SHIFT;
@@ -16,6 +18,8 @@
set @BROKENLOG_EXP, 15;
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
if (@Q_status == 1) goto L_State_1;
if (@Q_status == 2) goto L_State_2;
if (@Q_status == 3) goto L_State_3;
@@ -25,16 +29,16 @@
mes "[Alan]";
mes "\"When you want to buy something then please speak to my apprentice. I am only doing special requests.\"";
next;
- if (Inspector == 1)
+ if (@inspector == 1)
menu
"OK, thanks.", -,
"Can you make me a really good bow?", L_State_0_1,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
- if (Inspector != 1)
+ if (@inspector != 1)
menu
"OK, thanks.", -,
"Can you make me a really good bow?", L_State_0_1;
- close;
+ goto L_Close;
L_State_0_1:
mes "[Alan]";
@@ -46,9 +50,8 @@ L_State_0_1:
mes "\"Sorry, I am not making these anymore.\"";
next;
menu
- "Oh, too bad.", -,
+ "Oh, too bad.", L_Close,
"What? Why not?", L_State_0_2;
- close;
L_State_0_2:
mes "[Alan]";
@@ -59,48 +62,46 @@ L_State_0_2:
callsub S_Update_Var;
next;
menu
- "Too bad.", -,
+ "Too bad.", L_Close,
"Did you ask him why?", L_State_0_3;
- close;
L_State_0_3:
mes "[Alan]";
mes "\"Sure I did. But he just told me to leave him alone. Maybe you could ask him what's wrong?\"";
next;
menu
- "OK, I'll ask him.", -,
+ "OK, I'll ask him.", L_Close,
"I am sure he got his reasons.", -;
- close;
L_State_1:
mes "[Alan]";
mes "\"Did you already ask Jack why he won't deliver me any more living wood?\"";
next;
- if (Inspector == 1)
+ if (@inspector == 1)
menu
"No, I haven't had the time yet.", -,
"No, I didn't find him yet.", L_State_1_1,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
- if (Inspector != 1)
+ if (@inspector != 1)
menu
"No, I haven't had the time yet.", -,
"No, I didn't find him yet.", L_State_1_1;
- close;
+ goto L_Close;
L_State_1_1:
mes "[Alan]";
mes "\"When you leave my shop just go southwest over the village plaza. You can't miss it.\"";
- close;
+ goto L_Close;
L_State_2:
mes "[Alan]";
mes "\"Did you already ask Jack why he won't deliver me any more living wood?\"";
next;
- if (Inspector == 1)
+ if (@inspector == 1)
menu
"Yes, I did. He said that the trees turned into dangerous monsters.", -,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
- if (Inspector != 1)
+ if (@inspector != 1)
menu
"Yes, I did. He said that the trees turned into dangerous monsters.", -;
mes "[Alan]";
@@ -109,23 +110,24 @@ L_State_2:
mes "Maybe you will find a piece of wood that is strong enough to become one of my forest bows.\"";
set @Q_status, 3;
callsub S_Update_Var;
- close;
+ goto L_Close;
L_State_3:
mes "[Alan]";
mes "\"How is the hunt going? Did you bring me any wood?\"";
- if (countitem("RawLog") < 1) close;
+ if (countitem("RawLog") < 1)
+ goto L_Close;
next;
- if (Inspector == 1)
+ if (@inspector == 1)
menu
"Here, take a look!", L_State_3_try,
"Yes, but I need it for something else.", -,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
- if (Inspector != 1)
+ if (@inspector != 1)
menu
"Here, take a look!", L_State_3_try,
"Yes, but I need it for something else.", -;
- close;
+ goto L_Close;
L_State_3_try:
if (countitem("RawLog") < 1)
@@ -142,12 +144,12 @@ L_State_3_try:
next;
mes "[Alan]";
mes "\"Sorry, this log was too weak for one of my forest bows. Now it is junk. Give me another.\"";
- if (countitem("RawLog") < 1) close;
+ if (countitem("RawLog") < 1)
+ goto L_Close;
next;
menu
"Sure, here you go.", L_State_3_try,
- "Hey! Stop breaking my stuff!", -;
- close;
+ "Hey! Stop breaking my stuff!", L_Close;
L_State_3_success:
mes "Alan tries as hard as he can but the log won't bend.";
@@ -162,16 +164,16 @@ L_State_4:
mes "[Alan]";
mes "\"I can make you a really nice forest bow out of this. I just need 10,000 GP for material and work time.\"";
next;
- if (Inspector == 1)
+ if (@inspector == 1)
menu
"10,000??? What a ripoff!", -,
"Sure, here you go!", L_State_4_pay,
"Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
- if (Inspector != 1)
+ if (@inspector != 1)
menu
"10,000??? What a ripoff!", -,
"Sure, here you go!", L_State_4_pay;
- close;
+ goto L_Close;
L_State_4_pay:
if (Zeny < 10000)
@@ -185,36 +187,40 @@ L_State_4_pay:
callsub S_Update_Var;
mes "[Alan]";
mes "\"Here you go - have fun with it.\"";
- close;
+ goto L_Close;
L_State_4_nocash:
mes "[Alan]";
mes "\"Seems like you are out of cash.\"";
- close;
+ goto L_Close;
L_State_4_TooMany:
mes "[Alan]";
mes "\"Seems like you don't have room for this bow. Come back later.\"";
- close;
+ goto L_Close;
L_State_5:
mes "[Alan]";
mes "\"I hope you are satisfied with your forest bow. It is one of my best works.\"";
+ if (@inspector != 1)
+ goto L_Close;
next;
- if (Inspector == 1)
- menu
- "I am!", -,
- "Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
- close;
+ menu
+ "I am!", L_Close,
+ "Have you seen anything strange recently that might be connected to the robberies?", L_NohMask_Answer;
L_NohMask_Answer:
mes "[Alan]";
mes "\"No.\"";
- close;
+ goto L_Close;
L_No_Log:
mes "[Alan]";
mes "\"Where should I look at? You don't have a raw log.\"";
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
S_Update_Var:
diff --git a/world/map/npc/009-2/doctor.txt b/world/map/npc/009-2/doctor.txt
index 7b6931e0..c9b5684a 100644
--- a/world/map/npc/009-2/doctor.txt
+++ b/world/map/npc/009-2/doctor.txt
@@ -1,6 +1,10 @@
// Doctor
009-2.gat,148,25,0|script|Doctor|107,{
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
if (getequipid(equip_head) == 616) goto L_Axe;
if (getequipid(equip_head) == 621) goto L_Eyepatch;
@@ -8,26 +12,27 @@
mes "\"Hello, can I help you?\"";
next;
- if (Inspector == 1)
+ if (@inspector == 1)
menu
"I think I am sick!", L_Cure,
"No, I feel fine.", -,
"Have you seen anything strange in town? Anything that might have to do with the robberies?", L_NohMask;
- if (Inspector != 1)
+ if (@inspector != 1)
menu
"I think I am sick!", L_Cure,
"No, I feel fine.", -;
mes "[Doctor]";
mes "\"Then please stop wasting my precious time.\"";
- close;
+ goto L_Close;
L_Cure:
mes "[Doctor]";
- if (sc_check(sc_poison)) goto L_CurePoison;
+ if (sc_check(sc_poison))
+ goto L_CurePoison;
mes "The doctor examines you briefly.";
mes "\"Nonsense! You look fine and dandy to me. All you need is a bit more exercise and fresh fruit in your diet!\"";
- close;
+ goto L_Close;
L_CurePoison:
mes "\"Well, well, well! Look at all those green bubbles coming out of your head; that looks like poisoning to me! Did you eat something rotten?\"";
@@ -41,7 +46,7 @@ L_CurePoison:
sc_end(sc_slowpoison);
mes "*Ouch!*";
mes "\"Next time, be more careful! Make sure to cook any meats before you eat them, and don't eat fish once it starts to smell.\"";
- close;
+ goto L_Close;
L_Axe:
mes "[Doctor]";
@@ -49,7 +54,7 @@ L_Axe:
next;
mes "[Doctor]";
mes "\"Wait. Thats just a fake. Shame on you!\"";
- close;
+ goto L_Close;
L_Eyepatch:
mes "[Doctor]";
@@ -60,7 +65,7 @@ L_Eyepatch:
"No thank you", -;
mes "[Doctor]";
mes "\"If you change your mind, please come back and see me.\"";
- close;
+ goto L_Close;
L_Eyepatch_GlassEye:
mes "[Doctor]";
@@ -69,10 +74,14 @@ L_Eyepatch_GlassEye:
next;
mes "[Doctor]";
mes "\"I can't seem to find where I put that box. You should come back later, I may have found them by then.\"";
- close;
+ goto L_Close;
L_NohMask:
mes "[Doctor]";
mes "\"No, I haven't seen anything.\"";
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
}
diff --git a/world/map/npc/009-2/inspector.txt b/world/map/npc/009-2/inspector.txt
index e1461584..59bbd067 100644
--- a/world/map/npc/009-2/inspector.txt
+++ b/world/map/npc/009-2/inspector.txt
@@ -1,25 +1,29 @@
//
009-2.gat,24,99,0|script|Inspector#Hurnscald|150,{
- if (Inspector == 0 && BaseLevel >= 30) goto L_NohMask_Start;
- if (Inspector == 1) goto L_NohMask_AskVillage;
- if (Inspector == 2) goto L_NohMask_OldWoman;
- if (Inspector == 3) goto L_NohMask_TheaterMask;
- if (Inspector == 4) goto L_NohMask_TravelingTroupe;
- if (Inspector == 5) goto L_NohMask_OldMan;
- if (Inspector == 6) goto L_NohMask_OldMan_2;
- if (Inspector == 7) goto L_NohMask_Alibi;
- if (Inspector == 8) goto L_NohMask_Alibi_2;
- if (Inspector == 9) goto L_NohMask_Alibi_3;
- if (Inspector == 10) goto L_NohMask_Satchel;
- if (Inspector == 11) goto L_NohMask_Basement;
- if (Inspector == 12) goto L_NohMask_Note;
- if (Inspector == 13) goto L_NohMask_TravelingTroupe_2;
- if (Inspector == 14) goto L_NohMask_Over;
- if (Inspector == 15) goto L_NohMask_End;
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
+ if (@inspector == 0 && BaseLevel >= 30) goto L_NohMask_Start;
+ if (@inspector == 1) goto L_NohMask_AskVillage;
+ if (@inspector == 2) goto L_NohMask_OldWoman;
+ if (@inspector == 3) goto L_NohMask_TheaterMask;
+ if (@inspector == 4) goto L_NohMask_TravelingTroupe;
+ if (@inspector == 5) goto L_NohMask_OldMan;
+ if (@inspector == 6) goto L_NohMask_OldMan_2;
+ if (@inspector == 7) goto L_NohMask_Alibi;
+ if (@inspector == 8) goto L_NohMask_Alibi_2;
+ if (@inspector == 9) goto L_NohMask_Alibi_3;
+ if (@inspector == 10) goto L_NohMask_Satchel;
+ if (@inspector == 11) goto L_NohMask_Basement;
+ if (@inspector == 12) goto L_NohMask_Note;
+ if (@inspector == 13) goto L_NohMask_TravelingTroupe_2;
+ if (@inspector == 14) goto L_NohMask_Over;
+ if (@inspector == 15) goto L_NohMask_End;
mes "[Inspector]";
mes "\"I'm sorry, but I'm busy looking into this string of robberies.\"";
- close;
+ goto L_Close;
L_NohMask_Start:
mes "\"Hmm...what to do.\"";
@@ -29,97 +33,110 @@ L_NohMask_Start:
mes "\"You look capable, will you help me solve these robberies?\"";
next;
menu
- "Yes", L_NohMask_Accept,
- "No", -;
- close;
+ "Yes.", L_NohMask_Accept,
+ "No.", L_Close;
L_NohMask_Accept:
- set Inspector, 1;
+ set @inspector, 1;
+ callsub S_Update_Mask;
mes "[Inspector]";
mes "\"Ok then. I'd like you to ask the villagers about the recent string of robberies.\"";
- close;
+ goto L_Close;
L_NohMask_AskVillage:
mes "[Inspector]";
mes "\"Please continue talking to the villagers.\"";
- close;
+ goto L_Close;
L_NohMask_OldWoman:
mes "[Inspector]";
mes "\"Hm...I don't know if I trust her eyesight or memory. See if someone else knows anything.\"";
- close;
+ goto L_Close;
L_NohMask_TheaterMask:
- set Inspector, 4;
+ set @inspector, 4;
+ callsub S_Update_Mask;
mes "[Inspector]";
mes "\"Someone in a theater mask, eh? There was a traveling theater troupe in town recently, but they've moved on to Tulimshar. Please go talk to their leader about this.\"";
- close;
+ goto L_Close;
L_NohMask_TravelingTroupe:
mes "[Inspector]";
mes "\"Please go talk to the leader of the traveling troupe about the theater mask.\"";
- close;
+ goto L_Close;
L_NohMask_OldMan:
- set Inspector, 6;
+ set @inspector, 6;
+ callsub S_Update_Mask;
mes "[Inspector]";
mes "\"Hm...an old man? Could you interrogate him for me?\"";
- close;
+ goto L_Close;
L_NohMask_OldMan_2:
mes "[Inspector]";
mes "\"Have you talked with the old man yet?\"";
- close;
+ goto L_Close;
L_NohMask_Alibi:
mes "[Inspector]";
mes "\"Can you verify that with his wife?\"";
- close;
+ goto L_Close;
L_NohMask_Alibi_2:
- set Inspector, 9;
+ set @inspector, 9;
+ callsub S_Update_Mask;
mes "[Inspector]";
mes "\"Hm...then it couldn't be him. I'm not sure where to go from here, maybe you can find something else. Try talking to everyone again.\"";
- close;
+ goto L_Close;
L_NohMask_Alibi_3:
mes "[Inspector]";
mes "\"Made any progress yet?\"";
- close;
+ goto L_Close;
L_NohMask_Satchel:
mes "[Inspector]";
mes "\"Then go north and investigate!\"";
- close;
+ goto L_Close;
L_NohMask_Basement:
mes "[Inspector]";
mes "\"Did you look over the basement?\"";
- close;
+ goto L_Close;
L_NohMask_Note:
- set Inspector, 13;
+ set @inspector, 13;
+ callsub S_Update_Mask;
mes "[Inspector]";
mes "\"What a strange note. I'll keep track of this, while you return the mask to the troupe.\"";
mes "";
mes "\"By the way, stay sharp! I may call upon you again.\"";
- close;
+ goto L_Close;
L_NohMask_TravelingTroupe_2:
mes "[Inspector]";
mes "\"Please return the mask to the traveling troupe.\"";
- close;
+ goto L_Close;
L_NohMask_Over:
- set Inspector, 15;
+ set @inspector, 15;
+ callsub S_Update_Mask;
mes "[Inspector]";
mes "\"My men have found all of the stolen items. They were all in the mining camp. We still don't know who did it.\"";
mes "[2500 experience points]";
getexp 2500, 0;
- close;
+ goto L_Close;
L_NohMask_End:
mes "[Inspector]";
mes "\"Remember to stay sharp. I might need your help on another case.\"";
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
+
+S_Update_Mask:
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_3_MASK)) | (@inspector << NIBBLE_3_SHIFT);
+ return;
}
diff --git a/world/map/npc/009-2/lena.txt b/world/map/npc/009-2/lena.txt
index e458eb74..c959d86f 100644
--- a/world/map/npc/009-2/lena.txt
+++ b/world/map/npc/009-2/lena.txt
@@ -1,20 +1,26 @@
// Quest for Fairy Hat and Forest Armor
+// Variables used: nibble 0 of QUEST_Hurnscald
009-2.gat,146,43,0|script|Lena|182,{
- if (TMW_Quest >= 46) goto L_Lena_Done;
- if (TMW_Quest == 45) goto L_Lena_Success;
- if (TMW_Quest == 44) goto L_Lena_Bandit_Leader_Fail;
- if (TMW_Quest == 43) goto L_Lena_Bandit_Leader_Fail;
- if (TMW_Quest == 42) goto L_Lena_Bandit_Leader;
- if (TMW_Quest == 41) goto L_Lena_Fairy_Hat;
- if (TMW_Quest == 40) && (BaseLevel >= 30) goto L_Lena_Start;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_Hurnscald & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+
+ if (@state >= 6) goto L_Lena_Done;
+ if (@state == 5) goto L_Lena_Success;
+ if (@state == 4) goto L_Lena_Bandit_Leader_Fail;
+ if (@state == 3) goto L_Lena_Bandit_Leader_Fail;
+ if (@state == 2) goto L_Lena_Bandit_Leader;
+ if (@state == 1) goto L_Lena_Fairy_Hat;
+ if (BaseLevel >= 30) goto L_Lena_Start;
mes "[Lena]";
mes "\"I got ambushed by a group of bandits and one of them stabbed me pretty good. Hopefully I heal up soon so I can fight this menace.\"";
next;
mes "\"Ah, I wish my dear friend Nickos could be here. He's one of the guards in Tulimshar and he'd know how to deal with those outlaws!\"";
- close;
+ goto L_Close;
L_Lena_Start:
mes "[Lena]";
@@ -22,20 +28,20 @@ L_Lena_Start:
menu
"Don't worry, I can take out some of these scumbags.", L_Lena_Approves,
"I think I left my courage in another pair of pants. See you later!", L_Lena_No_Fan;
- close;
L_Lena_Approves:
- set TMW_Quest, 41;
+ set @state, 1;
+ callsub S_Update_Var;
mes "[Lena]";
mes "\"You look like you can handle yourself in a fight. If you can take on this scourge I'll reward you with a hat like mine. In order to prove your mettle, bring me 10 Bandit Hoods so I know they've met their match.\"";
areamonster "008-1.gat",25,60,40,65,"Bandit",1064,3, "::";
areamonster "011-1.gat",35,40,65,60,"Bandit",1064,3, "::";
- close;
+ goto L_Close;
L_Lena_No_Fan:
mes "[Lena]";
mes "\"What will Hurnscald do if these bandits overrun the town? I hope you reconsider.\"";
- close;
+ goto L_Close;
L_Lena_Fairy_Hat:
if (countitem("BanditHood") < 10)
@@ -43,7 +49,8 @@ L_Lena_Fairy_Hat:
getinventorylist;
if (@inventorylist_count - (countitem("BanditHood")== 10) > 99)
goto L_TooMany;
- set TMW_Quest, 42;
+ set @state, 2;
+ callsub S_Update_Var;
delitem "BanditHood", 10;
getitem "FairyHat", 1;
mes "[Lena]";
@@ -53,12 +60,11 @@ L_Lena_Fairy_Hat:
menu
"Consider it done!", L_Lena_Bandit_Leader_Yes,
"Woah there, that sounds a bit harder than what I can succeed at.", L_Lena_NoWay;
- close;
L_Lena_NotEnough:
mes "[Lena]";
mes "\"You don't have enough Bandit Hoods to prove you are taking care of this threat. Please come back with 10 Bandit Hoods to show you are taking care of these bandits.\"";
- close;
+ goto L_Close;
L_Lena_Bandit_Leader:
mes "[Lena]";
@@ -66,44 +72,54 @@ L_Lena_Bandit_Leader:
menu
"Consider it done!", L_Lena_Bandit_Leader_Yes,
"Woah there, that sounds a bit harder than what I can succeed at.", L_Lena_NoWay;
- close;
L_Lena_Bandit_Leader_Yes:
- set TMW_Quest, 43;
+ set @state, 3;
+ callsub S_Update_Var;
areamonster "008-1.gat",25,60,40,65,"Bandit",1064,3, "::";
areamonster "011-1.gat",35,40,65,60,"Bandit",1064,3, "::";
mes "[Lena]";
mes "\"You have a brave heart. Though I know you can succeed on your own, I recommend finding others to help you defeat the bandit leader. I believe he could pose a significant threat to solitary individuals seeking to challenge him. Good luck!\"";
- close;
+ goto L_Close;
L_Lena_NoWay:
mes "[Lena]";
mes "\"That is too bad. Feel free to return at any time. This bandit threat needs to be pushed back.\"";
- close;
+ goto L_Close;
L_Lena_Bandit_Leader_Fail:
- set TMW_Quest, 43;
+ set @state, 3;
+ callsub S_Update_Var;
mes "[Lena]";
mes "\"You haven't killed the bandit leader yet. This is a big problem. Please be careful.\"";
- close;
+ goto L_Close;
L_Lena_Success:
getinventorylist;
if (@inventorylist_count == 100)
goto L_TooMany;
- set TMW_Quest, 46;
+ set @state, 6;
+ callsub S_Update_Var;
getitem "ForestArmor", 1;
mes "[Lena]";
mes "\"Excellent! You killed the bandit leader. Here is the armor as I promised you. Safe journeys!\"";
- close;
+ goto L_Close;
L_Lena_Done:
mes "[Lena]";
mes "\"Thank you for all your help. With your efforts, we can only hope this scourge doesn't see a resurgence.\"";
- close;
+ goto L_Close;
L_TooMany:
mes "[Lena]";
mes "\"You have too many items in your inventory. Please get rid of something so I can reward you.\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_0_MASK) | (@state << NIBBLE_0_SHIFT));
+ return;
}
diff --git a/world/map/npc/009-2/nurse.txt b/world/map/npc/009-2/nurse.txt
index 7052edc0..b89d1f60 100644
--- a/world/map/npc/009-2/nurse.txt
+++ b/world/map/npc/009-2/nurse.txt
@@ -28,6 +28,8 @@
goto L_TrickOrTreat;
L_Begin:
+ callfunc "ClearVariables";
+
set @SNAKET_AMOUNT, 5;
set @BSCORPIONST_AMOUNT, 10;
// This quest can be done very often: so give less xp
@@ -45,6 +47,8 @@ L_Begin:
set @Q_poison_SHIFT, NIBBLE_7_SHIFT;
set @Q_poison, (QUEST_Forestbow_state & @Q_poison_MASK) >> @Q_poison_SHIFT;
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
if (@Q_poison == 7) goto state7;
if (@Q_poison == 6) goto state6;
if (@Q_poison == 5) goto state5;
@@ -59,25 +63,25 @@ L_Usual:
mes "\"How can I help you?\"";
next;
- if (Inspector == 1)
+ if (@inspector == 1)
menu
"Oooh, these wounds! They hurt so much!", L_Heal,
"I don't feel so well, I might be sick.", L_Doctor,
"Have you seen anything out of the ordinary?", L_NohMask,
"No, I'm fine.", -;
- if (Inspector != 1)
+ if (@inspector != 1)
menu
"Oooh, these wounds! They hurt so much!", L_Heal,
"I don't feel so well, I might be sick.", L_Doctor,
"No, I'm fine.", -;
mes "[Nurse]";
mes "\"Then I would ask you to leave. There are people who really need our help.\"";
- close;
+ goto L_Close;
L_Doctor:
mes "[Nurse]";
mes "\"Then you should better see the doctor. He is usually in his office on the 3rd floor.\"";
- close;
+ goto L_Close;
L_Heal:
if (BaseLevel > 20) goto L_NoHeal;
@@ -85,19 +89,19 @@ L_Heal:
mes "\"Here, let me heal you.\"";
next;
heal 10000, 10000;
- close;
+ goto L_Close;
L_NoHeal:
mes "[Nurse]";
mes "\"I'm sorry but I'm here only to help young people.";
mes "Your level is already higher than 20.";
mes "You can get some rest in the inn near here.\"";
- close;
+ goto L_Close;
L_NohMask:
mes "[Nurse]";
mes "\"I'm too busy here to observe the town.\"";
- close;
+ goto L_Close;
state0:
mes "[Nurse]";
@@ -124,7 +128,7 @@ L_firstquest:
L_ExplainAgain1:
mes "\"Please bring me five tongues of snakes and ten stingers of black scorpions.\"";
- close;
+ goto L_Close;
state1:
mes "[Nurse]";
@@ -134,7 +138,7 @@ state1:
"Actually, I have another question.", L_Usual,
"Sorry, I forgot. What shall I bring you?", L_ExplainAgain1,
"I have what you asked for.", -,
- "I'm still working on that.", quit;
+ "I'm still working on that.", L_Close;
if (countitem("SnakeTongue") < @SNAKET_AMOUNT || countitem("BlackScorpionStinger") < @BSCORPIONST_AMOUNT)
goto L_NotEnough;
delitem "SnakeTongue", @SNAKET_AMOUNT;
@@ -150,7 +154,7 @@ state1:
L_ExplainAgain2:
mes "\"Please bring me ten acorns, five red apples, five green apples and also five oranges. And we need some small healing potions. They will be useful to hold off the baneful effects. Three of them will be enough, I guess.\"";
- close;
+ goto L_Close;
state2:
mes "You look at the nurse, who seems to be really tired, with shadows under her eyes. When she recognizes you, she smiles.";
@@ -161,7 +165,7 @@ state2:
"Actually, I have another question.", L_Usual,
"I have a bad memory. Can you tell me again what we need?", L_ExplainAgain2,
"I managed to get everything we need.", -,
- "I will go and get it.", quit;
+ "I will go and get it.", L_Close;
if (countitem("Acorn") < @ACORNS_AMOUNT
|| countitem("GreenApple") < @GREENAPPLE_AMOUNT
|| countitem("RedApple") < @REDAPPLE_AMOUNT
@@ -199,7 +203,7 @@ L_Chemistry:
mes "\"If we make a mistake, this might be exhausting and painful, so you should rest a while and prepare yourself.\"";
next;
mes "\"Come back when you feel ready for that task.\"";
- close;
+ goto L_Close;
state3:
mes "[Nurse]";
@@ -378,7 +382,7 @@ l_hl_m_vn:
// bye bye player!
heal -Hp, 0;
// close instead of telling how much stabilizer is needed
- close;
+ goto L_Close;
// goto check_st;
l_hl_l_vn:
@@ -426,13 +430,13 @@ allcorrect:
setskill SKILL_RESIST_POISON, 1;
set @Q_poison, 7;
callsub S_Update_Var;
- close;
+ goto L_Close;
notallcorrect:
mes "[Nurse]";
mes "\"It didn't work. You are a really brave person. Now you should rest and recover. I hope you won't give up now. Please come back later, so we can try it again.\"";
next;
- close;
+ goto L_Close;
state4:
mes "The nurse has a worried look in her face.";
@@ -500,9 +504,10 @@ L_NotEnough:
if (@Q_poison == 2)
goto L_ExplainAgain2;
// the following close *should* never be reached, but who knows, whoever will mess this script up!
- close;
+ goto L_Close;
-quit:
+L_Close:
+ set @inspector, 0;
close;
S_Update_Var:
diff --git a/world/map/npc/011-4/bl_barrier.txt b/world/map/npc/011-4/bl_barrier.txt
index e7dfd98c..13524ee8 100644
--- a/world/map/npc/011-4/bl_barrier.txt
+++ b/world/map/npc/011-4/bl_barrier.txt
@@ -1,13 +1,20 @@
//bandit lord barrier
011-4.gat,111,121,0|script|#BL_Barrier|45,0,0,{
- if (TMW_Quest >= 44) goto L_Bandit_Lord_Barrier_Open;
+
+ set @state, ((QUEST_Hurnscald & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+
+ if (@state >= 4) goto L_Bandit_Lord_Barrier_Open;
message strcharinfo(0), "This entrance appears to be locked.";
- end;
+ goto L_End;
L_Bandit_Lord_Barrier_Open:
message strcharinfo(0), "You insert the silver arrow key and unlock the entrance.";
warp "011-6.gat",251,275;
+ goto L_End;
+
+L_End:
+ set @state, 0;
end;
}
diff --git a/world/map/npc/011-6/bryant.txt b/world/map/npc/011-6/bryant.txt
index 9cd2e20a..6d875686 100644
--- a/world/map/npc/011-6/bryant.txt
+++ b/world/map/npc/011-6/bryant.txt
@@ -1,14 +1,20 @@
//NPC to set the state for killing the bandit lord.
+// Variables used: nibble 0 of QUEST_Hurnscald
011-6.gat,27,200,0|script|Bryant|126,{
- if (TMW_Quest >= 45) goto L_Bryant_Quiet;
- if (TMW_Quest == 44) goto L_Bryant_Waits;
- if (TMW_Quest == 43) goto L_Bryant_Summon;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+
+ set @state, ((QUEST_Hurnscald & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+
+ if (@state >= 5) goto L_Bryant_Quiet;
+ if (@state == 4) goto L_Bryant_Waits;
+ if (@state == 3) goto L_Bryant_Summon;
mes "[Bryant]";
mes "\"I'm looking everywhere for the bandit leader. I can't seem to find him.\"";
- close;
+ goto L_Close;
L_Bryant_Summon:
mes "[Bryant]";
@@ -17,14 +23,20 @@ L_Bryant_Summon:
mes "Bryant gives you a key, shaped to look like a small silver arrow.";
next;
mes "\"I believe I saw him run into a cave south and east of here. There is a red carpet in front of the cave entrance. Be careful and good luck.\"";
- set TMW_Quest, 44;
+ set @state, 4;
+ callsub S_Update_Var;
monster "011-6.gat",260,250,"BanditLord",1065,1, "Bryant::onBanditLordDead";
- close;
+ goto L_Close;
onBanditLordDead:
- if (TMW_Quest<45)
- set TMW_Quest, 45;
message strcharinfo(0), "You killed the bandit lord.";
+ set @state, ((QUEST_Hurnscald & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+ if (@state != 4)
+ goto L_End;
+ set @state, 5;
+ callsub S_Update_Var;
+L_End:
+ set @state, 0;
end;
L_Bryant_Waits:
@@ -33,24 +45,31 @@ L_Bryant_Waits:
menu
"No.", L_Bryant_No,
"Yes.", L_Bryant_Yes;
- close;
L_Bryant_No:
mes "[Bryant]";
mes "\"Well, maybe he ran off. I'm pretty sure he should be there now.\"";
killmonster "011-6.gat", "Bryant::onBanditLordDead";
monster "011-6.gat",260,250,"BanditLord",1065,1, "Bryant::onBanditLordDead";
- close;
+ goto L_Close;
L_Bryant_Yes:
mes "[Bryant]";
mes "\"I don't think you killed him. Please try to find and kill him. He should be in the cave south and east of here with the red carpet in front of it.\"";
killmonster "011-6.gat", "Bryant::onBanditLordDead";
monster "011-6.gat",260,250,"BanditLord",1065,1, "Bryant::onBanditLordDead";
- close;
+ goto L_Close;
L_Bryant_Quiet:
mes "[Bryant]";
mes "\"Glad that bandit leader got what was coming to him.\"";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Var:
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_0_MASK) | (@state << NIBBLE_0_SHIFT));
+ return;
}
diff --git a/world/map/npc/013-3/barrier.txt b/world/map/npc/013-3/barrier.txt
index 6de45440..63c5eae9 100644
--- a/world/map/npc/013-3/barrier.txt
+++ b/world/map/npc/013-3/barrier.txt
@@ -1,17 +1,30 @@
//
013-3.gat,71,21,0|script|#DemonMineBarrier1#_M|45,1,1,{
- if (QUEST_demon_mines >= 2) close;
- if (QUEST_demon_mines == 1 && countitem("JackOSoul") >= 1) goto L_Has_Jack_O_Soul;
+ callfunc "ClearVariables";
- mes "A barrier around the opening pushes you back as you approach.";
+ set @state, ((QUEST_Hurnscald & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
+
+ if (@state >= 2) goto L_Close;
+ if (@state == 1 && countitem("JackOSoul") >= 1) goto L_Has_Jack_O_Soul;
+
+ message strcharinfo(0), "A barrier around the opening pushes you back as you approach.";
warp "013-3.gat", 71, 25;
- close;
+ goto L_End;
L_Has_Jack_O_Soul:
- mes "The barrier around the opening allows you passage.";
- set QUEST_demon_mines, 2;
+ message strcharinfo(0), "The barrier around the opening allows you passage.";
+ set @state, 2;
+ callsub S_Update_Mask;
delitem "JackOSoul", 1;
- close;
+ goto L_End;
+
+L_End:
+ set @state, 0;
+ end;
+
+S_Update_Mask:
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_2_MASK)) | (@state << NIBBLE_2_SHIFT);
+ return;
}
diff --git a/world/map/npc/013-3/mask_chest.txt b/world/map/npc/013-3/mask_chest.txt
index 59aa0819..4a15bc0b 100644
--- a/world/map/npc/013-3/mask_chest.txt
+++ b/world/map/npc/013-3/mask_chest.txt
@@ -1,8 +1,12 @@
//
013-3.gat,28,27,0|script|Chest#DemonMask|111,{
- if (QUEST_demon_mines < 2) goto L_This_shouldn_t_happen;
- if (QUEST_demon_mines == 3) goto L_Finished;
+ callfunc "ClearVariables";
+
+ set @state, ((QUEST_Hurnscald & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
+
+ if (@state < 2) goto L_This_shouldn_t_happen;
+ if (@state == 3) goto L_Finished;
if (countitem("MaggotSlime") == 0)
goto L_No_maggot_slime;
@@ -112,97 +116,106 @@
mes "You managed to perform the ritual and open the chest.";
getitem "DemonMask", 1;
mes "You found a demon mask inside.";
- set QUEST_demon_mines, 3;
- close;
+ set @state, 3;
+ callsub S_Update_Mask;
+ goto L_Close;
L_No_maggot_slime:
mes "You do not have any maggot slime.";
- close;
+ goto L_Close;
L_No_mushroom:
mes "You do not have a mushroom, neither big, nor small.";
- close;
+ goto L_Close;
L_No_pink_petal:
mes "You can't seem to find that pink petal you had.";
- close;
+ goto L_Close;
L_No_pearl:
mes "You do not have a pearl, let alone one from the sea.";
- close;
+ goto L_Close;
L_No_hard_spike:
mes "You weren't able to find a hard spike in the stuff you brought.";
- close;
+ goto L_Close;
L_No_raw_log:
mes "You don't have any wood.";
- close;
+ goto L_Close;
L_No_pink_antenna:
mes "You aren't carrying any antenna.";
- close;
+ goto L_Close;
L_No_tongues:
mes "You don't have four different snake tongues.";
- close;
+ goto L_Close;
L_No_treasure_key:
mes "No treasure chest key, no opening ritual.";
- close;
+ goto L_Close;
L_No_ash:
mes "You still need a pile of ash.";
- close;
+ goto L_Close;
L_No_herbs:
mes "Four different herbs are needed to get this thing open.";
- close;
+ goto L_Close;
L_No_bug_leg:
mes "You do not have part of a bug on you. That is rather odd considering what you went through to get here.";
- close;
+ goto L_Close;
L_No_lamp:
mes "You do not have a lamp. Yet, somehow, you were able to get this far into this dark cave.";
- close;
+ goto L_Close;
L_No_iron_ore:
mes "\"Rock and metal, as one.\" You don't seem to have anything that fits the bill.";
- close;
+ goto L_Close;
L_No_stingers:
mes "Three scorpion deaths are still missing.";
- close;
+ goto L_Close;
L_No_silk:
mes "You could not find the womb for a butterfly among your stuff.";
- close;
+ goto L_Close;
L_No_fur:
mes "You wonder how you can carry the \"gentle caress of a creature without blemish.\" But you need it to get this thing open.";
- close;
+ goto L_Close;
L_No_dark_crystal:
mes "A piece of darkness is missing.";
- close;
+ goto L_Close;
L_No_water:
mes "Just one bottle of water and you can start the ritual.";
- close;
+ goto L_Close;
L_This_shouldn_t_happen:
warp "013-3.gat", 71, 25;
// You need to go through the barrier to get to the chest, so this shouldn't happen. So just warp them like the barrier does.
- close;
+ goto L_Close;
L_Finished:
mes "[Chest]";
mes "You already opened this chest.";
- close;
+ goto L_Close;
L_TooMany:
mes "[Chest]";
mes "You don't have room for what ever is inside. Maybe you should try again later.";
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Mask:
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_2_MASK)) | (@state << NIBBLE_2_SHIFT);
+ return;
}
diff --git a/world/map/npc/013-3/sword_chest.txt b/world/map/npc/013-3/sword_chest.txt
index bb89e3f3..8c89b52d 100644
--- a/world/map/npc/013-3/sword_chest.txt
+++ b/world/map/npc/013-3/sword_chest.txt
@@ -1,14 +1,15 @@
//
013-3.gat,177,22,0|script|Chest|111,{
- if( ChestQuest & 2) goto L_Finished;
+ callfunc "ClearVariables";
+ if (FLAGS & FLAG_HURNSMINE_CHEST) goto L_Finished;
mes "[Chest]";
mes "Would you try to open it?";
next;
menu
- "Yes", L_Yes,
- "No", -;
+ "Yes.", L_Yes,
+ "No.", -;
close;
L_Yes:
@@ -22,7 +23,7 @@ L_Yes:
getitem "ShortSword", 1;
mes "[Chest]";
mes "You opened it and found a short sword!";
- set ChestQuest, ChestQuest | 2;
+ set FLAGS, FLAGS | FLAG_HURNSMINE_CHEST;
close;
L_Not_Enough:
diff --git a/world/map/npc/018-2/angus.txt b/world/map/npc/018-2/angus.txt
index d5b9ad08..f44bef56 100644
--- a/world/map/npc/018-2/angus.txt
+++ b/world/map/npc/018-2/angus.txt
@@ -4,15 +4,23 @@
set @honorific$, "lad";
if (Sex == 0) set @honorific$, "lass";
- if (Inspector == 10) goto L_NohMask;
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
+ if (@inspector == 10) goto L_NohMask;
mes "[Angus]";
mes "Angus is tinkering with some mechanical concoction.";
mes "\"It keeps breakin' left an' right... fortunat'ly I put in redundancies everywhere, but I haf' to keep repairin'.\"";
- close;
+ goto L_Close;
L_NohMask:
mes "[Angus]";
mes "\"I'm sorry, " + @honorific$ + ", I truely am, but I stay in the town. One o' the miners might have heard something.\"";
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
}
diff --git a/world/map/npc/018-2/books.txt b/world/map/npc/018-2/books.txt
index 260b670d..81b439da 100644
--- a/world/map/npc/018-2/books.txt
+++ b/world/map/npc/018-2/books.txt
@@ -1,15 +1,24 @@
//
018-2.gat,112,19,0|script|#Bookcase38|127,0,1{
- if (Inspector == 11) goto L_NohMask;
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
+ if (@inspector == 11) goto L_NohMask;
mes "Looking over the bookcase, you find nothing strange or out of order.";
- close;
+ goto L_Close;
L_NohMask:
mes "Looking over the bookcase closely, you find a book is upside down.";
next;
mes "The book has been hollowed out. Inside is a theater mask and a note that you cannot even begin to read.";
next;
- set Inspector, 12;
+ set @inspector, 12;
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_3_MASK)) | (@inspector << NIBBLE_3_SHIFT);
+ goto L_Close;
+
+L_Close:
+ set @inspector, 0;
close;
}
diff --git a/world/map/npc/018-2/caul.txt b/world/map/npc/018-2/caul.txt
index f1e9ac90..3b5f771f 100644
--- a/world/map/npc/018-2/caul.txt
+++ b/world/map/npc/018-2/caul.txt
@@ -8,6 +8,10 @@
//#################################################################################
018-2.gat,37,22,0|script|Caul|107,{
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
set @SETZER_INITIAL, 0;
set @SETZER_KNOWS_OIL, 1;
set @SETZER_KNOWS_STINGER, 2;
@@ -59,7 +63,7 @@ L_M_no_monster_oil:
set @choices_nr, @choices_nr + 1;
L_M_no_mopox_cure:
- if (Inspector != 10)
+ if (@inspector != 10)
goto L_M_no_inspector;
set @choice_idx[@choices_nr], @C_nohmask;
@@ -1058,10 +1062,11 @@ L_calc_dempo_color:
L_NohMask:
mes "[Caul]";
mes "\"I'm sorry, but I didn't. I'm staying in town. Try asking one of the miners.\"";
- close;
+ goto L_close;
L_close:
- close;
+ set @inspector, 0;
+ close;
S_Update_Var:
set QUEST_Forestbow_state,
diff --git a/world/map/npc/018-2/miners.txt b/world/map/npc/018-2/miners.txt
index 3597314a..21d57957 100644
--- a/world/map/npc/018-2/miners.txt
+++ b/world/map/npc/018-2/miners.txt
@@ -2,29 +2,33 @@
// Authors: Ali-G, enchilado, Jenalya
018-2.gat,85,23,0|script|Malek|109,{
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
set @MIN_GEM_AMOUNT, 7;
- if (Inspector == 10) goto L_NohMask;
+ if (@inspector == 10) goto L_NohMask;
mes "[Malek]";
mes "\"Hi, can I help you at all?\"";
menu
"I'm looking for someone able to make gem powder.", L_GemPowder,
- "I was just having a look, have a nice day.", L_abort;
+ "I was just having a look, have a nice day.", L_Close;
L_NohMask:
mes "[Malek]";
mes "\"Hi, can I help you at all?\"";
menu
"I'm looking for someone able to make gem powder.", L_GemPowder,
- "I was just having a look, have a nice day.", L_abort,
+ "I was just having a look, have a nice day.", L_Close,
"The inspector sent me here to investigate.", L_Investigation;
L_Investigation:
- set Inspector, 11;
+ set @inspector, 11;
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_3_MASK)) | (@inspector << NIBBLE_3_SHIFT);
mes "\"Yeah, we did hear a commotion. We thought we heard someone go down to the basement, but we checked the whole place over and didn't see anything out of the ordinary.\"";
- close;
+ goto L_Close;
L_GemPowder:
mes "[Malek]";
@@ -32,15 +36,15 @@ L_GemPowder:
mes "\"Do you want me to make any for you?\"";
menu
"Yes, I really need some.", L_GemPowderStart,
- "Actually, I don't want anything. Have a nice day.", L_abort;
+ "Actually, I don't want anything. Have a nice day.", L_Close;
L_GemPowderStart:
mes "[Malek]";
mes "\"Well, I can do that. Bring me a gem and I'll make you some powder - hope you don't mind if I keep a little as payment!\"";
menu
"I've got some gems.", L_Check_Gems,
- "I'll be back with a gem soon.", L_abort,
- "Actually, I prefer my gems whole. Thanks anyway.", L_abort;
+ "I'll be back with a gem soon.", L_Close,
+ "Actually, I prefer my gems whole. Thanks anyway.", L_Close;
L_Check_Gems:
mes "[Malek]";
@@ -104,7 +108,8 @@ L_Choose_Gem:
@menuitems$[5], -,
@menuitems$[6], -;
set @menu, @menu - 1;
- if (@menu >= @c) close;
+ if (@menu >= @c)
+ goto L_Close;
if (@menuid[@menu] == 0)
set @gem$, "Diamond";
if (@menuid[@menu] == 1)
@@ -118,7 +123,7 @@ L_Choose_Gem:
if (@menuid[@menu] == 5)
set @gem$, "Amethyst";
if (@menuid[@menu] == 6)
- goto L_abort;
+ goto L_Close;
getinventorylist;
if (countitem(@gem$) < 1)
@@ -145,18 +150,19 @@ L_Choose_Gem:
mes "\"Do you need me to make any more?\"";
menu
"Yes please.", L_Check_Gems,
- "No thank you, this is enough.", L_abort;
+ "No thank you, this is enough.", L_Close;
L_TooMany:
mes "[Malek]";
mes "\"Doesn't look like you've got room for this powder. Come back when you do.\"";
- close;
+ goto L_Close;
L_no_gem:
mes "[Malek]";
mes "\"You don't have that gem.\"";
- close;
+ goto L_Close;
-L_abort:
+L_Close:
+ set @inspector, 0;
close;
}
diff --git a/world/map/npc/018-2/receptionist.txt b/world/map/npc/018-2/receptionist.txt
index f49f68db..5f03c4b1 100644
--- a/world/map/npc/018-2/receptionist.txt
+++ b/world/map/npc/018-2/receptionist.txt
@@ -1,26 +1,28 @@
//
018-2.gat,50,24,0|script|Receptionist|108,{
+ callfunc "ClearVariables";
+
+ set @inspector, ((QUEST_Hurnscald & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT);
+
mes "[Receptionist]";
mes "\"Welcome to the mining camp!";
mes "Do you need anything?\"";
next;
L_Menu:
- if (Inspector == 10)
+ if (@inspector == 10)
menu
"Why was a mine setup here?", L_Mine,
"Can I go into the mine?", L_Enter,
"Did the company build this building?", L_Building,
"Did you hear a commotion here the other night?", L_NohMask,
- "Thank you, no.", -;
- if (Inspector != 10)
- menu
- "Why was a mine setup here?", L_Mine,
- "Can I go into the mine?", L_Enter,
- "Did the company build this building?", L_Building,
- "Thank you, no.", -;
- close;
+ "Thank you, no.", L_Close;
+ menu
+ "Why was a mine setup here?", L_Mine,
+ "Can I go into the mine?", L_Enter,
+ "Did the company build this building?", L_Building,
+ "Thank you, no.", L_Close;
L_Mine:
mes "[Receptionist]";
@@ -57,4 +59,8 @@ L_Question_End:
mes "\"Do you need anything else?\"";
next;
goto L_Menu;
+
+L_Close:
+ set @inspector, 0;
+ close;
}
diff --git a/world/map/npc/018-3/bookcase.txt b/world/map/npc/018-3/bookcase.txt
index 2e04c06b..38af0d0e 100644
--- a/world/map/npc/018-3/bookcase.txt
+++ b/world/map/npc/018-3/bookcase.txt
@@ -1,15 +1,18 @@
//
018-3.gat,75,123,0|script|#DemonMineBookcase1|127,{
- if (QUEST_demon_mines == 0) goto L_Search;
+ callfunc "ClearVariables";
+
+ set @state, ((QUEST_Hurnscald & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT);
+
+ if (@state == 0) goto L_Search;
mes "You see nothing different about the bookcase.";
mes "Do you want to search it again anyways?";
next;
menu
- "Yes", L_Search,
- "No", -;
- close;
+ "Yes.", L_Search,
+ "No.", L_Close;
L_Search:
mes "After searching the bookcase, you were able to find a few passages that you can read.";
@@ -50,7 +53,17 @@ L_Search:
mes "";
mes "You begin to wonder if you read that list right.";
next;
- if (QUEST_demon_mines == 0)
- set QUEST_demon_mines, 1;
+ if (@state != 0)
+ goto L_Close;
+ set @state, 1;
+ callsub S_Update_Mask;
+ goto L_Close;
+
+L_Close:
+ set @state, 0;
close;
+
+S_Update_Mask:
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_2_MASK)) | (@state << NIBBLE_2_SHIFT);
+ return;
}
diff --git a/world/map/npc/021-2/kylian.txt b/world/map/npc/021-2/kylian.txt
index 2f5b903a..737214a5 100644
--- a/world/map/npc/021-2/kylian.txt
+++ b/world/map/npc/021-2/kylian.txt
@@ -70,6 +70,10 @@ OnInit:
set @fun_money, 50;
set @fun_exp, 20;
+ // This NPC previously used the variable TMW_Quest
+ callfunc "ClearVarTMW_Quest";
+ set @bernard, ((QUEST_SouthTulimshar & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT);
+
if (@state == 9) goto L_Done;
if (@KylianNTCasino) goto L_CasinoDone;
if (@state == 8) goto L_DesertHat;
@@ -166,7 +170,7 @@ L_SightSeeing: // @state == 4 and logged out sometime between getting to that st
L_Food: // @state == 5
mes "[Kylian]";
mes "\"While I'm out, I could also get something to eat. Maybe some typical dish for this region. Do you have a good suggestion for that?\"";
- if (TMW_Quest < 4) // didn't yet help Bernard to make his soup
+ if (@bernard < 4) // didn't yet help Bernard to make his soup
goto L_Close;
menu
"Bernard on the bazaar makes a great soup.",-,
@@ -265,6 +269,7 @@ L_Close:
set @fun_money, 0;
set @fun_exp, 0;
set @inventorylist_count, 0;
+ set @bernard, 0;
// NOT set to zero: @KylianNTLicense, @KylianNTSightSeeing and @KylianNTCasino
// those are used to check if the player logged out in the meanwhile
close;
diff --git a/world/map/npc/functions/clear_vars.txt b/world/map/npc/functions/clear_vars.txt
index cc6f097d..48002fa4 100644
--- a/world/map/npc/functions/clear_vars.txt
+++ b/world/map/npc/functions/clear_vars.txt
@@ -1,6 +1,8 @@
// Clears old variables
function|script|ClearVariables|{
+ set EasterQuest, 0;
+
// Halloween 2006
set HWQUEST1, 0;
set HWQUEST2, 0;
@@ -46,6 +48,8 @@ function|script|ClearVariables|{
set XMASQUEST19, 0;
set XMASQUEST20, 0;
+ set QUEST_Halloween07_state, 0;
+
set QUEST_xmas07_state, 0;
set QUEST_xmas07_milk, 0;
set QUEST_xmas07_cookies, 0;
@@ -94,6 +98,19 @@ function|script|ClearVariables|{
set Xmas2010, 0;
set Golbenez_Inn_Cost, 0;
+ set QUEST_Easter11, 0;
+
+ // contains bad karma information
+ // set hw2011, 0;
+
+ set xmas11, 0;
+
+ set QUEST_Easter12, 0;
+
+ set xmas2012, 0;
+
+ set QUEST_clothdyer_angus, 0;
+
// Tulimshar and Mine Variables which aren't used anymore
set Scorp, 0;
set Bugleg, 0;
@@ -106,6 +123,16 @@ function|script|ClearVariables|{
// quest was turned into a Daily Quest, so the variable isn't needed anymore
set CaveSnakeLamp, 0;
+ // move Scythe quest into bitmasked variable QUEST_Hurnscald
+ if (QUEST_Scythe_state)
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_1_MASK)) | (QUEST_Scythe_state << NIBBLE_1_SHIFT);
+ set QUEST_Scythe_state, 0;
+
+ // move Demon Mask quest into bitmasked variable QUEST_Hurnscald
+ if (QUEST_demon_mines)
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_2_MASK)) | (QUEST_demon_mines << NIBBLE_2_SHIFT);
+ set QUEST_demon_mines, 0;
+
//These lines are needed to migrate stuff from variables to flags
if (Open_Underground_Palace_Barrier)
set FLAGS, FLAGS | FLAG_OPENED_UNDERGROUND;
@@ -123,6 +150,10 @@ function|script|ClearVariables|{
set FLAGS, FLAGS | FLAG_SANTAS_HELPER;
set ChristmasQuest2, 0;
+ if (ChestQuest)
+ set FLAGS, FLAGS | FLAG_HURNSMINE_CHEST;
+ set ChestQuest, 0;
+
if (#BankAccount < 0)
goto FixBank;
@@ -143,6 +174,56 @@ L_Fix_Full:
return;
}
+// The variable TMW_Quest was used to save the progress in several subquests linearly.
+// The subquests are moved to different nibbles of other variables
+// to make it possible to do some of the quests in parallel.
+function|script|ClearVarTMW_Quest|{
+
+ if (TMW_Quest == 0) goto L_Done;
+ if (TMW_Quest <= 6) goto L_Bernard_Mikhail;
+ if (TMW_Quest <= 8) goto L_Sarah;
+ if (TMW_Quest <= 10) goto L_Vincent;
+ if (TMW_Quest <= 12) goto L_Sandra;
+ if (TMW_Quest <= 40) goto L_Desert;
+
+L_Bandit:
+// move Bandit subquest into Nibble 0 of QUEST_Hurnscald
+ set @bandit, TMW_Quest - 40;
+ set QUEST_Hurnscald, (QUEST_Hurnscald & ~(NIBBLE_0_MASK) | (@bandit << NIBBLE_0_SHIFT));
+ set TMW_Quest, 40;
+ set @bandit, 0;
+L_Desert:
+// move guard and miner subquest into Byte 2 (Nibble 4 and 5) of QUEST_SouthTulimshar
+ set @miners, TMW_Quest - 12;
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(BYTE_2_MASK) | (@miners << BYTE_2_SHIFT));
+ set TMW_Quest, 12;
+ set @miners, 0;
+L_Sandra:
+// move Sandra subquest into Nibble 3 of QUEST_SouthTulimshar
+ set @sandra, TMW_Quest - 10;
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_3_MASK) | (@sandra << NIBBLE_3_SHIFT));
+ set TMW_Quest, 10;
+ set @sandra, 0;
+L_Vincent:
+// move Vincent subquest into Nibble 2 of QUEST_SouthTulimshar
+ set @vincent, TMW_Quest - 8;
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_2_MASK) | (@vincent << NIBBLE_2_SHIFT));
+ set TMW_Quest, 8;
+ set @vincent, 0;
+L_Sarah:
+// move Sarah subquest into Nibble 1 of QUEST_SouthTulimshar
+ set @sarah, TMW_Quest - 6;
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_1_MASK) | (@sarah << NIBBLE_1_SHIFT));
+ set TMW_Quest, 6;
+ set @sarah, 0;
+L_Bernard_Mikhail:
+// move Bernard and Mikhail subquest into Nibble 0 of QUEST_SouthTulimshar
+ set QUEST_SouthTulimshar, (QUEST_SouthTulimshar & ~(NIBBLE_0_MASK) | (TMW_Quest << NIBBLE_0_SHIFT));
+ set TMW_Quest, 0;
+L_Done:
+ return;
+}
+
-|script|#ClearGlobalVars|-1,{
OnInit: