[Add On] Questioner

Newbie Spellweaver
Joined
May 4, 2010
Messages
40
Reaction score
12
Well, my server is working on a quest-mini-series, but I am sort of proud of this NPC. It took me awhile considering the little mistakes I made all over the variables.

Constructive criticism please!


PHP:
// This is for map 925100300

var question1 = ["#e#b#L2#A. 19#l\r\n#L3#B. 23#l\r\n#L9#C. 18#l\r\n#L10#D. 15#l", "#e#b#L3#A. 15#l\r\n#L2#B. 19#l\r\n#L9#C. 23#l\r\n#L10#D. 18#l", "#e#b#L9#A. 18#l\r\n#L10#B. 15#l\r\n#L2#C. 19#l\r\n#L3#D. 23#l", "#e#b#L9#A. 23#l\r\n#L10#B. 18#l\r\n#L3#C. 15#l\r\n#L2#D. 19#l"];
var question1rand = question1[Math.floor(Math.random()*question1.length)];
var question2 = ["#e#b#L4#A. 12#l\r\n#L3#B. 10#l\r\n#L9#C. 13#l\r\n#L10#D. 7#l", "#e#b#L9#A. 7#l\r\n#L4#B. 12#l\r\n#L10#C. 10#l\r\n#L3#D. 13#l", "#e#b#L9#A. 13#l\r\n#L10#B. 7#l\r\n#L4#C. 12#l\r\n#L3#D. 10#l", "#e#b#L9#A. 10#l\r\n#L10#B. 13#l\r\n#L3#C. 7#l\r\n#L4#D. 12#l"];
var question2rand = question2[Math.floor(Math.random()*question2.length)];
var question3 = ["#e#b#L5#A. 5#l\r\n#L3#B. 3#l\r\n#L9#C. 4#l\r\n#L10#D. 6#l", "#e#b#L3#A. 6#l\r\n#L5#B. 5#l\r\n#L9#C. 3#l\r\n#L10#D. 4#l", "#e#b#L9#A. 4#l\r\n#L10#B. 6#l\r\n#L5#C. 5#l\r\n#L3#D. 3#l", "#e#b#L9#A. 3#l\r\n#L10#B. 4#l\r\n#L3#C. 6#l\r\n#L5#D. 5#l"];
var question3rand = question3[Math.floor(Math.random()*question3.length)];
var question4 = ["#e#b#L6#A. 4#l\r\n#L3#B. 5#l\r\n#L9#C. 1#l\r\n#L10#D. 2#l", "#e#b#L9#A. 2#l\r\n#L6#B. 4#l\r\n#L10#C. 5#l\r\n#L3#D. 1#l", "#e#b#L9#A. 1#l\r\n#L10#B. 2#l\r\n#L6#C. 4#l\r\n#L3#D. 5#l", "#e#b#L9#A. 5#l\r\n#L10#B. 1#l\r\n#L3#C. 2#l\r\n#L6#D. 4#l"];
var question4rand = question4[Math.floor(Math.random()*question4.length)];
var question5 = ["#e#b#L7#A. 3#l\r\n#L3#B. 6#l\r\n#L9#C. 1#l\r\n#L10#D. 5#l", "#e#b#L9#A. 5#l\r\n#L7#B. 3#l\r\n#L10#C. 6#l\r\n#L3#D. 1#l", "#e#b#L9#A. 1#l\r\n#L10#B. 5#l\r\n#L7#C. 3#l\r\n#L3#D. 6#l", "#e#b#L9#A. 6#l\r\n#L10#B. 1#l\r\n#L3#C. 5#l\r\n#L7#D. 3#l"];
var question5rand = question5[Math.floor(Math.random()*question5.length)];

function start() {
    status = -1;
    action(1, 0, 0);
}

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (status >= 0 && mode == 0) {
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
        if (status == 0) {
            cm.sendNext("#eHello! I am the third NPC in your series of miniquests to gain 5 rebirths!");
        }
        else if (status == 1) {
            cm.sendSimple("#eMy job is to quiz you about this map. I will be asking you a series of 5 questions regarding this map.\r\n\r\n#b #L0#I am ready to take the quiz!#l\r\n #L1#I need to look around the map some more.#l\r\n #L8#I am level 200 and ready to continue to the next map!#l");
        } else {
            if (selection == 0) {
                cm.sendSimple("#e#dQuestion 1#k\r\nHow many boxes/crates are in this map?\r\n\r\n\r\n" + question1rand + "");
            } else if (selection == 2) {
                cm.sendSimple("#e#dQuestion 2#k\r\nHow many steps/stairs are in this map?\r\n\r\n\r\n" + question2rand + "");
            } else if (selection == 3) {
                cm.sendOk("#eSorry, that answer is incorrect. Please try again!");
                cm.dispose();
            } else if (selection == 4) {
                cm.sendSimple("#e#dQuestion 3#k\r\nHow many doors are in this map?\r\n\r\n\r\n" + question3rand + "");
            } else if (selection == 5) {
                cm.sendSimple("#e#dQuestion 4#k\r\nHow many life rafts are in this map?\r\n\r\n\r\n" + question4rand + "");
            } else if (selection == 6) {
                cm.sendSimple("#e#dQuestion 5#k\r\nHow many skulls are in this map?\r\n\r\n\r\n" + question5rand + "");
            } else if (selection == 7) {
                cm.sendOk("Congratulations! You have finished my quest. Here is some exp to help you in your adventure!");
                for (var i=0; i<20; i++){
                    cm.gainExp(2100000000);
                }
                cm.dispose();
            } else if (selection == 8) {
                if (cm.getP().getLevel() == 200) {
                    cm.getP().doReborn();
                    cm.warp(925100400, 0);
                    cm.dispose();
                } else {
                    cm.sendOk("#eIt seems you are not Level 200. Please continue the quiz and talk to me when you are done.");
                    cm.dispose();
                } 
            } else if (selection == 9) {
                cm.sendOk("#eSorry, that answer is incorrect. Please try again!");
                cm.dispose();
            } else if (selection == 10) {
                cm.sendOk("#eSorry, that answer is incorrect. Please try again!");
                cm.dispose();
            }
        }
    }
}
 
