From 34c2feed2a21626a5d3f4500450a7730852f08b4 Mon Sep 17 00:00:00 2001 From: Jesusaves Date: Fri, 2 Nov 2018 23:30:06 -0300 Subject: Fix Andrei Sakar bug --- npc/012-1/andrei.txt | 100 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 75 insertions(+), 25 deletions(-) diff --git a/npc/012-1/andrei.txt b/npc/012-1/andrei.txt index 4b00516e9..2a2f74e02 100644 --- a/npc/012-1/andrei.txt +++ b/npc/012-1/andrei.txt @@ -9,8 +9,65 @@ // more realistic, which sounded like a human hero (ie. a normal player). 012-1,75,58,0 script Andrei Sakar NPC_ANDREI,{ + // NLib_question ( ) + function NLib_question { + //freeloop(true); + do { + @qid=rand(0,7); + } while (! (2**@qid) & @sortable); + debugmes "Question "+@qid; + @sortable-=(2**@qid); + setarray @ans$, $@NLIBa1$[@qid], $@NLIBa2$[@qid], $@NLIBa3$[@qid], $@NLIBa4$[@qid]; + setarray @val, $@NLIBmr1[@qid], $@NLIBmr2[@qid], $@NLIBmr3[@qid], $@NLIBmr4[@qid]; + /* + @nm=15; + @i=0; + debugmes "BG WHILE S00002"; + while (@nm > 0) { + do { + @nai=rand(0,3); + } while ((2**@nai) & @nm); + debugmes "BG WS2 NODE"; + @nm-=@nai; + @ans$[@i]=@as$[@nai]; + @val[@i]=@nai; + } + debugmes "BG NO FREE LOOP"; + //freeloop(false); + */ + // Final: @ans$ ; @val ; @qid + // Question, menuret, QID + + mes ""; + addtimer(30000, "Andrei Sakar::OnTooLong"); + .@q=getq3(Q_NivalisLibday); + setq3 Q_NivalisLibday, .@q-7; + mesn; + mesq $@NLIBqs$[@qid]; + menuint + @ans$[0], @val[0], + @ans$[1], @val[1], + @ans$[2], @val[2], + @ans$[3], @val[3]; + mes ""; + deltimer("Andrei Sakar::OnTooLong"); + if (@menuret == 1) { + .@q=getq3(Q_NivalisLibday); + setq3 Q_NivalisLibday, .@q+7; + mesn; + mesq l("That's right."); + next; + } else { + mesn; + mesq l("Sorry, but that's wrong."); + close; + } + debugmes "BG END"; + // end + } + mesn l("Andrei Sakar, Legendary Hero"); - if ($NLIB_DAY) goto L_Quizz; + if ($NLIB_DAY || ($@GM_OVERRIDE && is_admin())) goto L_Quizz; L_Default: if (strcharinfo(0) == $MOST_HEROIC$) @@ -36,31 +93,13 @@ L_Quizz: next; if (askyesno() == ASK_NO) close; + setarray @sortable, 255; - mes ""; - addtimer(30000, "Andrei Sakar::OnTooLong"); - .@q=getq3(Q_NivalisLibday); - setq3 Q_NivalisLibday, .@q-7; - mesn; - mesq l("Did you really thought I would allow you to read the question answers on the source code?"); - select - l("Yes."), - l("You really should."), - l("Of course."), - l("It was worth the shot."); - mes ""; - deltimer("Andrei Sakar::OnTooLong"); - if (@menu == 4) { - .@q=getq3(Q_NivalisLibday); - setq3 Q_NivalisLibday, .@q+7; - mesn; - mesq l("That's right."); - next; - } else { - mesn; - mesq l("Sorry, but that's wrong."); - close; - } + NLib_question(); + NLib_question(); + NLib_question(); + NLib_question(); + NLib_question(); mesn; @@ -113,6 +152,17 @@ OnTooLong: OnInit: .sex = G_MALE; .distance = 5; + /* Because I was lazy to calculate array size, it is hard-coded to eight questions numbered from 0 to 7. + setarray $@NLIBqs$; + setarray $@NLIBa1$; + setarray $@NLIBa2$; + setarray $@NLIBa3$; + setarray $@NLIBa4$; + setarray $@NLIBmr1; + setarray $@NLIBmr2; + setarray $@NLIBmr3; + setarray $@NLIBmr4; + */ end; } -- cgit v1.2.3-60-g2f50