From bd449c9bb1cebda779d503ab5004038bd9b69642 Mon Sep 17 00:00:00 2001 From: jesusalva Date: Wed, 14 Feb 2018 08:28:02 -0200 Subject: Fix Ayasha script (was causing infinite xp bug, now it works) --- npc/005-1/ayasha.txt | 91 ++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 82 insertions(+), 9 deletions(-) (limited to 'npc/005-1/ayasha.txt') diff --git a/npc/005-1/ayasha.txt b/npc/005-1/ayasha.txt index 9bc7b2d2f..8ae4ec54d 100644 --- a/npc/005-1/ayasha.txt +++ b/npc/005-1/ayasha.txt @@ -3,7 +3,6 @@ // Jesusalva (fixes) - 005-1,52,81,0 script Ayasha NPC_HUMAN_FEMALE_NOOB,{ @@ -24,7 +23,7 @@ { select l("Yes!"), - menuaction(l("Quit")); + menuaction(l("I can't, sorry.")); switch (@menu) { @@ -62,25 +61,54 @@ OnInit: .sex = G_FEMALE; - .distance = 3; + .distance = 5; end; } function script CheckEnfant { - .questCheck = .questCheck + 1; // FIXME: This is broken scope. - l("Oh Welcome then."); // NOTE: This will never work - speech S_FIRST_BLANK_LINE | S_LAST_NEXT, - l("Oh! You found me. Well played!"); - narrator("You receive 5 exp."); - if (.questCheck == 6) + @kids_count = 0; + @count_tmp = 0; + if (debug) + npctalk3 l("Hello, I am K-@@, of the @@ order.", @kids, $@KidsBits[@kids]); + if (STARTAREA & $@KidsBits[@kids]) + goto L_Already; + STARTAREA = STARTAREA | $@KidsBits[@kids]; + + goto L_Loop; + +L_KidsTally: + if (debug) + npctalk3 l("You found @@ out of @@ kids.", @kids_count, @count_tmp); + if (@kids_count == 6) { + message strcharinfo(0), "That must have been the last kid."; setq CandorQuest_HAS, 2; } + speech S_FIRST_BLANK_LINE | S_LAST_NEXT, + l("Oh! You found me. Well played!"); + narrator("You receive 5 exp."); getexp 5,0; close; + return; + +L_Loop: + while (@count_tmp < 6) { + if (STARTAREA & $@KidsBits[@count_tmp]) + @kids_count = (@kids_count + 1); + @count_tmp = (@count_tmp + 1); + } + goto L_KidsTally; + +L_Already: + mesn; + mesq l("Thanks for playing with us! Can you find my friends?"); + close; + + return; } 005-1,69,90,0 script Charda NPC_GUARD1,{ + @kids = 0; if (getq(CandorQuest_HAS) == 1) { CheckEnfant(); @@ -90,11 +118,14 @@ function script CheckEnfant { } end; OnInit: + // This works at same var from KidsBits. We start counting from 10, then. + setarray $@KidsBits, (1 << 10), (1 << 11), (1 << 12), (1 << 13), (1 << 14), (1 << 15); .sex = G_OTHER; .distance = 1; end; } 005-1,23,84,0 script Faris NPC_GUARD1,{ + @kids = 1; if (getq(CandorQuest_HAS) == 1) { CheckEnfant(); @@ -109,6 +140,7 @@ OnInit: end; } 005-1,84,21,0 script Ghada NPC_HUMAN_M_ARTIS,{ + @kids = 2; if (getq(CandorQuest_HAS) == 1) { CheckEnfant(); @@ -123,6 +155,7 @@ OnInit: end; } 005-1,38,58,0 script Latif NPC_HUMAN_M_ARTIS,{ + @kids = 3; if (getq(CandorQuest_HAS) == 1) { CheckEnfant(); @@ -137,6 +170,7 @@ OnInit: end; } 005-1,18,43,0 script Rasin NPC_HUMAN_M_ARTIS,{ + @kids = 4; if (getq(CandorQuest_HAS) == 1) { CheckEnfant(); @@ -151,6 +185,7 @@ OnInit: end; } 005-1,38,65,0 script Djinx NPC_GUARD1,{ + @kids = 5; if (getq(CandorQuest_HAS) == 1) { CheckEnfant(); @@ -164,3 +199,41 @@ OnInit: .distance = 1; end; } + +005-1,53,81,0 script AyashaDebug NPC_MONA,{ + showavatar NPC_MONA; // this is handled by avatars.xml + mesn; + mesq l("Reset?"); + next; + menu + l("Yes."), L_Reset, + l("Test"), L_Charda, + + l("No."), L_Close; + +L_Reset: + setq CandorQuest_HAS, 0; + STARTAREA = STARTAREA &~ (1 << 10); + STARTAREA = STARTAREA &~ (1 << 11); + STARTAREA = STARTAREA &~ (1 << 12); + STARTAREA = STARTAREA &~ (1 << 13); + STARTAREA = STARTAREA &~ (1 << 14); + STARTAREA = STARTAREA &~ (1 << 15); + mes l("Reset!"); + goto L_Close; + +L_Charda: + STARTAREA = STARTAREA &~ (1 << 10); + mes l("Charda clean!"); + goto L_Close; + +L_Close: + //showavatar; // Use this to hide the showavatar + close; + +// Use @shownpc to enable AyashaDebug +OnInit: + if (!debug) + disablenpc .name$; + end; +} -- cgit v1.2.3-60-g2f50