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

Page 1 of 22 12345678911 ... LastLast
Results 1 to 15 of 328
  1. #1
    Account Inactive get31720 is offline
    InactiveRank
    Jul 2008 Join Date
    972Posts

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


    RaGEZONE Recommends

    RaGEZONE Recommends

    This Guide may seem very long but it's all spacing.
    Take your time!

    This guide will give you a basic walk through of scripting your NPCs. The guide will be broken into Levels each one bringing you to a more advance part of scripting an NPC.

    I'm creating this script as I create the thread.

    Level 1

    Basic Scripting


    I'm not going to launch into a full understand of the beginning of a script because this is basics. I don't want you getting confused on what it means in the beginning.

    Most people start their scripts with a comment or 2 on top. A very easy comment I like to you is something like this:

    PHP Code:
    // get31720 of Ragezone
    // Example of an NPC script 
    the // creates a comment LINE. Only for 1 line though. If you hit enter and start on a new line and you want to put a comment put //

    OR you can use it like this:

    PHP Code:
    /* get31720 of Ragezone
    Example of an NPC script
    *\ 
    Now to start your script. I personally like to start my scripts like this:

    PHP Code:
    var status 0;  

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

    function 
    action(modetypeselection) {  
           
        if (
    mode == -1) {  
            
    cm.dispose();  
        }  
        else {   
            if (
    status >= && mode == 0) {   
                
    cm.sendOk("Goodbye");   
                
    cm.dispose();   
                return;   
            }   
              
            if (
    mode == 1) {  
                
    status++;  
            }      
            else {  
                
    status--;  
            }  
              
            if (
    status == 0) { 
    Now if you want a full explanation of this part I suggest you go to the [Guide] How to Analyze NPC scripts but if you're just here to figure out how to script something here we go.

    See where it says Goodbye? That text there is what shows when someone hits Exit Chat or No in a conversation. If you don't want it to say anything just remove the cm.sendOk line and leave the cm.dispose.

    Did I loose you? Click the Show button:
    Spoiler:
    So you lost track of where I was trying to head with all this? Knowing maplestory you know cm.sendOk must be some kind of conversation. cm.dispose(); ends a conversation. More questions? Post them.

    Did I confuse you with the "just leave the cm.dispose();" thing? What I mean is currently in what I showed you if you hit Exit Chat it would say Goodbye. But you can remove the line that says sendOk("Goodbye"); and when you click Exit Chat it'll just dispose the conversation (end it)


    Okay now after the status we'll code the NPC to say something to us then end. This is very simple, but it's okay to get confused. Let's add this to the script.

    PHP Code:
                cm.sendOk("Hello, I'm Angel's (get31720) NPC!");
                
    cm.dispose();
                }
            }
        } 
    cm.sendOk is pretty much bringing up a conversation with an OK button at the bottom of it. Simple right? cm.dispose(); is there to end it.

    If you don't understand the { } do yourself a favor and click the show button.
    Spoiler:
    { and } and basically beginning and ending a block of info. Let's color the script so we can see the big picture

    Code:
    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("Goodbye");   
                cm.dispose();   
                return;   
            }   
              
            if (mode == 1) {  
                status++;  
            }  
            else {  
                status--;  
            }  
              
            if (status == 0) { 
                cm.sendOk("Hello, I'm Angel's (get31720) NPC!");
                cm.dispose();
                }
            }
        }
    Colorful enough for you? Now depending on their color I've shown you how the { and } and effecting the blocks of info. If you don't get this post on the thread. If you notice there are 2 { that are not colored and 2 near the bottom that are not colored. This shows the (mode, type, selection) and mode == -1 continue through the script. When ever you use this on the top of your script just remember to stick 2 } at the bottom


    You've passed Level 1

    Level 2

    Continuing the conversation with Next


    Let's bring back the script we did in Level 1.
    PHP Code:
    var status 0;  

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

    function 
    action(modetypeselection) {  
           
        if (
    mode == -1) {  
            
    cm.dispose();  
        }  
        else {   
            if (
    status >= && mode == 0) {   
                
    cm.sendOk("Goodbye");   
                
    cm.dispose();   
                return;   
            }   
              
            if (
    mode == 1) {  
                
    status++;  
            }      
            else {  
                
    status--;  
            }  
              
            if (
    status == 0) { 
                
    cm.sendOk("Hello, I'm Angel's (get31720) NPC!");
                
    cm.dispose();
                }
            }
        } 
    But now let's use cm.sendNext to continue the conversation in 2 windows.

    We're going to be concentrating in this area:

    PHP Code:
            if (status == 0) { 
                
    cm.sendOk("Hello, I'm Angel's (get31720) NPC!");
                
    cm.dispose();
                }
            }
        } 
    First let's change the cm.sendOk to cm.sendNext and add another cm.sendNext.
    Code:
            if (status == 0) { 
                cm.sendNext("Hello, I'm Angel's (get31720) NPC!");
                cm.sendNext("I am helping people learn scripting!");
                cm.dispose();
                }
            }
        }
    The red area is pointing out a very common mistake. By having both in the same status what the script is trying to do is bring up 2 conversation windows at the same time. This will ruin your script so we have to add another status.
    PHP Code:
            if (status == 0) { 
                
    cm.sendNext("Hello, I'm Angel's (get31720) NPC!");
            }
            else if (
    status == 1) {
                
    cm.sendNext("I am helping people learn scripting!");
                
    cm.dispose();
                }
            }
        } 
    And TaDa you've changed your NPC to have cm.sendNext!
    Now if you click the NPC it'll say: Hello, I'm Angel's (get31720) NPC!
    Then if you click Next it'll say: I am helping people learn scripting
    If you click Exit Chat it'll say: Goodbye
    To see the finished script click Show
    Spoiler:
    PHP Code:
    var status 0;  

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

    function 
    action(modetypeselection) {  
           
        if (
    mode == -1) {  
            
    cm.dispose();  
        }  
        else {   
            if (
    status >= && mode == 0) {   
                
    cm.sendOk("Goodbye");   
                
    cm.dispose();   
                return;   
            }   
              
            if (
    mode == 1) {  
                
    status++;  
            }      
            else {  
                
    status--;  
            }  
              
            if (
    status == 0) { 
                
    cm.sendNext("Hello, I'm Angel's (get31720) NPC!");
            }
            else if (
    status == 1) {
                
    cm.sendNext("I am helping people learn scripting!");
                
    cm.dispose();
                }
            }
        } 


    Do you need me to show you how the { and } work when you edited this? Click Show if you need an explanation.
    Spoiler:
    Code:
            if (status == 0) { 
                cm.sendNext("Hello, I'm Angel's (get31720) NPC!");
            }
            else if (status == 1) {
                cm.sendNext("I am helping people learn scripting!");
                cm.dispose();
                }
            }
        }
    The { and } are beginnings and endings of blocks of info. I'm showing you the blocks they begin/end with colors. The last 2 uncolored ones the bottom are affected from the top of the script. See the 2nd spoiler if you want the colored { and } of the Level 1 script to help you understand.


    You've passed Level 2

    Level 3

    Learning How to use if and else


    Let's say you wanted to check if someone had a power elixir and if they did it would say "Good for you" and if they didn't it would say "Here have some" and give them 10.

    Let's get the level 2 script but edit the text inside to fit our situation.
    We'll be concentrating on the same area again. The top part is important to the script but this is what we're editing.
    PHP Code:
            if (status == 0) { 
                
    cm.sendNext("If you need power elixirs I'll give you 10. If you already have some you don't need them.");
            }
            else if (
    status == 1) {
                
    cm.sendNext("Good for you. You already have a power elixir");
                
    cm.dispose();
                }
            }
        } 
    So far all I did was change the text the NPC is going to say. Now let's add the if(cm.haveItem(2000005)) which is checking to see if they have the power elixir. (power elixir's ID is 2000005).

    PHP Code:
            if (status == 0) { 
                
    cm.sendNext("If you need power elixirs I'll give you 10. If you already have some you don't need them");
            }
            else if (
    status == 1) {
                if(
    cm.haveItem(2000005)) {
                    
    cm.sendNext("Good for you. You already have a power elixir.");
                    
    cm.dispose();
                }
            }
        } 
    But wait there's more! Now we need to use } else { because if the player does NOT have a power elixir we need to code what happens when the if(cm.haveItem(2000005); is false (not true)

    PHP Code:
            if (status == 0) { 
                
    cm.sendNext("If you need power elixirs I'll give you 10. If you already have some you don't need them");
            }
            else if (
    status == 1) {
                if(
    cm.haveItem(2000005)) {
                    
    cm.sendNext("Good for you. You already have a power elixir.");
                    
    cm.dispose();
                }
                else {
                     
    cm.sendNext("You don't have a power elixir? Here I'll give you 10!");
                     
    cm.gainItem(200000510);
                    } 
                }
            }
        } 
    Tada You've finished! Now the NPC will check for the power elixir. If the player has one it will say good for you and end the conversation. But if they don't have a power elixir the NPC will give the player 10.

    if you want it to check for more than, less than, or equal to (>, <, and =) you can do a combination. Such as
    PHP Code:
    if(cm.getMeso() >= 2000
    ONLY USE > , <, = for cm.getMeso NOT for cm.haveItem
    Which basically translates into if the character has more than or equal to 5 power elixirs.

    The { in status ==1 doesn't end in the beginning of the script so we had to put a } at the end of the script.

    Remeber if at any point you get confused post what level you got confused on and what you were having trouble understanding!

    You've passed Level 3

    Level 4

    Learning selections


    First let's learn about writing a selections and what it means. selections are the different choices you can see when you open your NPC script.

    When you want an NPC to say text with a selection you need this
    Code:
    \r\n#L0#Can I have some anyway?#l
    \r\n jumps down 1 line
    #L0# begins a selection This also means that this selection is 0'; #L1# is selection 1 and so on
    Can I have some anyway is the selection text
    #l (this is an L not an i) ends the selection.

    Now let's take the same script we just made but change the text, and lets have 2 selections.
    PHP Code:
            if (status == 0) {  
                
    cm.sendNext("Hello!"); 
            } 
            else if (
    status == 1) {
                if(
    cm.haveItem(2000005)) {
                    
    cm.sendSimple("You have power elixirs.\r\n#L0#Can I have some anyway?#l\r\n#L1#I'll see you later#l");
                }
            }
            else if (
    status == 2) {
            if (
    selection == 0) {
            } else if (
    selection == 1) {
            } 
                else {
                     
    cm.sendNext("You don't have a power elixir? Here I'll give you 10!");
                     
    cm.gainItem(200000510);
                    } 
                }
            }
        } 
    Under the selections we code what we want the NPC to do. What I changed was:
    used cm.sendSimple for the text with selections.
    added 2 selections.
    Added another status because sendSimple increases the status
    Moved the }else{ area higher because it has to be under the if(cm.haveItem


    Now under selection 0 we're going to code for the NPC to say "Okay here you go" and give them 10 power elixirs. Under selection 1 we're going to make the NPC say See you later and dispose. And just for fun I'm going to change the cm.sendNext to cm.sendOk.
    PHP Code:
             if (status == 0) {   
                
    cm.sendNext("Hello!");  
            }  
            else if (
    status == 1) {  
                if(
    cm.haveItem(2000005)) {  
                    
    cm.sendSimple("You have power elixirs.\r\n#L0#Can I have some more please?#l\r\n#L1#Nah, I don't want any.#l");  
                }   
                else {  
                    
    cm.sendOk("You don't have a power elixir? Here I'll give you 10!");  
                    
    cm.gainItem(200000510); 
                    
    cm.dispose();
                }    
            } 
            else if (
    status == 2) { 
                if (
    selection == 0) {  
                    
    cm.sendOk("Okay here you go");  
                    
    cm.gainItem(2000005);  
                    
    cm.dispose();  
                }  
                else if (
    selection == 1) {  
                    
    cm.sendOk("See you later");  
                    
    cm.dispose();  
                } 
            }  
        } 

    and TaDa we're done!
    If you want to see the whole finished script click Show:
    Spoiler:
    PHP Code:
    var status 0;    

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

    function 
    action(modetypeselection) {    
             
        if (
    mode == -1) {    
            
    cm.dispose();    
        }    
        else {     
            if (
    status >= && mode == 0) {     
                
    cm.sendOk("Goodbye");     
                
    cm.dispose();     
                return;     
            }     
                
            if (
    mode == 1) {    
                
    status++;    
            }        
            else {    
                
    status--;    
            }    
                
            if (
    status == 0) {   
                
    cm.sendNext("Hello there!");  
            }  
            else if (
    status == 1) {  
                if(
    cm.haveItem(2000005)) {  
                    
    cm.sendSimple("You have power elixirs.\r\n#L0#Can I have some more please?#l\r\n#L1#Nah, I don't want any.#l");  
                }   
                else {  
                    
    cm.sendOk("You don't have a power elixir? Here I'll give you 10!");  
                    
    cm.gainItem(200000510); 
                    
    cm.dispose();
                }    
            } 
            else if (
    status == 2) { 
                if (
    selection == 0) {  
                    
    cm.sendOk("Okay here you go");  
                    
    cm.gainItem(2000005);  
                    
    cm.dispose();  
                }  
                else if (
    selection == 1) {  
                    
    cm.sendOk("See you later");  
                    
    cm.dispose();  
                } 
            }  
        } 



    You've passed Level 4

    Level 5

    Revising and Checking your script


    Are all your { } correct?
    Did you put ; everywhere it needed?
    Did you make sure all your text in the conversation has " in the beginning and end?
    Did you type any misspellings?

    Test your new skills in the root section where people are looking for help with their scripts. If you can read them and correct them congratulations!

    When you pass Level 5 is your own opinion

    Terms to know
    Click Show

    NPC Text Commands
    Spoiler:
    #b = Blue text.
    #c[itemid]# Shows how many [itemid] the player has in their inventory.
    #d = Purple text.
    #e = Bold text.
    #f[imagelocation]# - Shows an image inside the .wz files.
    #g = Green text.
    #h # - Shows the name of the player.
    #i[itemid]# - Shows a picture of the item.
    #k = Black text.
    #l - Selection close.
    #m[mapid]# - Shows the name of the map.
    #n = Normal text (removes bold).
    #o[mobid]# - Shows the name of the mob.
    #p[npcid]# - Shows the name of the NPC.
    #q[skillid]# - Shows the name of the skill.
    #r = Red text.
    #s[skillid]# - Shows the image of the skill.
    #t[itemid]# - Shows the name of the item.
    #v[itemid]# - Shows a picture of the item.
    #x - Returns "0%" (need more information on this).
    #z[itemid]# - Shows the name of the item.
    #B[%]# - Shows a 'progress' bar.
    #F[imagelocation]# - Shows an image inside the .wz files.
    #L[number]# Selection open.
    \r\n - Moves down a line.


    cm.[Commands]
    Spoiler:
    dispose
    Ends the conversation with an NPC.
    How to use: cm.dispose();

    sendNext
    Shows a conversation window with a 'Next' button.
    How to use: cm.sendNext("[text]");

    sendPrev
    Shows a conversation window with a 'Prev' (previous) button.
    How to use: cm.sendPrev("[text]");

    sendNextPrev

    Shows a conversation window with a 'Next' and 'Prev' button (see above).
    How to use: cm.sendNextPrev("[text]");

    sendOk
    Shows a conversation window with an 'Ok' button.
    How to use: cm.sendOk("[text]");

    sendYesNo
    Shows a conversation window with a 'Yes' and 'No' button, 'No' ends the conversation unless otherwise stated.
    How to use: cm.sendYesNo("[text]");

    sendAcceptDecline
    Shows a conversation window with an 'Accept' and 'Decline' button. 'Decline' ends the conversation unless otherwise stated.
    How to use: cm.sendAcceptDecline("[text]");

    sendSimple
    Shows a conversation window with no buttons.
    How to use: cm.sendAcceptSimple("[text]");

    sendStyle
    Shows a style-select window.
    How to use: cm.sendStyle("[Text]", [variable]); // You'll need to delcare the variable in a Var statement.

    warp
    Warps the player to a map.
    How to use: cm.warp([mapid], [portal]); // Set [portal] as 0 if you want default.

    openShop
    Opens a shop window.
    How to use: cm.openShop([shopid]);

    haveItem
    Checks if the player has an item (in their inventories or equipped).
    How to use: cm.haveItem([itemid]);

    gainItem
    Gives the player an item/takes an item from a player.
    How to use: cm.gainItem([itemid],[ammount]); // Change [ammount] to -[ammount] to take an item.

    changeJob
    Changes the job of the player.
    How to use: cm.changeJob([jobid]);

    getJob
    Finds out what job the player has.
    How to use: cm.getJob();

    startQuest
    Starts a quest.
    How to use: cm.startQuest([questid]);

    completeQuest
    Finishes a quest.
    How to use: cm.completeQuest([questid]);

    forfeitQuest
    Forfeits a quest.
    How to use: cm.forfeitQuest([questid]);

    getMeso
    Finds out how many mesos a player has.
    How to use: cm.getMeso();

    gainMeso
    Gives a player mesos/takes mesos from a player.
    How to use: cm.gainMeso([ammount]); // use -[ammount] to take mesos.

    gainExp
    Gives a player exp/takes exp from a player.
    How to use: cm.gainExp([ammount]); // use -[ammount] to take exp.

    getLevel
    Finds out the level of the player.
    How to use: cm.getLevel();

    teachSkill
    Teaches a player a skill.
    How to use: cm.teachSkill([skillid],[skilllevel],[maxskilllevel]);

    isGM
    Finds out if the player is a GM or not.
    How to use: cm.isGM();

    get[Stat]
    Finds out the [Stat] of the player. [Stat] being: HP, MP, STR, DEX, INT, LUK.
    How to use: cm.get[Stat]();

    gainNX
    Gives/Takes the player nx
    How to use: cm.gainNX([amount]);
    Make it negative to make it take away.


    NPC commands to check for mesos,items, donator, gm, gender
    Spoiler:
    Code:
    if(cm.getChar().isGM()
    checks for GM
    Code:
    if(cm.getChar().isDonator() == true) { //checks for donator
    checks for donator
    Code:
    if(cm.getJob().equals(net.sf.odinms.client.MapleJob.BOWMAN)) {
    checks for Bowman job (list of jobs in below spoiler)
    Code:
    if (cm.getLevel() >= 30) {
    checks if level is more than or equal to 30.
    Code:
    if(cm.getChar().getGender() == 0) {
    checks gender. (0 = male, 1 = female)


    Job Terms (used for cm.getJob)
    Spoiler:
    BEGINNER
    WARRIOR
    FIGHTER
    CRUSADER
    HERO
    PAGE
    WHITEKNIGHT
    PALADIN
    SPEARMAN
    DRAGONKNIGHT
    DARKKNIGHT
    MAGICIAN
    FP_WIZARD
    FP_MAGE
    FP_ARCHMAGE
    IL_WIZARD
    IL_MAGE
    IL_ARCHMAGE
    CLERIC
    PRIEST
    BISHOP
    BOWMAN
    HUNTER
    RANGER
    BOWMASTER
    CROSSBOWMAN
    SNIPER
    CROSSBOWMASTER
    THIEF
    ASSASSIN
    HERMIT
    NIGHTLORD
    BANDIT
    CHIEFBANDIT
    SHADOWER
    GM
    SUPERGM


    Does spacing matter?
    Nope, you can make a script without the spacing you see here but it's messy and harder to edit.

    If I want to talk to you how should I?
    PM me, leave me a visitor message, or post here. One person was worried about posting here and it being "bumping an old thread" It's not really that old unless it's been 2 months since the last post.

    I've been trying to talk to you why aren't you replying?!?!
    I'm not an expert at scripting but I won't take being called a beginner at it either. If I don't respond I: am too busy to help, didn't see your message, don't know the answer, don't know the answer and too busy to go search an answer for you. There are plenty of other good coders talk to them too

    How can I get answers to questions like you do if you're not an expert
    Here's the secret. SEARCHING. You can find almost ANYTHING searching. I don't have everything about private servers in my head

    This command isn't working or doesing exist. (Most people ask about the NPC's mob spawing command)
    Okay, repacks could have different NPCConversationManagers so if the command that you found here isn't working open your NPCConversationManager and search and try to find the command you want. For example, you could search spawn. Things that are after the public void are the commands you put after the cm.

    How do I use the script once I've made it?
    Save it as a .js which stands for java script. Place the script in the scripts > npc folder where all the other NPC scripts are.

    They way you start you scripts are different from everyone else. It's longer, why is that?
    The way I start my scripts when I first started scripting was like this. I actually would recommend you trying a different way. There are certain ways to start your scripts so you can use No to do something different in the YesNo box. I'd recommend trying different ways that are shorter or better.

    If you have questions about your scripts post them

    I will update this guide if needed.

    FAQ


    Can you explain spacing and knowing how many } go on the bottom? I feel confused

    I'll gladly show you how. First I'll throw together a very simple script. Click show to see the script. I feel that long guides make people uncomfortable

    Spoiler:
    PHP Code:
    var status 0;  

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

    function 
    action(modetypeselection) {   
        if (
    mode == -1) {  
            
    cm.dispose();  
        }  
        else {   
            if (
    status >= && mode == 0) {      
                
    cm.dispose();   
                return;   
            }   
            if (
    mode == 1) {  
                
    status++;  
            }      
            else {  
                
    status--;  
            }  
            if (
    status == 0) {
                
    cm.sendNext("Hi");
            }
            else if (
    status == 1) {
                
    cm.sendOk("Bye");
                
    cm.dispose();
            }
        }



    If you've looked at enough scripts you'll see that sometimes the spacing varies. YOU can choose. Some people prefer using the tab as a spacing. I prefer using 4 spaces, 1,2,3,4. There's no need to memorize how the spacing goes. Soon you'll be able to do spacing like a natural. More importantly is using your spacing to understand when you're missing {}.

    When you space correctly and you end your script the } should be flowing downward. Let's take my 4 spaces for example.

    PHP Code:
            else if (status == 1) {
                
    cm.sendOk("Bye");
            
    1234cm.dispose();
        
    1234}
    1234}

    Now let me show you what each } ends.

    PHP Code:
            else if (status == 1) {
                
    cm.sendOk("Bye");
                
    cm.dispose();
            } 
    //ends line else if (status == 1) {
        
    //ends line else { 
    //ends line function action(mode, type, selection) { 
    everything that began has to end. With my particular beginning of the script you should have 2 } at the bottom to end the else on top and the function action(mode, type, selection)

    If the script had something like an if and else you'd have more }. let's change the bottom of the script.

    PHP Code:
            else if (status == 1) {
                if(
    cm.haveItem(100100)) {
                    
    cm.sendOk("Bye");
                    
    cm.dispose();
                }
                else {
                    
    cm.sendOk("Bye,nub");
                    
    cm.dispose();
                }
            }
        }

    By adding an if you also include an else. This else { has to be closed also. This is how it'd work.

    PHP Code:
            else if (status == 1) {
                if(
    cm.haveItem(100100)) {
                    
    cm.sendOk("Bye");
                    
    cm.dispose();
                } 
    // closed if(cm.haveItem(100100)) {
                
    else {
                    
    cm.sendOk("Bye,nub");
                    
    cm.dispose();
                } 
    // closed else {
            
    // closed status
        
    // closed else {
    // closed fuction action 
    That's it for my explanation. If you're confused on why the beginning of my script requires 2 } click the Show button. More questions? Post them. You may not know it but I check back to this thread a lot.

    Spoiler:
    PHP Code:
    var status 0;  

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

    function 
    action(modetypeselection) {   //begins here
        
    if (mode == -1) {  // notice the { above didn't end yet
            
    cm.dispose();  
        }  
    // this ends mode == -1
        
    else {   // this also begins here
            
    if (status >= && mode == 0) { // notice the { above wasn't closed off either
                
    cm.dispose();   
                return;   
            }   
    // ends status >= 2
            
    if (mode == 1) {  // begins
                
    status++;  
            } 
    // ends mode == 1
            
    else {  // begins
                
    status--;  
            }  
    // ends the else { above
            
    if (status == 0) { 


    What's the format for cm.spawnMonster?

    PHP Code:
    cm.spawnMonster(MobIDHPMPlevelEXPbossundeadamountxy); 
    MobID - Monster ID
    HP - Custom HP, put in the amount you want.
    MP - Custom MP, put in the amount you want.
    Level - Level of the Mob
    EXP - Custom EXP, put in the amount you want.
    boss - If it is a boss put a 1. If not a 0.
    undead - If it's undead put a 1. If not a 0.
    amount - The number it spawns
    x - X coordinate
    y - Y coordinate

    So it should look like this (code was taken from ThePack's mob spawner I did NOT create this and I was too lazy to make up one ;D):

    PHP Code:
    cm.spawnMonster(8500001200000002000000125700000101655, -146); 
    You can look out the information like level, hp, mp, exp, etc. from sites.
    Last edited by Shawn; 12-01-11 at 07:24 AM.


  2. #2
    Account Inactive Angerfish is offline
    InactiveRank
    Nov 2008 Join Date
    Ann Arbor, MILocation
    9Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Very nice guide, especially for helping beginners. Nice job.

  3. #3
    Account Inactive MuttonStory is offline
    InactiveRank
    Nov 2008 Join Date
    World Of MapleStoryLocation
    108Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Nice Guide! improved my npc scripting skill. [ : thx for level 4

  4. #4
    Account Inactive ProGamerForLife is offline
    InactiveRank
    Sep 2008 Join Date
    iTouchMsLocation
    1,205Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    nice Nub Friendly guide :)

  5. #5
    Account Inactive shikimaru17 is offline
    InactiveRank
    Apr 2008 Join Date
    GeorgiaLocation
    473Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Very nice guide. 9.5/10.

  6. #6
    Account Inactive yuniordiaz is offline
    InactiveRank
    May 2008 Join Date
    C: DriveLocation
    1,045Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Good Job Angel

  7. #7
    Account Inactive shakar96 is offline
    InactiveRank
    Jun 2008 Join Date
    I QUIT, LOL I had 9XX posts :)Location
    656Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Quote Originally Posted by get31720
    Are all your brackets { } correct?
    These are braces...
    Brackets are [ ]

  8. #8
    Account Inactive get31720 is offline
    InactiveRank
    Jul 2008 Join Date
    972Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Quote Originally Posted by shakar96 View Post
    These are braces...
    Brackets are [ ]
    My bad. Lemme edit that

  9. #9
    Account Inactive boomcrow is offline
    InactiveRank
    May 2008 Join Date
    51Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    nice guide

  10. #10
    Account Inactive shakar96 is offline
    InactiveRank
    Jun 2008 Join Date
    I QUIT, LOL I had 9XX posts :)Location
    656Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Quote Originally Posted by get31720 View Post
    My bad. Lemme edit that
    Good.
    BTW nice guide.

  11. #11
    Account Inactive bendanx3 is offline
    InactiveRank
    Sep 2008 Join Date
    417Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Um, Angel.. Hope you dont mind me calling you that :X

    Just to point out that the script in Level 4 wouldn't really work, i'm not really sure too, didnt try -.-
    Correct me if i'm wrong please.. Sorry for being extra x.x

  12. #12
    Mother effin' clouds SaintsIan is offline
    GammaRank
    Apr 2008 Join Date
    fyrechat.netLocation
    2,840Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    amongst the best one made so far :)
    Great work xD
    Now if you do a bit of defining here and there, annotating, screenshot, it will be more than perfect.

  13. #13
    Account Inactive get31720 is offline
    InactiveRank
    Jul 2008 Join Date
    972Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Quote Originally Posted by bendanx3 View Post
    Um, Angel.. Hope you dont mind me calling you that :X

    Just to point out that the script in Level 4 wouldn't really work, i'm not really sure too, didnt try -.-
    Correct me if i'm wrong please.. Sorry for being extra x.x
    Opps you're right I added 1 too many } in the script and I forgot a cm.dispose(); lemme just edit that

    *Edit*

    Okay is that better?

  14. #14
    Account Inactive bendanx3 is offline
    InactiveRank
    Sep 2008 Join Date
    417Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Quote Originally Posted by get31720 View Post
    Opps you're right I added 1 too many } in the script and I forgot a cm.dispose(); lemme just edit that

    *Edit*

    Okay is that better?
    When you do a cm.sendSimple, the status auto increases by 1. So you will need another status , which is status 2 for the selection part.

  15. #15
    Account Inactive -revil is offline
    InactiveRank
    Nov 2008 Join Date
    48Posts

    Re: [Guide] Learning NPC scripts (beginner's guide)

    Good job.




Page 1 of 22 12345678911 ... LastLast

Advertisement