Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Add-On] Learning NPC scripts (beginner's guide)

Status
Not open for further replies.
Newbie Spellweaver
Joined
Apr 30, 2010
Messages
22
Reaction score
0
Re: [Tut] Learning NPC scripts (beginner's guide)

Hello, I have another script problem. This time its not with an error, but It's on how to set something up. I want to make a selection and have different status in it so that each selection will say multiple things instead of only one thing. I have set up a script how you would do it based on what i learned from this tutorial and i wasn't surprised to see that it didn't work. Here is the script i made just so you can possibly see what i mean. Please help if possible, if this doesn't work it would be helpful if someone could possibly tell me an easier way to do something like this. Thanks again.
PHP:
var status = 0;   

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

function action(mode, type, selection) {   
        
    if (mode == -1) {   
        cm.dispose();   
    }   
    else {    
        if (status >= 2 && mode == 0) {    
            cm.sendOk("Cya later!");    
            cm.dispose();    
            return;    
        }    
           
        if (mode == 1) {   
            status++;   
        }       
        else {   
            status--;   
        }   
           
        if (status == 0) {  
        cm.sendYesNo("Hey, can you help me? I seem to have lost my hat.");
        }
            else if (status == 1) {
            cm.sendNext("I've looked all over the place and can't find it!");
            }
                else if (status == 2) {
                cm.sendSimple("So, can you help me find it?\r\n#L0#It's on your head idiot.#l");
                }
                    else if (status == 3) {
                        if (selection == 0) {
                        cm.sendNext("What are you talking about? There's no hat on my head..");
                    }  
                            else if (status == 4) {
                            cm.sendNext("Ok, so please get me 50 straw hats, that way I wont ever run out. I'll reward you if you do.");
                            }
                                 else if (status == 5) {
                                     if cm.haveItem(2000005)) {
                                         cm.sendOk("GREAT! You got my straw hats!" Here's your reward as I promised.");
                                         cm.gainItem(2000006);
                                         cm.dispose();
                                     }
                                 }
                                     else {
                                     cm.sendOk("Are you trying to trick me? *Punches you away* GET ME SOME MORE!");
                                     cm.dispose();
                                     }
                        }
}
}
 
Initiate Mage
Joined
Jun 14, 2008
Messages
2
Reaction score
0
Re: [Tut] Learning NPC scripts (beginner's guide)

This is sooo useful. :eek:tt:
 
Newbie Spellweaver
Joined
Nov 5, 2009
Messages
64
Reaction score
1
Re: [Tut] Learning NPC scripts (beginner's guide)

Thanks, from 0 to level 5 ]=P woot
well I got 1 question how I may to know what "x - X coordinate" & "y - Y coordinate" to type ?
 
Newbie Spellweaver
Joined
Nov 5, 2009
Messages
64
Reaction score
1
Re: [Tut] Learning NPC scripts (beginner's guide)

Code:
} else if (selection == 0) { 
if(!cm.haveItem(1302143, 1302144, 1302145, 1302146, 1302143) && cm.canHold(1302143, 1302144, 1302145, 1302146, 1302147)) {
[/spoiler]
Dont work ? how make it work ?
Code:
} else if (selection == 0) { 
if(!cm.haveItem(1302143, OR/AND 1302144, OR/AND 1302145, OR/AND 1302146, OR/AND 1302143) && cm.canHold(1302143, OR/AND 1302144, OR/AND 1302145, OR/AND 1302146, OR/AND 1302147)) {
[/spoiler]
 
Last edited:
Newbie Spellweaver
Joined
Jan 24, 2011
Messages
11
Reaction score
2
May l ask how you place the NPC and where it goes while in-game? Thank you?
 
Junior Spellweaver
Joined
Jun 2, 2010
Messages
105
Reaction score
63
Last edited:
Status
Not open for further replies.
Back
Top