Re: Maplestory npc coding
Read this. It covers all you need to know ;].
Learning NPCs, Start to Finish
If you do need any other help or extra explanation, feel free to ask again.
Re: Maplestory npc coding
Trying something I haven't done.. so if it don't work.. don't complain...
PHP Code:
var questions = new Array("What's 5+5?","What country is North of U.S.A?","What color is the sky?","How many stars are on the U.S. Flag?","What do leaves grow on?");
var answers = new Array("10","Canada","Blue","50","Tree");
var state;
function start() {
state = 0;
cm.sendGetText(questions[state]);
}
function action(m,t,s) {
if (m != 1) {
if (m == 0) {
cm.sendOk("Bleh..");
}
cm.dispose();
return;
} else {
var answer = cm.getText();
if (answer == answers[state]) {
state++;
if (state >= 4) {
cm.dispose();
}
cm.sendOk("Good job!");
} else {
cm.sendOk("Sorry, that's wrong.");
cm.dispose();
}
}
}
Re: Maplestory npc coding
PHP Code:
if (answer == answers[state]) {
Wouldn't
PHP Code:
if (answer.equalsIgnoreCase(answers[state]) {
be better?
Re: Maplestory npc coding
Yes, but it's not mandatory. We're trying to teach people proper grammar. :p
Re: Maplestory npc coding
That should do it :)
Although I'm not a PHP coder, It seems okay. I just can't see why u put those 't' and 's' var in the parameters
Re: Maplestory npc coding
m = mode, t = type, s = selection
Re: Maplestory npc coding
Quote:
Originally Posted by
Shinkenuu
That should do it :)
Although I'm not a PHP coder, It seems okay. I just can't see why u put those 't' and 's' var in the parameters
This is not php. It is javascript, and it actually won't work as intended either. The t and s are arbitrary. You can name them anything you want. It's just a variable name. You do need the 3 variables though, since the method requires them in NPCConversationManager.java