From 2c07459b6d045f7a510811c507533e204319473a Mon Sep 17 00:00:00 2001 From: wushin Date: Sun, 24 Aug 2014 22:09:43 -0500 Subject: Quest Log Fixed STARTAREA --- world/map/npc/022-1/_import.txt | 1 - world/map/npc/022-1/tutorial.txt | 80 ---------------------------------- world/map/npc/042-1/hasan.txt | 31 ++++++++----- world/map/npc/042-1/kaan.txt | 51 ++++++++-------------- world/map/npc/042-1/liana.txt | 16 ++++++- world/map/npc/042-1/tutorial.txt | 61 +++++++++++++++++++++++++- world/map/npc/042-1/valon.txt | 70 ++++++++++++++--------------- world/map/npc/042-1/zegas.txt | 31 +++++++------ world/map/npc/042-2/barrels.txt | 15 ++++++- world/map/npc/042-2/barrels_config.txt | 39 ++++++++--------- world/map/npc/042-2/morgan.txt | 10 +++-- world/map/npc/042-2/sorfina.txt | 43 +++++------------- world/map/npc/042-2/stat_reset.txt | 4 ++ world/map/npc/042-2/tanisha.txt | 30 +++++-------- world/map/npc/functions/clear_vars.txt | 56 +++++++++++++++++++----- world/map/npc/functions/mob_points.txt | 2 +- 16 files changed, 275 insertions(+), 265 deletions(-) delete mode 100644 world/map/npc/022-1/tutorial.txt diff --git a/world/map/npc/022-1/_import.txt b/world/map/npc/022-1/_import.txt index 9695d72f..543a85c0 100644 --- a/world/map/npc/022-1/_import.txt +++ b/world/map/npc/022-1/_import.txt @@ -9,4 +9,3 @@ npc: npc/022-1/dock.txt npc: npc/022-1/ferry_master.txt npc: npc/022-1/mapflags.txt npc: npc/022-1/npcs.txt -npc: npc/022-1/tutorial.txt diff --git a/world/map/npc/022-1/tutorial.txt b/world/map/npc/022-1/tutorial.txt deleted file mode 100644 index c249d79d..00000000 --- a/world/map/npc/022-1/tutorial.txt +++ /dev/null @@ -1,80 +0,0 @@ -// This file is part of the Tutorial -// Author: Jenalya -// if you enter the tutorial area from outside, it is set to be already done -// Tutorial -// Nibble 0 -// 1-4: Sorfina -// 5-7: Tanisha -// 8-13: Kaan & Hasan -// 14: Hasan Complete -// 15: Open -// Nibble 1 -// 4: Sorfina Bit -// 5: Tanisha Bit -// 6: Valon Start -// 7: Valon Done -// Nibble 2 -// 1: Maggots -// 2: House Maggots -// 3: TameScorpion -// 4: Scorpion -// 5-15: Open -// Nibble 3 -// 1-15: Count -// Nibble 4 -// 16: Start -// 17: Barrel -// 18: Barrel -// 19: Barrel -// Nibble 5 -// 20: Barrel -// 21: Barrel -// 22: Barrel -// 23: Found -// Nibble 6 -// 1: Seen -// 2: Started -// 3: -// 24: Magic -// 25: -// 26: -// 27: -// Nibble 7 -// 28: Magic Start -// 29: Magic End -// 30: Zegas Met -// 31: Hasan Complete --|script|#TutorialConfig|-1, -{ - end; - -OnInit: - set $@ScorpionFighter, 0; - set $@ScorpionTimer, 0; - set $@ScorpDeath, 0; - set $@SorfinaHasanBit, (1 << 4); - set $@TanishaHasanBit, (1 << 5); - set $@HasanCompleteBit, (1 << 31); - end; -} -function|script|TutorialState|, -{ - callfunc "ClearVariables"; - set @tutorial, ((TUTORIAL & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT); - set @sorfina_hasan, (TUTORIAL & $@SorfinaHasanBit); - set @tanisha_hasan, (TUTORIAL & $@TanishaHasanBit); - set @hasan_complete, (TUTORIAL & $@HasanCompleteBit); - return; -} -function|script|SetTutorialMask|, -{ - set TUTORIAL, (TUTORIAL & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); - set @tutorial_tmp, 0; - return; -} -function|script|TutorialCompleted|, -{ - set FLAGS, FLAGS | FLAG_TUTORIAL_DONE; - callfunc "ClearVariables"; - return; -} diff --git a/world/map/npc/042-1/hasan.txt b/world/map/npc/042-1/hasan.txt index 722c8f62..39e549cd 100644 --- a/world/map/npc/042-1/hasan.txt +++ b/world/map/npc/042-1/hasan.txt @@ -8,31 +8,41 @@ 042-1.gat,104,49,0|script|Scared Man|160, { - if ((@hasan_complete) && ((@tutorial == 12) || (@tutorial == 14))) + setarray @npc_loc, 104, 49, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_End; + if (@tutorial >= 13) goto L_TutDone; message strcharinfo(0), "He looks too afraid to say anything."; - end; + goto L_End; L_TutDone: message strcharinfo(0), "Thanks. Kaan's been much nicer to me now"; + goto L_End; + +L_End: end; } 042-1.gat,102,49,0|script|Hasan|189,2,2, { + setarray @npc_loc, 102, 49, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; goto L_Main; L_Main: callfunc "TutorialState"; if ((getcharid(3) == $@ScorpionFighter) || ($@ScorpionFighter && $@ScorpionFighter != getcharid(3))) goto L_Afraid; - if ((@hasan_complete) && ((@tutorial == 12) || (@tutorial == 14))) + if (@tutorial == 14) goto L_TutDone; - // implicitly, $@ScorpionFighter is nonzero - if ((@hasan_complete) && (@tutorial == 13)) + if (@tutorial == 13) goto L_Thank; - if (@tutorial == 12) + if (@tutorial == 12) goto L_Trick; - if ((@tutorial == 10) || (@tutorial == 11)) + if ((@tutorial == 9) || (@tutorial == 10) || (@tutorial == 11)) goto L_FightAgain; mes "You over hear some people nearby."; @@ -58,7 +68,7 @@ L_Main: next; mes "Sounds like this person is in trouble.\""; next; - set @tutorial_tmp, 10; + set @tutorial_tmp, 9; callfunc "SetTutorialMask"; mes "[Unfriendly Guy]"; mes "\"What are you looking at?\""; @@ -93,7 +103,8 @@ L_Trick: L_ScratchHead: if ($@ScorpionFighter) goto L_Wait; - set TUTORIAL, TUTORIAL | $@HasanCompleteBit; + set @tutorial_tmp, 14; + callfunc "SetTutorialMask"; set $@ScorpionTimer, 0; set $@ScorpionFighter, getcharid(3); set $@ScorpDeath, PC_DIE_COUNTER; @@ -157,7 +168,7 @@ L_Close: close; OnTouch: - if ((@hasan_complete) && ((@tutorial == 12) || (@tutorial == 14))) + if (@tutorial >= 13) end; goto L_Main; } diff --git a/world/map/npc/042-1/kaan.txt b/world/map/npc/042-1/kaan.txt index 0d71cee3..1444cd67 100644 --- a/world/map/npc/042-1/kaan.txt +++ b/world/map/npc/042-1/kaan.txt @@ -3,16 +3,22 @@ 042-1.gat,109,87,0|script|Kaan|160, { + setarray @npc_loc, 109, 87, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; + callfunc "TutorialState"; - if ((@hasan_complete) && (@tutorial == 13)) goto L_Hasan_Saved; - if (@hasan_complete) goto L_TutDone; + if (!(@kaan_talked)) goto L_Tanisha; + if (@tutorial >= 13) goto L_TutDone; if (@tutorial == 12) goto L_Plan; - if ((@tutorial == 11) && ((@sorfina_hasan) || (@tanisha_hasan))) goto L_TrickKnown; - if (@tutorial == 11) goto L_Trick; - if (@tutorial == 10) goto L_Hasan; - if (@tutorial == 9) goto L_Out; - if (@tutorial == 8) goto L_Tanisha; + if (@tutorial == 11) goto L_TrickKnown; + if (@tutorial == 10) goto L_Trick; + if (@tutorial == 9) goto L_Hasan; + goto L_Out; +L_Tanisha: + set STARTAREA, STARTAREA | $@SpokeToKaan; mes "[Young Man]"; mes "\"You're the person Tanisha brought here, right?"; mes "My name is Kaan, I'm her brother.\""; @@ -23,17 +29,12 @@ mes "[Kaan]"; mes "\"She hates maggots.\""; next; - mes "\"Maybe you should go and see her...she was really upset about what happened to you.\""; - goto L_Close; - -L_Tanisha: - mes "[Kaan]"; mes "\"Did you already talk to Tanisha?\""; menu - "Yes, I helped her with the maggots.",L_Tanisha3, - "Yeah, and she's done with the maggots.",L_Tanisha3; + "Yes, I helped her with the maggots.",L_Tanisha1, + "Yeah, and she's done with the maggots.",L_Tanisha1; -L_Tanisha3: +L_Tanisha1: mes "[Kaan]"; mes "\"Ah, that is good news."; mes "You know, we have a lot of problems with bugs here.\""; @@ -58,17 +59,7 @@ L_Next: mes "\"Are you going to visit Tulimshar?"; mes "The bazaar there is a wondeful place! Traders, entertainers, adventurers - it's very exciting.\""; next; - mes "\"Ah, I forgot. Without some money the bazaar is less fun I suppose."; - mes "Here, take this.\""; - set Zeny, Zeny + 15; - next; mes "\"And Ian the trainer is hanging around there often. You should talk to him, he's a smart guy.\""; - set @tutorial_tmp, 9; - callfunc "SetTutorialMask"; - if (hasan) - menu - "A guy named Hasan is bullying someone.",L_Hasan, - "Thanks for the advice.",L_Close; goto L_Out; L_Out: @@ -92,7 +83,7 @@ L_Next1: mes "He might listen to one of the adult men, but they're all off to work in Tulimshar during the day.\""; next; mes "\"We should think about some kind of trick. Ah, if only I knew his weak point.\""; - set @tutorial_tmp, 11; + set @tutorial_tmp, 10; callfunc "SetTutorialMask"; next; goto L_Trick; @@ -142,14 +133,6 @@ L_Plan: "Yes please.",L_Explain, "No, everything's alright.",L_Close; -L_Hasan_Saved: - mes "[Kaan]"; - mes "\"You did not to fight the scorpion."; - mes "But maybe Hasan is more thankful now?\""; - next; - mes "\"Why don't you talk to him again and see what he says.\""; - goto L_Close; - L_TutDone: mes "[Kaan]"; mes "\"Hi there. I hope you enjoy your time in Tulimshar."; diff --git a/world/map/npc/042-1/liana.txt b/world/map/npc/042-1/liana.txt index 6eb9972b..f1e5a4f9 100644 --- a/world/map/npc/042-1/liana.txt +++ b/world/map/npc/042-1/liana.txt @@ -2,11 +2,23 @@ 042-1.gat,82,96,0|script|Liana|205, { - set @npcname$, "Liana"; + setarray @npc_loc, 82, 96, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_End; + goto L_Talk; - mes "[" + @npcname$ + "]"; +L_Talk: + mes "[Liana]"; mes "\"Tulimshar is a large city. I'm sure glad I live in the suburbs because I know where everything's at.\""; next; mes "\"I think Tanisha is in the building to the right. That girl is growing up fast.\""; + goto L_Close; + +L_End: + mes "You'll have to move closer"; + goto L_Close; + +L_Close: close; } diff --git a/world/map/npc/042-1/tutorial.txt b/world/map/npc/042-1/tutorial.txt index 3129faaa..d51c30be 100644 --- a/world/map/npc/042-1/tutorial.txt +++ b/world/map/npc/042-1/tutorial.txt @@ -1,10 +1,67 @@ // This file is part of the Tutorial // Author: Jenalya -// if you enter the tutorial area, it is set to be already done +// if you enter the tutorial area from outside, it is set to be already done +-|script|#TutorialConfig|-1, +{ + end; +OnInit: + set $@ScorpionFighter, 0; + set $@ScorpionTimer, 0; + set $@ScorpDeath, 0; + set $@SpokeToKaan, (1 << 31); + end; +} +function|script|TutorialState|, +{ + callfunc "ClearVariables"; + set @tutorial, ((STARTAREA & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT); + set @kaan_talked, (STARTAREA & $@SpokeToKaan); + return; +} +function|script|SetTutorialMask|, +{ + set STARTAREA, (STARTAREA & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); + set @tutorial_tmp, 0; + return; +} +042-2.gat,21,26,0|script|TutDebug|154, +{ + mes "[TutDebug]"; + mes "Reset?"; + menu + "Yes.",L_Reset, + "No.",L_End; + +L_Reset: + set TUT_var, 0; + set @tutorial_tmp, 0; + set STARTAREA, (STARTAREA & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); + set STARTAREA, STARTAREA &~ $@SpokeToKaan; + mes "Reset!"; + goto L_End; + +L_End: + end; + +OnInit: + if(!debug) + disablenpc "TutDebug"; + end; +} 042-1.gat,63,47,0|script|#tutorialoutside|45,0,0 { - callfunc "TutorialCompleted"; + callfunc "TutorialState"; + if (@tutorial >= 8) + goto L_Warp; + goto L_ResetTutorial; + +L_ResetTutorial: + set @tutorial_tmp, 8; + callfunc "SetTutorialMask"; + goto L_Warp; + +L_Warp: warp "042-2.gat", 114, 92; end; } diff --git a/world/map/npc/042-1/valon.txt b/world/map/npc/042-1/valon.txt index a844f861..f4296af9 100644 --- a/world/map/npc/042-1/valon.txt +++ b/world/map/npc/042-1/valon.txt @@ -5,8 +5,6 @@ end; OnInit: - set $@ValonStartBit, (1 << 6); - set $@ValonEndBit, (1 << 7); setarray $@ValonMob, 1002,1050,1046,1003; setarray $@ValonMobName$, "Maggots","House Maggots","Tame Scorpions","Scorpion"; setarray $@ValonMobCnt, 10,5,3,1; @@ -14,32 +12,30 @@ OnInit: } function|script|ValonState|, { - set @valon_mob, ((TUTORIAL & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT); - set @valon_count, ((TUTORIAL & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT); - set @valon_start, (TUTORIAL & $@ValonStartBit); - set @valon_end, (TUTORIAL & $@ValonEndBit); + set @valon_state, ((STARTAREA & NIBBLE_1_MASK) >> NIBBLE_1_SHIFT); + set @valon_mob, 0; + if (@valon_state >= 2) + set @valon_mob, (@valon_state - 2); + set @valon_count, ((STARTAREA & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT); return; } -function|script|AddValonMobMask|, +function|script|setValonMask|, { - set @valon_tmp, (@valon_mob + 1); - if (@valon_tmp > 15) - set @valon_tmp, 15; - set TUTORIAL, (TUTORIAL & ~(NIBBLE_2_MASK) | (@valon_tmp << NIBBLE_2_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_1_MASK) | (@valon_tmp << NIBBLE_1_SHIFT)); set @valon_tmp, 0; return; } function|script|ResetValonCntMask|, { - set TUTORIAL, (TUTORIAL & ~(NIBBLE_3_MASK) | (0 << NIBBLE_3_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_2_MASK) | (0 << NIBBLE_2_SHIFT)); return; } function|script|AddValonCntMask|, { set @valon_tmp, (@valon_count + 1); - if (@valon_tmp > 15) - set @valon_tmp, 15; - set TUTORIAL, (TUTORIAL & ~(NIBBLE_3_MASK) | (@valon_tmp << NIBBLE_3_SHIFT)); + if (@valon_tmp > $@ValonMobCnt[@valon_mob]) + set @valon_tmp, $@ValonMobCnt[@valon_mob]; + set STARTAREA, (STARTAREA & ~(NIBBLE_2_MASK) | (@valon_tmp << NIBBLE_2_SHIFT)); set @valon_tmp, 0; callfunc "ValonProgress"; return; @@ -47,7 +43,7 @@ function|script|AddValonCntMask|, function|script|ValonProgress|, { callfunc "ValonState"; - if ((@valon_start) && (!(@valon_end))) + if ((@valon_state > 1) && (@valon_state < 6)) message strcharinfo(0), $@ValonMobName$[@valon_mob] + ": " + @valon_count + "/" + $@ValonMobCnt[@valon_mob]; return; } @@ -60,10 +56,8 @@ function|script|ValonProgress|, "No.", L_End; L_Reset: - set TUTORIAL, (TUTORIAL & ~(NIBBLE_2_MASK) | (0 << NIBBLE_2_SHIFT)); - set TUTORIAL, (TUTORIAL & ~(NIBBLE_3_MASK) | (0 << NIBBLE_3_SHIFT)); - set TUTORIAL, TUTORIAL &~ $@ValonStartBit; - set TUTORIAL, TUTORIAL &~ $@ValonEndBit; + set STARTAREA, (STARTAREA & ~(NIBBLE_1_MASK) | (0 << NIBBLE_1_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_2_MASK) | (0 << NIBBLE_2_SHIFT)); mes "Reset!"; goto L_End; @@ -77,14 +71,18 @@ OnInit: } 042-1.gat,48,111,0|script|Valon|156, { + setarray @npc_loc, 48, 111, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; callfunc "ValonState"; - if (@valon_end) + if (@valon_state >= 6) goto L_QuestComplete; - if (!(@valon_start) && (@valon_count)) + if (@valon_start == 1) goto L_QuestAskAgain; - if (((@valon_start) && (!(@valon_end))) && (@valon_count >= $@ValonMobCnt[@valon_mob])) + if (@valon_count >= $@ValonMobCnt[@valon_mob]) goto L_NextMob; - if ((@valon_start) && (!(@valon_end))) + if ((@valon_state >= 2) && (@valon_state < 6)) goto L_QuestStarted; goto L_QuestAsk; @@ -93,7 +91,7 @@ L_QuestAskAgain: mes "\"Hello, Adventurer! Have you come back to help?\""; menu "Yes. I will help with the desert beasts.", L_Accept, - "Maybe some other time.", L_NoThanks; + "Maybe some other time.", L_Close; L_QuestAsk: mes "[Valon]"; @@ -109,17 +107,17 @@ L_QuestAsk: mes "\"Maybe you would like help and earn your stripes?\""; next; mes "\"The Council of Wizard's does offer a reward for helping...\""; + set @valon_tmp, 1; + callfunc "setValonMask"; + callfunc "ResetValonCntMask"; menu "YES!!! let me at them!", L_Accept, - "Maybe some other time.", L_NoThanks; - -L_NoThanks: - callfunc "AddValonCntMask"; - goto L_Close; + "Maybe some other time.", L_Close; L_Accept: - callfunc "ResetValonCntMask"; - set TUTORIAL, TUTORIAL | $@ValonStartBit; + set @valon_tmp, 2; + callfunc "setValonMask"; + callfunc "ValonState"; goto L_NewMob; L_NextMob: @@ -128,10 +126,11 @@ L_NextMob: next; mes "\"The Wizard's thank thee as well.\""; set Zeny, Zeny + 25; - next; + set @valon_tmp, (@valon_state + 1); + callfunc "setValonMask"; callfunc "ResetValonCntMask"; - callfunc "AddValonMobMask"; callfunc "ValonState"; + next; if (@valon_mob == getarraysize($@ValonMob)) goto L_QuestOver; goto L_NewMob; @@ -155,7 +154,8 @@ L_QuestOver: mes "[Valon]"; mes "\"Thanks once again for helping with the monsters in the desert.\""; getexp 50, 0; - set TUTORIAL, TUTORIAL | $@ValonEndBit; + set @valon_tmp, (@valon_state + 1); + callfunc "setValonMask"; goto L_Close; L_QuestComplete: diff --git a/world/map/npc/042-1/zegas.txt b/world/map/npc/042-1/zegas.txt index d3dc118c..36443a91 100644 --- a/world/map/npc/042-1/zegas.txt +++ b/world/map/npc/042-1/zegas.txt @@ -32,7 +32,8 @@ L_Meet: mes "\"Wouldn't you know it, the bug bomb Eomie gave us is in one of the store room barrels.\""; next; mes "\"Can you search the barrels for the bug bomb and set it off when you find it?\""; - set TUTORIAL, TUTORIAL | $@ZegasMetBit; + set @barrel_tmp, 1; + callfunc "SetBarrelMask"; menu "Sure.",L_Start, "Maybe some other time.",L_Close; @@ -48,7 +49,8 @@ L_Find: L_Start: mes "[Zegas]"; - set TUTORIAL, TUTORIAL | $@BarrelStartBit; + set @barrel_tmp, 2; + callfunc "SetBarrelMask"; mes "\"Thanks, come back and see me once you found the bug bomb and set it off.\""; goto L_Close; @@ -60,11 +62,12 @@ L_Looking: L_QuestEnd: mes "[Zegas]"; mes "\"From the smell I can see you found the bug bomb!\""; - getexp 50, 0; - next; mes "\"Thanks once again, I know it's not much but here is 50 GP for your troubles.\""; + getexp 50, 0; set Zeny, (Zeny + 50); - set TUTORIAL, TUTORIAL | $@BarrelEndBit; + set @barrel_tmp, 4; + callfunc "SetBarrelMask"; + next; goto L_Close; L_Thanks: @@ -84,15 +87,15 @@ L_Close: "No.", L_End; L_Reset: - set TUTORIAL, TUTORIAL &~ $@BarrelStartBit; - set TUTORIAL, TUTORIAL &~ $@BarrelEndBit; - set TUTORIAL, TUTORIAL &~ (1 << 17); - set TUTORIAL, TUTORIAL &~ (1 << 18); - set TUTORIAL, TUTORIAL &~ (1 << 19); - set TUTORIAL, TUTORIAL &~ (1 << 20); - set TUTORIAL, TUTORIAL &~ (1 << 21); - set TUTORIAL, TUTORIAL &~ (1 << 22); - set TUTORIAL, TUTORIAL &~ (1 << 30); + set STARTAREA, (STARTAREA & ~(NIBBLE_4_MASK) | (0 << NIBBLE_4_SHIFT)); + set STARTAREA, STARTAREA &~ (1 << 20); + set STARTAREA, STARTAREA &~ (1 << 21); + set STARTAREA, STARTAREA &~ (1 << 22); + set STARTAREA, STARTAREA &~ (1 << 23); + set STARTAREA, STARTAREA &~ (1 << 24); + set STARTAREA, STARTAREA &~ (1 << 25); + set STARTAREA, STARTAREA &~ (1 << 26); + set STARTAREA, STARTAREA &~ (1 << 27); mes "Reset!"; goto L_End; diff --git a/world/map/npc/042-2/barrels.txt b/world/map/npc/042-2/barrels.txt index 43d4444e..540027ac 100644 --- a/world/map/npc/042-2/barrels.txt +++ b/world/map/npc/042-2/barrels.txt @@ -1,6 +1,5 @@ // Barrels // Author: Wushin -// Barrels 042-2.gat,23,86,0|script|Barrel#0|400, { setarray @npc_loc, 23, 86, 2; @@ -46,3 +45,17 @@ OnMaggotDeath: callfunc "CheckBarrel"; end; } +042-2.gat,29,92,0|script|Barrel#6|400, +{ + setarray @npc_loc, 29, 92, 2; + set @barrel, 6; + callfunc "CheckBarrel"; + end; +} +042-2.gat,24,91,0|script|Barrel#7|400, +{ + setarray @npc_loc, 24, 91, 2; + set @barrel, 7; + callfunc "CheckBarrel"; + end; +} diff --git a/world/map/npc/042-2/barrels_config.txt b/world/map/npc/042-2/barrels_config.txt index 85c78e41..0b45af21 100644 --- a/world/map/npc/042-2/barrels_config.txt +++ b/world/map/npc/042-2/barrels_config.txt @@ -6,40 +6,34 @@ end; OnInit: - set $@BarrelStartBit, (1 << 16); - set $@BarrelEndBit, (1 << 23); - set $@ZegasMetBit, (1 << 30); - setarray $@BarrelBits, (1 << 17), (1 << 18), (1 << 19), (1 << 20), (1 << 21), (1 << 22); + setarray $@BarrelBits, (1 << 20), (1 << 21), (1 << 22), (1 << 23), (1 << 24), (1 << 25), (1 << 26), (1 << 27); setarray $@BarrelRewards, 533, 507, 505, 518, 537, 526; set $@BarrelSpawnCnt, 1; set $@BarrelSpawnId, 1050; set $@BarrelSpawnName$, "House Maggot"; set $@BarrelMax, getarraysize($@BarrelBits); end; - +} +function|script|SetBarrelMask|, +{ + set STARTAREA, (STARTAREA & ~(NIBBLE_4_MASK) | (@barrel_tmp << NIBBLE_4_SHIFT)); + set @barrel_tmp, 0; + return; } function|script|CheckBarrelQuest|, { callfunc "CountBarrels"; - set @barrel_quest, 0; - if (TUTORIAL & $@ZegasMetBit) - set @barrel_quest, 1; - if (TUTORIAL & $@BarrelStartBit) - set @barrel_quest, 2; - if (!(TUTORIAL & $@BarrelStartBit) && (@barrel_count)) - set @barrel_quest, 3; - if (TUTORIAL & $@BarrelEndBit) - set @barrel_quest, 4; + set @barrel_quest, ((STARTAREA & NIBBLE_4_MASK) >> NIBBLE_4_SHIFT); return; } function|script|CountBarrels|, { set @barrel_count, 0; - set @barrel_tmp, 0; + set @count_tmp, 0; goto L_Loop; L_Loop: - if (TUTORIAL & $@BarrelBits[@barrel_tmp]) + if (STARTAREA & $@BarrelBits[@barrel_tmp]) goto L_AddOne; goto L_LoopAgain; @@ -48,8 +42,8 @@ L_AddOne: goto L_LoopAgain; L_LoopAgain: - set @barrel_tmp, (@barrel_tmp + 1); - if (@barrel_tmp == getarraysize($@BarrelBits)) + set @count_tmp, (@count_tmp + 1); + if (@count_tmp == getarraysize($@BarrelBits)) goto L_BarrelTally; goto L_Loop; @@ -62,11 +56,11 @@ function|script|CheckBarrel|, if (@npc_check) goto L_Range; callfunc "CheckBarrelQuest"; - if (!(@barrel_quest)) + if (!(@barrel_quest == 2)) goto L_NoI; - if (TUTORIAL & $@BarrelBits[@barrel]) + if (STARTAREA & $@BarrelBits[@barrel]) goto L_Empty; - set TUTORIAL, TUTORIAL | $@BarrelBits[@barrel]; + set STARTAREA, STARTAREA | $@BarrelBits[@barrel]; callfunc "CountBarrels"; if (@barrel_count == $@BarrelMax) @@ -92,7 +86,8 @@ L_Empty: L_QuestReward: message strcharinfo(0), "You found the bug bomb."; misceffect 33; - set TUTORIAL, TUTORIAL &~ $@BarrelStartBit; + set @barrel_tmp, 3; + callfunc "SetBarrelMask"; killmonster getmap() + ".gat", "Barrel#0::OnMaggotDeath"; goto L_Return; diff --git a/world/map/npc/042-2/morgan.txt b/world/map/npc/042-2/morgan.txt index 3ea1a2e8..20cc34c1 100644 --- a/world/map/npc/042-2/morgan.txt +++ b/world/map/npc/042-2/morgan.txt @@ -6,12 +6,12 @@ function|script|MorganState|, { callfunc "ClearVariables"; - set @morgan, ((TUTORIAL & NIBBLE_6_MASK) >> NIBBLE_6_SHIFT); + set @morgan, ((STARTAREA & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT); return; } function|script|SetMorganMask|, { - set TUTORIAL, (TUTORIAL & ~(NIBBLE_6_MASK) | (@morgan_tmp << NIBBLE_6_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_3_MASK) | (@morgan_tmp << NIBBLE_3_SHIFT)); set @morgan_tmp, 0; return; } @@ -23,7 +23,7 @@ function|script|SetMorganMask|, "Yes.", L_Reset, "No.", L_End; L_Reset: - set TUTORIAL, (TUTORIAL & ~(NIBBLE_6_MASK) | (0 << NIBBLE_6_SHIFT)); + set STARTAREA, (STARTAREA & ~(NIBBLE_3_MASK) | (0 << NIBBLE_3_SHIFT)); mes "Reset!"; goto L_End; @@ -37,6 +37,10 @@ OnInit: } 042-2,101,57,0|script|Morgan|355, { + setarray @npc_loc, 101, 57, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; callfunc "MorganState"; if (readparam(bInt) >= 5) goto L_Learn; diff --git a/world/map/npc/042-2/sorfina.txt b/world/map/npc/042-2/sorfina.txt index 2bad44d5..22216327 100644 --- a/world/map/npc/042-2/sorfina.txt +++ b/world/map/npc/042-2/sorfina.txt @@ -1,34 +1,12 @@ // This file is part of the Tutorial // Author: Jenalya -042-2.gat,21,26,0|script|TutDebug|154, -{ - mes "[TutDebug]"; - mes "Reset?"; - menu - "Yes.",L_Reset, - "No.",L_End; - -L_Reset: - set TUT_var, 0; - set @tutorial_tmp, 0; - set TUTORIAL, (TUTORIAL & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); - set TUTORIAL, TUTORIAL &~ $@SorfinaHasanBit; - set TUTORIAL, TUTORIAL &~ $@TanishaHasanBit; - set TUTORIAL, TUTORIAL &~ $@HasanCompleteBit; - set FLAGS, FLAGS &~ FLAG_TUTORIAL_DONE; - mes "Reset!"; - goto L_End; - -L_End: - end; - -OnInit: - if(!debug) - disablenpc "TutDebug"; - end; -} 042-2.gat,28,26,0|script|Sorfina|154,1,4 { + setarray @npc_loc, 28, 26, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; + callfunc "TutorialState"; if ((Hp != MaxHp) && (@tutorial >= 4)) @@ -43,8 +21,7 @@ L_Heal: goto L_Main; L_Main: - if ((@tutorial == 11) && !(@sorfina_hasan)) goto L_Hasan; - if (FLAGS & FLAG_TUTORIAL_DONE) goto L_Again; + if (@tutorial == 10) goto L_Hasan; if (@tutorial >= 4) goto L_Again; if (@tutorial == 3) goto L_Clothes; if (@tutorial == 2) goto L_Chest; @@ -262,7 +239,8 @@ L_Next: next; mes "\"However, the scorpions poison caused a bad fever and once Hasan had recovered from that, he was even more malicious than before.\""; mes "She sighs."; - set TUTORIAL, TUTORIAL | $@SorfinaHasanBit; + set @tutorial_tmp, 11; + callfunc "SetTutorialMask"; goto L_Close; L_SkipTut: @@ -275,7 +253,6 @@ L_SkipTut: L_Bye: mes "[Sorfina]"; mes "\"Alright, if you say so. But take at least this."; - callfunc "TutorialCompleted"; getitem "Knife", 1; getitem "SlingShot", 1; getitem "SlingBullet", 100; @@ -283,6 +260,8 @@ L_Bye: getitem "CottonShirt", 1; getitem "RaggedShorts", 1; set Zeny, Zeny + 50; + set @tutorial_tmp, 8; + callfunc "SetTutorialMask"; mes "Good luck.\""; goto L_Close; @@ -356,7 +335,7 @@ L_Empty: OnTouch: callfunc "TutorialState"; - if ((@tutorial < 4) && !(FLAGS & FLAG_TUTORIAL_DONE)) + if (@tutorial < 4) goto L_Block; warp "042-1.gat", 51, 44; end; diff --git a/world/map/npc/042-2/stat_reset.txt b/world/map/npc/042-2/stat_reset.txt index c033fcb2..a6b61378 100644 --- a/world/map/npc/042-2/stat_reset.txt +++ b/world/map/npc/042-2/stat_reset.txt @@ -2,6 +2,10 @@ 042-2.gat,98,91,0|script|Jessie|159, { + setarray @npc_loc, 98, 91, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; if (BaseLevel >= 10) goto L_Sorry; diff --git a/world/map/npc/042-2/tanisha.txt b/world/map/npc/042-2/tanisha.txt index 77a02948..77e95ab7 100644 --- a/world/map/npc/042-2/tanisha.txt +++ b/world/map/npc/042-2/tanisha.txt @@ -4,13 +4,17 @@ 042-2.gat,110,88,0|script|Tanisha|114, { + setarray @npc_loc, 110, 88, 4; + callfunc "PCtoNPCRange"; + if (@npc_check) + goto L_Close; + if (isin("042-2.gat", 98, 84, 106, 89)) goto L_Fighting; - callfunc "TutorialState"; - if ((@tutorial == 11) && !(@tanisha_hasan)) goto L_Hasan; - if ((@tutorial >= 8) || (FLAGS & FLAG_TUTORIAL_DONE)) goto L_Tut_Done; + if (@tutorial == 10) goto L_Hasan; + if (@tutorial >= 8) goto L_Tut_Done; if (@tutorial == 7) goto L_Stats; if (@tutorial == 6) goto L_Fail; if (@tutorial == 5) goto L_Maggots; @@ -146,7 +150,6 @@ L_Money: mes "You can have my pocket money. Here.\""; set @tutorial_tmp, 8; callfunc "SetTutorialMask"; - callfunc "TutorialCompleted"; set Zeny, Zeny + 5; next; goto L_Advice; @@ -204,7 +207,8 @@ L_Next3: mes "\"The only thing he's afraid of are scorpions."; mes "I'm not sure why, some bad experience when he was a child."; mes "That was before I was born.\""; - set TUTORIAL, TUTORIAL | $@TanishaHasanBit; + set @tutorial_tmp, 11; + callfunc "SetTutorialMask"; goto L_Close; L_Tut_Done: @@ -311,7 +315,6 @@ OnMaggotDeath: end; L_Close: - set @menu, 0; close; OnInit: @@ -325,18 +328,9 @@ OnInit: OnTouch: callfunc "TutorialState"; - if ((@tutorial >= 8) && !(FLAGS & FLAG_TUTORIAL_DONE)) - goto L_Complete; - goto L_Check; - -L_Complete: - callfunc "TutorialCompleted"; - goto L_Warp; - -L_Check: - if (!(FLAGS & FLAG_TUTORIAL_DONE)) - goto L_Block; - goto L_Warp; + if (@tutorial >= 8) + goto L_Warp; + goto L_Block; L_Warp: warp "042-1.gat", 63, 48; diff --git a/world/map/npc/functions/clear_vars.txt b/world/map/npc/functions/clear_vars.txt index a0c5e787..8bae5481 100644 --- a/world/map/npc/functions/clear_vars.txt +++ b/world/map/npc/functions/clear_vars.txt @@ -3,25 +3,61 @@ function|script|ClearVariables|, { // Tutorial - if (sorfina) - goto L_SetAllTut; + if ((TUTORIAL) || (sorfina)) + goto L_ResetTut; goto L_Easter; -L_SetAllTut: - if (FLAGS & FLAG_TUTORIAL_DONE) +L_ResetTut: + //TUTORIAL to STARTAREA + if ((sorfina) || (kaan) || (hasan) || (tanisha)) goto L_ResetAllTut; - if ((FLAGS & FLAG_TUTORIAL_DONE) && (!(TUTORIAL & $@HasanCompleteBit))) - set TUTORIAL, TUTORIAL | $@HasanCompleteBit; - set @tutorial_tmp, (sorfina + tanisha + hasan + kaan); - set TUTORIAL, (TUTORIAL & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); + set @tutorial_tmp, ((TUTORIAL & NIBBLE_0_MASK) >> NIBBLE_0_SHIFT); + // Tutorial + // Nibble 0 (sorfina, tanisha, kaan & hasan) + set STARTAREA, (STARTAREA & ~(NIBBLE_0_MASK) | (@tutorial_tmp << NIBBLE_0_SHIFT)); + // Nibble 1 (valon) + set @tutorial_tmp, ((TUTORIAL & NIBBLE_2_MASK) >> NIBBLE_2_SHIFT); + set @valon_done, (TUTORIAL & (1 << 7)); + set @valon_start, (TUTORIAL & (1 << 6)); + if (@valon_start) + set @tutorial_tmp, (@tutorial_tmp + 2); + if (@valon_done) + set @tutorial_tmp, 7; + set STARTAREA, (STARTAREA & ~(NIBBLE_1_MASK) | (@tutorial_tmp << NIBBLE_1_SHIFT)); + // Nibble 2 (Counts) + set @tutorial_tmp, ((TUTORIAL & NIBBLE_3_MASK) >> NIBBLE_3_SHIFT); + set STARTAREA, (STARTAREA & ~(NIBBLE_2_MASK) | (@tutorial_tmp << NIBBLE_2_SHIFT)); + // Nibble 3 (Morgan) + set @tutorial_tmp, ((TUTORIAL & NIBBLE_6_MASK) >> NIBBLE_6_SHIFT); + set STARTAREA, (STARTAREA & ~(NIBBLE_3_MASK) | (@tutorial_tmp << NIBBLE_3_SHIFT)); + // Nibble 4 (Zegas) Barrels shuffled + set @zegas_done, (TUTORIAL & (1 << 23)); + set @zegas_start, (TUTORIAL & (1 << 16)); + set @zegas_met, (TUTORIAL & (1 << 30)); set @tutorial_tmp, 0; - goto L_ResetAllTut; + if (@zegas_met) + set @tutorial_tmp, 1; + if (@zegas_start) + set @tutorial_tmp, 2; + if (@zegas_done) + set @tutorial_tmp, 4; + set STARTAREA, (STARTAREA & ~(NIBBLE_4_MASK) | (@tutorial_tmp << NIBBLE_4_SHIFT)); + // Nibble 5 (Barrels) + set @tutorial_tmp, 0; + set STARTAREA, (STARTAREA & ~(NIBBLE_5_MASK) | (@tutorial_tmp << NIBBLE_5_SHIFT)); + // Nibble 6 (Barrels) + set STARTAREA, (STARTAREA & ~(NIBBLE_6_MASK) | (@tutorial_tmp << NIBBLE_6_SHIFT)); + set TUTORIAL, 0; + goto L_Easter; L_ResetAllTut: set sorfina, 0; set tanisha, 0; set hasan, 0; set kaan, 0; + set TUTORIAL, 0; + set STARTAREA, 0; + set FLAGS, FLAGS &~ FLAG_TUTORIAL_DONE; goto L_Easter; L_Easter: @@ -92,7 +128,7 @@ L_Easter: set QUEST_Christmas09_state, 0; - set QUEST_Easter09_slots, 0; + set QUEST_Easter09_slots, 0; // easter 2010 // This must not be cleared: since some people would like to go to the easter island! diff --git a/world/map/npc/functions/mob_points.txt b/world/map/npc/functions/mob_points.txt index eb5aeff7..6e0744c3 100644 --- a/world/map/npc/functions/mob_points.txt +++ b/world/map/npc/functions/mob_points.txt @@ -138,7 +138,7 @@ function|script|MobPoints|, set Mobpt, Mobpt + @points[@mobID - 1002]; callfunc "ValonState"; - if (((@valon_start) && (!(@valon_end))) && (@mobID == $@ValonMob[@valon_mob])) + if (((@valon_state >= 2) && (@valon_state < 6)) && (@mobID == $@ValonMob[@valon_mob])) goto L_ValonMobKill; goto L_NatureKarma; -- cgit v1.2.3-60-g2f50