prontera,155,155,4 script Swordsman Guildsman 1_M_YOUNGKNIGHT,{
if (quest_random == 0) {
mes("[Swordsman Guildsman]");
mes("Last Question.");
mes("If.....");
next();
quest_random = rand(1, 2); // First interaction. Set quest_random randomly to 1 or 2.
}
mes("[Swordsman Guildsman]");
.@correct_answer = 0; // Helper variable to determine if the question was answered correctly. (Defaults to 0 -> wrong answer!)
switch (quest_random) {
case 1: // Ask question 1.
mes("1+3+5 = ???");
input(.@guess);
if (.@guess == 9)
.@correct_answer = 1; // Question was answered correctly.
quest_random = 2; // Question 1 answered. Ask question 2 upon next interaction. (Even if answer was wrong.)
break;
case 2: // Ask question 2.
mes("5+9+5 = ???");
input(.@guess);
if (.@guess == 19)
.@correct_answer = 1; // Question was answered correctly.
quest_random = 1; // Question 2 answered. Ask question 1 upon next interaction. (Even if answer was wrong.)
break;
default: // Value of quest_random is not supported/defined.
close();
}
next();
mes("[Swordsman Guildsman]");
if (.@correct_answer == 1) { // Question was answered correctly.
mes("Then I'll end your training process and send you to the Swordsman Guild.");
callfunc("F_NvErase", 1);
savepoint("izlude", 128, 98); // Old coordinates: (95,104)
close2();
warp("izlude_in", 74, 167);
end;
}
// Question was not answered correctly.
mes("Sorry.");
close();
}