Last edited:
You can just change it to get.Player() if you don't like it or if it doesn't work.
 
Last edited:
All of the arrays could have been fit into one but great work nonetheless. It's better than what we've been seeing these days. ;)
 
Well Soulfist, this is the very first NPC that I noticed you released that actually works and is not stolen (I guess). Anyhow, you made a mistake in a selection where you placed "#L39#" instead of "#L9#". Ignoring stuff that could be done "wisely", I've never seen this NPC before, good job.
 
O.o lol didn't know you're soulfist, So many different accs =.=

Anyway +1 for effort, by the way, this should be something similar to the Rock which is used for the 3rd job advancement I guess.
 
Lol exactly, you can rename a method anything you want, good job btw. I'll like it when I'm on my PC.


Off-topic : Gratz on becoming a Moderator Riku

On-topic : Good job and nice way to use variables and math randoms, that look like some thought was put in it so great effort :thumbup:
 
Code:
+ ""
remove this..

Oh yes, lets just take off 3 important parts of the npc all over. That will definitely work.

I use " + <variable> + " to add it into the text. It is at the end of all the lines where it was used, so one might look something like this with it taken out:

Code:
cm.sendSimple("Question 1 something something " + question1rand);

I am no pro with NPCs but I am pretty sure that would not work.

Anyways, I am not advanced enough to be able to put those all into the same array, and I don't really think I would need to. o-o

Also, this is my second release for whoever said something about first release.
 
Well Soulfist, this is the very first NPC that I noticed you released that actually works and is not stolen (I guess). Anyhow, you made a mistake in a selection where you placed "#L39#" instead of "#L9#". Ignoring stuff that could be done "wisely", I've never seen this NPC before, good job.

That isnt me Osiris Trust me its not. I do not release things like this, the next time I release something it will be worth it. ttyl :ott1:
 
That isnt me Osiris Trust me its not. I do not release things like this, the next time I release something it will be worth it. ttyl :ott1:

Thank-you for your wonderful constructive criticism! You could have simply said you aren't anyone here. You didn't have to go and flame my coding.
 
Oh yes, lets just take off 3 important parts of the npc all over. That will definitely work.

I use " + <variable> + " to add it into the text. It is at the end of all the lines where it was used, so one might look something like this with it taken out:

Code:
[COLOR="Blue"]cm.sendSimple("Question 1 something something " + question1rand);[/COLOR]

I am no pro with NPCs but I am pretty sure that would not work.

Anyways, I am not advanced enough to be able to put those all into the same array, and I don't really think I would need to. o-o

Also, this is my second release for whoever said something about first release.

Do you know what you are doing? I bet you don't, you add an EMPTY and USELESS string to it. The example you showed will work without problems. Have you even tried?
 
That isnt me Osiris Trust me its not. I do not release things like this, the next time I release something it will be worth it. ttyl :ott1:
Of course you don't release anything like this. Whatever you release doesn't work.

By the way, Soulfist, stop releasing stuff until you're able to code something useful.
 
Last edited:
That isnt me Osiris Trust me its not. I do not release things like this, the next time I release something it will be worth it. ttyl :ott1:

So nice of you not using Literal account to reply back. Also, I'm just unsure yet, but yeah, maybe I'm wrong, it's just a MAYBE. I don't believe anything you say, most stuff you say are lies.

Odsmk said:
I am no pro with NPCs but I am pretty sure that would not work.

Anyways, I am not advanced enough to be able to put those all into the same array, and I don't really think I would need to. o-o

Also, this is my second release for whoever said something about first release.

It's not NPC to begin with, it's JavaScript. Also, it does works.

Just because you don't know how to use arrays, doesn't means it doesn't are needed. I can say that the random part is not even needed the way you placed it, it's just.. kind of dumby in my opinion.

Nevertheless this works, and judging by what most people in here act like, I don't thinks people really care about what you did or not, but that it does works. So.. whatever.
 
Back