From fca55b24d912c46929ea88b7851faf16869b3158 Mon Sep 17 00:00:00 2001 From: Jessica Tölke Date: Thu, 27 Jan 2011 23:13:19 +0100 Subject: using bitmasking in the crying child quest --- npc/027-1_Graveyard/_mobs.txt | 28 +++++++++++++++--- npc/027-2_Caretakers_House/crying_child.txt | 45 +++++++++++++++++++---------- 2 files changed, 53 insertions(+), 20 deletions(-) (limited to 'npc') diff --git a/npc/027-1_Graveyard/_mobs.txt b/npc/027-1_Graveyard/_mobs.txt index 118ce586..24d60cb2 100644 --- a/npc/027-1_Graveyard/_mobs.txt +++ b/npc/027-1_Graveyard/_mobs.txt @@ -78,26 +78,46 @@ On1047: break; _MOBCOUNT_ZOMBIES: - if (QUEST_GYINN != 1) return; + + set @Graveyard_Inn_MASK, NIBBLE_2_MASK; + set @Graveyard_Inn_SHIFT, NIBBLE_2_SHIFT; + + set @state, ((QUEST_Graveyard_Inn & @Graveyard_Inn_MASK) >> @Graveyard_Inn_SHIFT); + + if (@state != 1) return; // You have to kill 50?(or more?) zombies OR 50?(or more?) fallens. If you close the client, the @zombies count go back to zero. set @zombies, @zombies + 1; // This is in DEBUG mode. That is the reason for the message. message strcharinfo(0), "I killed " +@zombies+ " zombies. Now I need to kill only " +(50-@zombies)+ "."; if (@zombies < 50) return; message strcharinfo(0), "You found a strange bracelet hidden in the zombie's rotten rags. Maybe this is what the Crying child was looking for..."; - set QUEST_GYINN, 2; + set @state, 2; + callsub S_Update_Mask; return; _MOBCOUNT_FALLENS: - if (QUEST_GYINN != 1) return; + + set @Graveyard_Inn_MASK, NIBBLE_2_MASK; + set @Graveyard_Inn_SHIFT, NIBBLE_2_SHIFT; + + set @state, ((QUEST_Graveyard_Inn & @Graveyard_Inn_MASK) >> @Graveyard_Inn_SHIFT); + + if (@state != 1) return; // You have to kill 50?(or more?) fallens OR 50?(or more?) zombies. If you close the client, the @fallens count go back to zero. set @fallens, @fallens + 1; // This is in DEBUG mode. That is the reason for the message. message strcharinfo(0), "I killed " +@fallens+ " fallens. Now I need to kill only " +(50-@fallens)+ "."; if (@fallens < 50) return; message strcharinfo(0), "You found a strange bracelet inside the fallen's broken helmet. Maybe this is what the Crying child was looking for..."; - set QUEST_GYINN, 2; + set @state, 2; + callsub S_Update_Mask; return; + +S_Update_Mask: + set QUEST_Graveyard_Inn, + (QUEST_Graveyard_Inn & ~(@Graveyard_Inn_MASK)) + | (@state << @Graveyard_Inn_SHIFT); + return; end; } diff --git a/npc/027-2_Caretakers_House/crying_child.txt b/npc/027-2_Caretakers_House/crying_child.txt index a42be868..e7207064 100644 --- a/npc/027-2_Caretakers_House/crying_child.txt +++ b/npc/027-2_Caretakers_House/crying_child.txt @@ -1,6 +1,4 @@ 027-2.gat,50,92,0 script Crying Child 314,{ - end; - // Crying Child subquest (Still need to change it to Bitmask) // Variable states: @@ -12,14 +10,19 @@ // 6 = The mother/wife told you what he thinks of the bracelet // 7 = The kid decided that the bracelet has no value to their parents, so you can have it. + set @Graveyard_Inn_MASK, NIBBLE_2_MASK; + set @Graveyard_Inn_SHIFT, NIBBLE_2_SHIFT; + + set @state, ((QUEST_Graveyard_Inn & @Graveyard_Inn_MASK) >> @Graveyard_Inn_SHIFT); + if (Sex == 0) set @madamsir$, "Madam"; if (Sex == 1) set @madamsir$, "Sir"; - if (QUEST_GYINN == 7) goto L_return5; - if (QUEST_GYINN == 6) goto L_return4; - if (QUEST_GYINN == 4 || QUEST_GYINN == 5) goto L_return3; - if (QUEST_GYINN == 3) goto L_return2; - if (QUEST_GYINN == 2) goto L_return1; - if (QUEST_GYINN == 1) goto L_return; + if (@state == 7) goto L_return5; + if (@state == 6) goto L_return4; + if (@state == 4 || @state == 5) goto L_return3; + if (@state == 3) goto L_return2; + if (@state == 2) goto L_return1; + if (@state == 1) goto L_return; if (BaseLevel >= 80) goto L_intro; @@ -63,7 +66,8 @@ L_intro: mes "[Aldred]"; mes "\"Thank you " +strcharinfo(0)+"! I hope you find it soon! It is not like it is worth a lot of money... It looks like a simple thing, but I really don't know what would be my dad's reaction when he finds out I lost something that belongs to him!\""; - set QUEST_GYINN, 1; + set @state, 1; + callsub S_Update_Mask; close; L_return: @@ -87,7 +91,8 @@ L_return1: next; mes "[Aldred]"; mes "\"Now I will put this thing in its right place... Thank you!\""; - set QUEST_GYINN, 3; + set @state, 3; + callsub S_Update_Mask; close; @@ -105,7 +110,8 @@ L_return2: "Sounds interesting... But who are your parents?",-, "Bad idea, it will only bring more problems...",L_close; next; - set QUEST_GYINN, 4; + set @state, 4; + callsub S_Update_Mask; mes "[Aldred]"; mes "\"Ok, great... But please, try to be discrete about it. I don't want my parents to know I was playing with their stuff. My Father owns this place. He is always carying a lantern... I guess he is still afraid of the dark. My mother is the Innkeeper. She is very beautiful and today is using a red dress.\""; close; @@ -133,7 +139,8 @@ L_return4: getinventorylist; if (@inventorylist_count == 100) goto L_full; getitem "ScarabArmlet", 1; - set QUEST_GYINN, 7; + set @state, 7; + callsub S_Update_Mask; mes "\"I will tell my parents how good and helpfull you are... Maybe they can even offer you a discount in your expenses here at Reid's Inn...\""; close; @@ -150,6 +157,12 @@ L_full: L_close: close; + +S_Update_Mask: + set QUEST_Graveyard_Inn, + (QUEST_Graveyard_Inn & ~(@Graveyard_Inn_MASK)) + | (@state << @Graveyard_Inn_SHIFT); + return; } @@ -157,7 +170,7 @@ L_close: // Participation of the Wife/Mother in the crying child subquest. Merge later with the apropriate NPC -// if (QUEST_GYINN == 5) goto L_asking_child; +// if (@state == 5) goto L_asking_child; // end; //L_asking_child: @@ -175,13 +188,13 @@ L_close: // next; // mes "[Innkeeper's Ghost]"; // mes "\"No, no. It is not that I don't like it. I just don't like the feelings it causes on me... It is... Complicated. Please, take this bracelet away. I don't want it... You can have it, or just give to someone else.\""; -// set QUEST_GYINN, 6; +// set @state, 6; // close; // Participation of the Husband/Father in the crying child subquest. Merge later with the apropriate NPC -// if (QUEST_GYINN == 4) goto L_asking_child; +// if (@state == 4) goto L_asking_child; // end; //L_asking_child: @@ -203,6 +216,6 @@ L_close: // mes "\"Anyway, you can easily find one of these in a lot of small shops in this town. I am pretty sure that whoever lost it won't bother coming all the way back to get it. \""; // menu // "Thank you sir, that is all I wanted to ask.",-; -// set QUEST_GYINN, 5; +// set @state, 5; // close; -- cgit v1.2.3-70-g09d2