[Service] NPC Scripts

Joined
Jun 23, 2012
Messages
554
Reaction score
70
My name is Jon, and I've been scripting as a hobby for several years now, starting at AngelMS (down), and then Midnight/TwilightMS(down).​

I'm also looking to script for pay. Skype is jonnguyens

I've seen service threads running around, but I've decided to open one of mine just in case anyone needs help because those have gone inactive. Now I have a pretty busy schedule, but I can most definitely help you out with your scripts if and only if you give me your script first.

I'm looking to script NPCs for a server for pay. If you want to talk, add me on skype: jonnguyens





  • Why do I have to give you a script first? Don't you know how to script?

Yes, yes I do. I basic functions and can create all those fancy scripts (infinite loop, ternaries, etc). It's just I want to see you try first (and maybe because my mind feels more at ease when I have something to fix, and not create). I want to show you any errors you may have created, or what you could have done to make it shorter. I'm not the best NPC scripter in the world, but I can say I'm a pretty good one.







  • Where's some proof of work?
This is an NPC help thread. If I'm not qualified you will most certainly see it within the first few scripts. But hey, if the script works everyone is happy, right?





Make sure to post your script in spoiler format (using spoiler tags). These tags are created by this ....

(spoiler) (php) PUT SCRIPT HERE (/php)(/spoiler)
- Replace the "(" and ")" with "[" and "]"


Also, if you have any special functions (such as cm.gainNX(), cm.getVote(), etc) you must tell me. I can't make you a script in which you don't have the functions for.​

Terms of Serivice:​
This is a declaration that I hold, that I will not code a non-playable character (NPC) for a person unless they post for help here on the thread. If someone contacts me outside this thread for help on an NPC, I will not provide assistance in any form. The only time I will provide my knowledge and help others is if, and only if, they ask for my help and have attempted to script it themselves. To further add to the conditions of my Terms of Service, I also require said person to provide a script they have attempted to write themselves. Also, I can, and will post the script I've completed on this thread so that it is public. I will not script a private NPC for someone's server. It is available for everyone to see and learn from. If you fulfill the conditions I listed above, require help, and post your request for help in the form I have below, then I will provide my services accordingly.



Format:​
  • Small Description
  • Specifics
  • Special Functions (cm.gainNx)
  • Script
 
Last edited:
If you have the time, would you script a NPC that gives out a starter pack with:
Brown Work Gloves(1082149)
(7) Glove for attack scrolls(2040807)
&
10,000,000 mesos


Thanks in advance.
 
Upvote 0
I want a NPC that give out starter pack
Meso : 200000
Item : Pink Gaia Cape
White Glove
Yellow Snowshoe
But only can use once, can??
Here you go.
PHP:
// Made by MtSaEt to help some folks out!
var status = 0;
var map = 100000000; // Change the Map ID here.

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

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 0 && status == 1) {
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
    if (status == 0) {
            /*
            Could have made a function in MapleCharacter to set a NPCUseTime() 
            but I will just make it really simple as you're a beginner in javascript.
            */
            if (cm.haveItem(1102084, 1) || cm.haveItem(1082002) || cm.haveItem(1072239)) { // Checks if he has any of those items
                cm.warp(map);
                cm.sendOk("You already had your starter pack!");
                cm.dispose();
            } else { // If he doesn't, proceed.
            cm.sendNext("Here is your starter pack!");
        }
    } else if (status == 1) {
        cm.warp(map);
        cm.gainItem(1102084, 1);
        cm.gainItem(1082002, 1);
        cm.gainItem(1072239, 1);
        cm.gainMeso(200000);
        cm.sendOk("There you go!");
        cm.dispose();
    }
}
}

If you have the time, would you script a NPC that gives out a starter pack with:
Brown Work Gloves(1082149)
(7) Glove for attack scrolls(2040807)
&
10,000,000 mesos


Thanks in advance.
Here! Try to learn how I did it and how it works!
PHP:
// Made by MtSaEt to help some folks out!
var status = 0;

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

function action(mode, type, selection) {
    if (mode == -1) {
        cm.dispose();
    } else {
        if (mode == 0 && status == 1) {
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
        if (status == 0) {
            cm.sendNext("There you go!");
        } else if (status == 1) {
			cm.warp(100000000);
            cm.gainItem(1082149, 1);
            cm.gainItem(2040807, 7);
            cm.gainMeso(10000000);
            cm.sendOk("Enjoy!");
            cm.dispose();
        }
    }
}
 
Upvote 0
Does anyone think they can change this script to opening a menu instead of transporting you into the PQ?
PHP:
/*
	This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <[email protected]> 
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/**
-- Odin JavaScript --------------------------------------------------------------------------------
	Agent Kitty - Exclusive Training Center (970030000)
-- By ---------------------------------------------------------------------------------------------
	Omega
-- Version Info -----------------------------------------------------------------------------------
	1.0 - First Version by Omega
---------------------------------------------------------------------------------------------------
**/

var status;
var minLevel = 50;
var maxLevel = 255;
var minPlayers = 1;
var maxPlayers = 6;

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

function action(mode, type, selection) {
    if (mode == 1)
        status++;
    else {
        cm.dispose();
        return;
    }
    if (status == 0) {
        if (cm.getParty() == null) { // No Party
            cm.sendOk("How about you and your party members collectively beating a quest? Here you'll find obstacles and problems where you won't be able to beat it without great teamwork.  If you want to try it, please tell the #bleader of your party#k to talk to me.");
            cm.dispose();
        } else if (!cm.isLeader()) { // Not Party Leader
            cm.sendOk("If you want to try the quest, please tell the #bleader of your party#k to talk to me.");
            cm.dispose();
        } else {
            var party = cm.getParty().getMembers();
            var inMap = cm.partyMembersInMap();
            var levelValid = 0;
            for (var i = 0; i < party.size(); i++) {
                if (party.get(i).getLevel() >= minLevel && party.get(i).getLevel() <= maxLevel)
                    levelValid++;
            }
            if (inMap < minPlayers || inMap > maxPlayers) {
                cm.sendOk("Your party is not a party of "+minPlayers+". Please make sure all your members are present and qualified to participate in this quest. I see #b" + inMap + "#k of your party members are in Wolf's Treachery. If this seems wrong, #blog out and log back in,#k or reform the party.");
                cm.dispose();
            } else if (levelValid != inMap) {
                cm.sendOk("Please make sure all your members are present and qualified to participate in this quest. This PQ requires players ranging from level "+minLevel+" to level "+maxLevel+". I see #b" + levelValid + "#k members are in the right level range. If this seems wrong, #blog out and log back in,#k or reform the party.");
                cm.dispose();
            } else {
                var em = cm.getEventManager("AgentPQ");
                if (em == null) {
                    cm.sendOk("This PQ is not currently available.");
                } else if (em.getProperty("AgentPQOpen").equals("true")) {
                    em.startInstance(cm.getParty(), cm.getPlayer().getMap());
                    em.setProperty("AgentPQOpen" , "false");
                } else {
                    cm.sendNext("There is already another party inside. Please wait !");
                }
                cm.dispose();
            }
        }
    }
}
If you still don't get It. Whenever I click on my NPC it works but it warps you straight into the PQ. I want a menu to pop up whenever I click it (I can handle that). Just a simple menu like "My Party is ready". "How do I Play."
 
Upvote 0
Does anyone think they can change this script to opening a menu instead of transporting you into the PQ?
PHP:
/*
    This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <[email protected]> 
                       Matthias Butz <[email protected]>
                       Jan Christian Meyer <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License version 3
    as published by the Free Software Foundation. You may not use, modify
    or distribute this program under any other version of the
    GNU Affero General Public License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

/**
-- Odin JavaScript --------------------------------------------------------------------------------
    Agent Kitty - Exclusive Training Center (970030000)
-- By ---------------------------------------------------------------------------------------------
    Omega
-- Version Info -----------------------------------------------------------------------------------
    1.0 - First Version by Omega
---------------------------------------------------------------------------------------------------
**/

var status;
var minLevel = 50;
var maxLevel = 255;
var minPlayers = 1;
var maxPlayers = 6;

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

function action(mode, type, selection) {
    if (mode == 1)
        status++;
    else {
        cm.dispose();
        return;
    }
    if (status == 0) {
        if (cm.getParty() == null) { // No Party
            cm.sendOk("How about you and your party members collectively beating a quest? Here you'll find obstacles and problems where you won't be able to beat it without great teamwork.  If you want to try it, please tell the #bleader of your party#k to talk to me.");
            cm.dispose();
        } else if (!cm.isLeader()) { // Not Party Leader
            cm.sendOk("If you want to try the quest, please tell the #bleader of your party#k to talk to me.");
            cm.dispose();
        } else {
            var party = cm.getParty().getMembers();
            var inMap = cm.partyMembersInMap();
            var levelValid = 0;
            for (var i = 0; i < party.size(); i++) {
                if (party.get(i).getLevel() >= minLevel && party.get(i).getLevel() <= maxLevel)
                    levelValid++;
            }
            if (inMap < minPlayers || inMap > maxPlayers) {
                cm.sendOk("Your party is not a party of "+minPlayers+". Please make sure all your members are present and qualified to participate in this quest. I see #b" + inMap + "#k of your party members are in Wolf's Treachery. If this seems wrong, #blog out and log back in,#k or reform the party.");
                cm.dispose();
            } else if (levelValid != inMap) {
                cm.sendOk("Please make sure all your members are present and qualified to participate in this quest. This PQ requires players ranging from level "+minLevel+" to level "+maxLevel+". I see #b" + levelValid + "#k members are in the right level range. If this seems wrong, #blog out and log back in,#k or reform the party.");
                cm.dispose();
            } else {
                var em = cm.getEventManager("AgentPQ");
                if (em == null) {
                    cm.sendOk("This PQ is not currently available.");
                } else if (em.getProperty("AgentPQOpen").equals("true")) {
                    em.startInstance(cm.getParty(), cm.getPlayer().getMap());
                    em.setProperty("AgentPQOpen" , "false");
                } else {
                    cm.sendNext("There is already another party inside. Please wait !");
                }
                cm.dispose();
            }
        }
    }
}
If you still don't get It. Whenever I click on my NPC it works but it warps you straight into the PQ. I want a menu to pop up whenever I click it (I can handle that). Just a simple menu like "My Party is ready". "How do I Play."

That's easy, but before you read all of this, make sure you have basic scripting knowledge for this kind of stuff. There's a tutorial for scripting, and if you haven't read it already, I suggest you do now (http://forum.ragezone.com/f566/shawns-npc-help-thread-685616/ OR http://forum.ragezone.com/f428/ultimate-npc-scripting-855013/). Now, I'm not gonna do it for you, but, I'll tell you how so you can learn how to do it yourself, because this is an important part of scripting and it will come into play multiple times when creating NPCs.

on the line where it says: } else if (em.getProperty("AgentPQOpen").equals("true")) {

Take the code that initiates the PQ (which warps them) that is inside of that if statement, and make a new status, which is else if (status == 1) { with another if statement following it containing 2 possible answers (modes in this case), and if you want to be secure, include an else at the end it (something I do when scripting).

The first will be to warp them in, and second will be to explain the PQ.

Now... Going back to this if statement: } else if (em.getProperty("AgentPQOpen").equals("true")) {

Erase the two lines of code that were there since you moved them into the new answers you put in status 2, and put in a sendSimple(""); with the dialog you want inside, which also asks the question, so be sure to know how to include clickable answers such as the blue underlined text saying "My Party is ready", as that will be question #0 leading to answer (mode) #0, and then the "How do I play?" will be question #1 leading to answer (mode) #1, which all the modes are provided in the next status. I'm sure you can look into other NPCs that include clickable answers in their dialog like that as an example... cough cough any 2nd job advancer... cough cough...

Sorry if it may seem confusing or anything. I'm trying to explain it in the most nooby way possible for all of you to understand :P

Hope I helped you, and possibly others learn something about scripting today :)
 
Last edited:
Upvote 0
/**
Vote Point NPC
@author Rich / WlZET
*/
var status = 0;
var oneitems = new Array(1912029, 1902036, 1902038, 1912031, 1902039,1912032, 1902020, 1912013, 1902015, 1912011, 1902018, 1902007, 1902006, 1912005, 1902021 ,1912014);
var twoitems = new Array(3010040, 3010041, 3010045, 3010046, 3010047, 3010060, 3012005, 3010061, 3010062, 3010064, 3010057, 3010073, 3010058, 3010043, 3010071, 3010085, 3010099);
var threeitems = new Array(1332073, 1332074, 1372044, 1382057, 1432047, 1452057, 1462050, 1472068, 1492023, 1472071, 1462051, 1492025, 1452059, 1442067, 1422038, 1382059, 1372045, 1302133, 1332099, 1372058, 1382080, 1402072, 1412046, 1432061, 1452085, 1462075, 1472100, 1482046, 1492048, 1382068, 1452071, 1402046);
// var superequips = new Array(4001126, 4001126);
var bombpacks = new Array (20, 50, 100, 200);
var bombprice = new Array (1, 2, 3, 5);

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

function action(mode, type, selection) {
if (mode == -1){
cm.dispose();
} else {
if (mode == 0) {
cm.dispose();
return;
}
if (mode == 1){
status++;
} else {
status--;
}
if (status == 0) {
// cm.getPlayer().gainVotePoints(100);
cm.sendSimple ("#eHello, I am the Vote Point NPC. Every time you use the vote point system on the website you gain #b1#k Vote Point. \n You currently have " + cm.getPlayer().getVotePoints() + " Vote Points. \b\r\n#L0#Custom Mount Shop\n\#l " +
"\r\n#L1#Custom Item Shop\n\#l" +
"\r\n#L2#Custom Chair Shop\n\#l");
} else if (status == 1) {
switch(selection) {
case 0:
// cm.sendSimple("Please pick your item! \b\r\n#L0#1 points for #v4031183#\n\#l " +
// "\r\n#L1#Custom Mount 1 Vote Point Shop #v2044703#\n\#l" +
// "\r\n#L2#1 points for #v2044503#\n\#l");
// cm.getPlayer().gainVotePoints(10);
var awesomeness = "Which item would you like to buy? \r\n These Mounts & Saddles are #b1#k Vote Point Each#b";
for (var i = 0; i < oneitems.length; i++) {
awesomeness += "\r\n#L" + i + "##z" + oneitems + "# (Price : 2 Point)#l";
}
cm.sendSimple(awesomeness);
status = 100;
break;

case 1:
var awesomeness = "Which item would you like to buy?#b";
for (var i = 0; i < threeitems.length; i++) {
awesomeness += "\r\n#L" + i + "##z" + threeitems + "# (Price : 2 Points)#l";
}
cm.sendSimple(awesomeness);
status = 300;
break;

case 2:
var awesomeness = "Which item would you like to buy? \r\n #rAll chairs are 2 Points#b";
for (var i = 0; i < twoitems.length; i++) {
awesomeness += "\r\n#L" + i + "##z" + twoitems + "# (Price : 1 Points)#l";
}
cm.sendSimple(awesomeness);
status = 200;
break;

case 3:
var awesomeness = "How many Terrorist Bombs would you like to buy?#b";
for (var i = 0; i < bombpacks.length; i++) {
for (var i = 0; i < bombprice.length; i++) {
awesomeness += "\r\n#L" + i + "#" + bombpacks + " Terrorist Bombs(Price : " + bombprice + " Points)#l";
}
}
cm.sendSimple(awesomeness);
status = 700;
break;
}
} else if (status == 101) {
if (cm.getPlayer().getVotePoints() > 1) {
// cm.gainItem(oneitems[selection]);
cm.randomizeStats(oneitems[selection], 20);
cm.getPlayer().gainVotePoints(-2);
cm.dispose();
} else {
cm.sendOk("You don't have 2 #bVote Point#k.");
cm.dispose();
}
} else if (status == 201) {
// for (var i = 0; i < superequips.length; i++) {
if (cm.getPlayer().getVotePoints() > 1) {
if (twoitems[selection] != 000) {
// cm.gainItem(twoitems[selection]);
cm.randomizeStats(twoitems[selection], 35);
cm.getPlayer().gainVotePoints(-1);
cm.dispose();
} else {
cm.sendYesNo ("You will receive 50 Terrorist Bombsfor 5 vote points if you press the 'Yes' button.");
status = 500;
}
} else {
cm.sendOk("You don't have 2 #bVote Points#k.");
cm.dispose();
}
} else if (status == 301) {
if (cm.getPlayer().getVotePoints() > 1) {
// cm.gainItem(threeitems[selection]);
cm.randomizeStats(threeitems[selection], 45);
cm.getPlayer().gainVotePoints(-2);
cm.dispose();
} else {
cm.sendOk("You don't have 2 #bVote Points#k.");
cm.dispose();
}
} else if (status == 501) {
cm.sendOk ("HOLY **** HOW'D YOU GET HERE?!?!");
} else if (status == 701) {
if (bombpacks[selection] == 20) {
if (cm.getPlayer().getVotePoints() >= 1) {
cm.gainItem(2100067, bombpacks[selection]);
cm.getPlayer().gainVotePoints(-2);
cm.dispose();
} else {
cm.sendOk("You don't have 1 #bVote Point#k.");
cm.dispose();
}
} else {
if (bombpacks[selection] == 50) {
if (cm.getPlayer().getVotePoints() >= 2) {
cm.gainItem(2100067, bombpacks[selection]);
cm.getPlayer().gainVotePoints(-1);
cm.dispose();
} else {
cm.sendOk("You don't have 2 #bVote Points#k.");
cm.dispose();
}
} else {
if (bombpacks[selection] == 100) {
if (cm.getPlayer().getVotePoints() >= 1) {
cm.gainItem(2100067, bombpacks[selection]);
cm.getPlayer().gainVotePoints(-2);
cm.dispose();
} else {
cm.sendOk("You don't have 1 #bVote Points#k.");
cm.dispose();
}
} else {
if (cm.getPlayer().getVotePoints() >= 1) {
cm.gainItem(2100067, bombpacks[selection]);
cm.getPlayer().gainVotePoints(-1);
cm.dispose();
} else {
cm.sendOk("You don't have 2 vote points!");
cm.dispose();
}
}
}





}
}

}
}
 
Upvote 0
/**
Vote Point NPC
@author Rich / WlZET
*/
var status = 0;
var oneitems = new Array(1912029, 1902036, 1902038, 1912031, 1902039,1912032, 1902020, 1912013, 1902015, 1912011, 1902018, 1902007, 1902006, 1912005, 1902021 ,1912014);
var twoitems = new Array(3010040, 3010041, 3010045, 3010046, 3010047, 3010060, 3012005, 3010061, 3010062, 3010064, 3010057, 3010073, 3010058, 3010043, 3010071, 3010085, 3010099);
var threeitems = new Array(1332073, 1332074, 1372044, 1382057, 1432047, 1452057, 1462050, 1472068, 1492023, 1472071, 1462051, 1492025, 1452059, 1442067, 1422038, 1382059, 1372045, 1302133, 1332099, 1372058, 1382080, 1402072, 1412046, 1432061, 1452085, 1462075, 1472100, 1482046, 1492048, 1382068, 1452071, 1402046);
// var superequips = new Array(4001126, 4001126);
var bombpacks = new Array (20, 50, 100, 200);
var bombprice = new Array (1, 2, 3, 5);

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

function action(mode, type, selection) {
if (mode == -1){
cm.dispose();
} else {
if (mode == 0) {
cm.dispose();
return;
}
if (mode == 1){
status++;
} else {
status--;
}
if (status == 0) {
// cm.getPlayer().gainVotePoints(100);
cm.sendSimple ("#eHello, I am the Vote Point NPC. Every time you use the vote point system on the website you gain #b1#k Vote Point. \n You currently have " + cm.getPlayer().getVotePoints() + " Vote Points. \b\r\n#L0#Custom Mount Shop\n\#l " +
"\r\n#L1#Custom Item Shop\n\#l" +
"\r\n#L2#Custom Chair Shop\n\#l");
} else if (status == 1) {
switch(selection) {
case 0:
// cm.sendSimple("Please pick your item! \b\r\n#L0#1 points for #v4031183#\n\#l " +
// "\r\n#L1#Custom Mount 1 Vote Point Shop #v2044703#\n\#l" +
// "\r\n#L2#1 points for #v2044503#\n\#l");
// cm.getPlayer().gainVotePoints(10);
var awesomeness = "Which item would you like to buy? \r\n These Mounts & Saddles are #b1#k Vote Point Each#b";
for (var i = 0; i < oneitems.length; i++) {
awesomeness += "\r\n#L" + i + "##z" + oneitems + "# (Price : 2 Point)#l";
}
cm.sendSimple(awesomeness);
status = 100;
break;

case 1:
var awesomeness = "Which item would you like to buy?#b";
for (var i = 0; i < threeitems.length; i++) {
awesomeness += "\r\n#L" + i + "##z" + threeitems + "# (Price : 2 Points)#l";
}
cm.sendSimple(awesomeness);
status = 300;
break;

case 2:
var awesomeness = "Which item would you like to buy? \r\n #rAll chairs are 2 Points#b";
for (var i = 0; i < twoitems.length; i++) {
awesomeness += "\r\n#L" + i + "##z" + twoitems + "# (Price : 1 Points)#l";
}
cm.sendSimple(awesomeness);
status = 200;
break;

case 3:
var awesomeness = "How many Terrorist Bombs would you like to buy?#b";
for (var i = 0; i < bombpacks.length; i++) {
for (var i = 0; i < bombprice.length; i++) {
awesomeness += "\r\n#L" + i + "#" + bombpacks + " Terrorist Bombs(Price : " + bombprice + " Points)#l";
}
}
cm.sendSimple(awesomeness);
status = 700;
break;
}
} else if (status == 101) {
if (cm.getPlayer().getVotePoints() > 1) {
// cm.gainItem(oneitems[selection]);
cm.randomizeStats(oneitems[selection], 20);
cm.getPlayer().gainVotePoints(-2);
cm.dispose();
} else {
cm.sendOk("You don't have 2 #bVote Point#k.");
cm.dispose();
}
} else if (status == 201) {
// for (var i = 0; i < superequips.length; i++) {
if (cm.getPlayer().getVotePoints() > 1) {
if (twoitems[selection] != 000) {
// cm.gainItem(twoitems[selection]);
cm.randomizeStats(twoitems[selection], 35);
cm.getPlayer().gainVotePoints(-1);
cm.dispose();
} else {
cm.sendYesNo ("You will receive 50 Terrorist Bombsfor 5 vote points if you press the 'Yes' button.");
status = 500;
}
} else {
cm.sendOk("You don't have 2 #bVote Points#k.");
cm.dispose();
}
} else if (status == 301) {
if (cm.getPlayer().getVotePoints() > 1) {
// cm.gainItem(threeitems[selection]);
cm.randomizeStats(threeitems[selection], 45);
cm.getPlayer().gainVotePoints(-2);
cm.dispose();
} else {
cm.sendOk("You don't have 2 #bVote Points#k.");
cm.dispose();
}
} else if (status == 501) {
cm.sendOk ("HOLY **** HOW'D YOU GET HERE?!?!");
} else if (status == 701) {
if (bombpacks[selection] == 20) {
if (cm.getPlayer().getVotePoints() >= 1) {
cm.gainItem(2100067, bombpacks[selection]);
cm.getPlayer().gainVotePoints(-2);
cm.dispose();
} else {
cm.sendOk("You don't have 1 #bVote Point#k.");
cm.dispose();
}
} else {
if (bombpacks[selection] == 50) {
if (cm.getPlayer().getVotePoints() >= 2) {
cm.gainItem(2100067, bombpacks[selection]);
cm.getPlayer().gainVotePoints(-1);
cm.dispose();
} else {
cm.sendOk("You don't have 2 #bVote Points#k.");
cm.dispose();
}
} else {
if (bombpacks[selection] == 100) {
if (cm.getPlayer().getVotePoints() >= 1) {
cm.gainItem(2100067, bombpacks[selection]);
cm.getPlayer().gainVotePoints(-2);
cm.dispose();
} else {
cm.sendOk("You don't have 1 #bVote Points#k.");
cm.dispose();
}
} else {
if (cm.getPlayer().getVotePoints() >= 1) {
cm.gainItem(2100067, bombpacks[selection]);
cm.getPlayer().gainVotePoints(-1);
cm.dispose();
} else {
cm.sendOk("You don't have 2 vote points!");
cm.dispose();
}
}
}





}
}

}
}



What do you need exactly?
 
Upvote 0
When I put script into the Repack>Scripting>NPC>NpcID and start my server, I place the npc and it just opens the original quest that npc has. But when I do the command !opennpc 2101 it opens the starter pack.. Help?
 
Upvote 0
When I put script into the Repack>Scripting>NPC>NpcID and start my server, I place the npc and it just opens the original quest that npc has. But when I do the command !opennpc 2101 it opens the starter pack.. Help?
Use another NPC. The default text is defined in NPC.wz, which is not editable from the game unless you go and edit the NPC.wz files.
 
Upvote 0
Is there an easier method to do use the method " } else {" ".

PHP:
} else if (selection == 15) {  
					if (cm.getPlayer().getBossPoints() < 2000000000) {
					    cm.sendOk("You do not have enough BossPoints to purchase this item.");
						cm.dispose();
						return;
						cm.getPlayer().gainBossPoints(-2000000000);
						if (cm.canHold(1132004)) {
                        var equip = Packages.server.MapleItemInformationProvider.getInstance().getEquipById(1132004);
                        equip.setStr(32767);
                        equip.setDex(32767);
                        equip.setInt(32767);
                        equip.setLuk(32767);
                        equip.setWatk(100);
                        equip.setMatk(100);
                        cm.getPlayer().getInventory(Packages.client.MapleInventoryType.EQUIP).addItem(equip);
						cm.reloadChar();
						cm.sendOk("You have been awarded with your prize. I hope you are pleased! Good luck with your future ventures into The Boss Quest.");
                       } else {
                       cm.sendOk("Your inventory is full.");
                       }
                       cm.dispose();
					   }
Everytime I try to use the same method for other options via copy + paste I get errors in my .bat file and It gets messy. I want my NPC to say you do not have enough points for the belt if he doesn't. If he does then he gets to buy it. Having the hardest time of my life figuring this one out...

Here's the full NPC script IF YOU NEED IT. I just need help with the } else { method.

PHP:
/*
	This file is part of the OdinMS Maple Story Server
    Copyright (C) 2008 Patrick Huy <[email protected]>
		       Matthias Butz <[email protected]>
		       Jan Christian Meyer <[email protected]>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as
    published by the Free Software Foundation version 3 as published by
    the Free Software Foundation. You may not use, modify or distribute
    this program under any other version of the GNU Affero General Public
    License.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
/* 
	Boss Quest(Player NPC)
	Located in FreeMarket (910000000)
*/

//Chairs
var mil35 = new Array(3010007,3010008,3010011,3010013,3010014,3010018,3010040,3010041,3010045,3010057,3010063,3010046,3010047,3010043,3010071,3010085,3010098,3010073,3010099); // Clean Items 2k Leaf + 50mBPQ
//Mounts
var mil50 = new Array(1912000,1902000,1902001,1902002,1912005,1902005,1902006,1902007,1912011,1902015,1902016,1902017,1902018);

var status = 0;
var prize;
var chosen;

function numberFormat(nStr,prefix){
    var prefix = prefix || '';
    nStr += '';
    x = nStr.split('.');
    x1 = x[0];
    x2 = x.length > 1 ? '.' + x[1] : '';
    var rgx = /(\d+)(\d{3})/;
    while (rgx.test(x1)) x1 = x1.replace(rgx, '$1' + ',' + '$2');
    return prefix + x1 + x2;
}

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

function action(mode, type, selection) {
    if (mode == -1) 
        cm.dispose();
    else {
        if (mode == 0) {
            cm.sendOk("Come back when you next want to participate in the Boss Quest!");
            cm.dispose();
            return;
        }
        if (mode == 1)
            status++;
        else
            status--;
        if (status == 0) {
            var sendStr = "#fUI/UIWindow.img/BetaEdition/BetaEdition#\r\nHello! I can offer you access to the Boss Quest!";
            cm.sendNext(sendStr);
        }
        else if (status == 1) {
            chosen = 0;
            cm.sendSimple("What would you like to do? #b\r\n#L0#Start the Boss Quest#l\r\n#L1#Trade your Boss Quest Points#l");
        }
        else if (status == 2) {
            if (selection == 0) {
                if (cm.getParty() == null) {
                    cm.sendOk("To begin the Boss Quest you must be in a party, either create one or join your friend's.");
                    cm.dispose();
                    return;
                }
                else if (!cm.isLeader()) {
                    cm.sendOk("You aren't the leader of your party! If you want to begin the Boss Quest, please tell the leader to talk to me.");
                    cm.dispose();
                    return;
                }
                else {
                    var em = cm.getEventManager("BossQuest");
                    if (em == null) 
                        cm.sendOk("The Boss Quest is currently unavailable.");
                    else {
                            var party = cm.getParty().getMembers();
                            var mapId = cm.getPlayer().getMapId();
							var minimum = 50;
                            var inMap = true;
                            var canRepeat = true;
                            var canEnter = true;
                            var badRepeat;
							var badEnter;
                            var it = party.iterator();
                            while (it.hasNext()) {
                                var cPlayer = it.next();
                                if (cPlayer.getMapid() != mapId) {
                                    inMap = false;
								}
                            }
                            if (inMap == false) {
                                cm.sendOk("Please make sure all the members of your party are in the map!");
                                cm.dispose();
                            }
                            else {
								var iterator = party.iterator();
                                while (iterator.hasNext()) {
                                    var member = iterator.next();
                                    if (member.getPlayer().getLevel() <= 50) {
										canEnter = false;
									}
                                }
								if (canEnter == true) {
								    em.startInstance(cm.getParty(), cm.getPlayer().getMap(), true);
								} else {
									cm.sendOk("Please make sure all the members of your party are level 120 and above!");
									cm.dispose();
								}
                            }
                    }
                    cm.dispose();
                    return;
                }
            } else if (selection == 1) {
                cm.sendSimple("You currently have #b" + numberFormat(cm.getPlayer().getBossPoints()) + "#k Boss Quest Points! \r\nI can trade some of my items for your Boss Quest Points and Maple Leafs."+
					"Which section would you like to visit?"+
					"#b\r\n#L0#Chairs!#l" +
					"\r\n#L1#Belts!#l" +
					"\r\n#L2#Mounts!#l");
			}
		} else if (status == 3) {
			if (selection == 0) {
                cm.sendSimple("#rPlease check your inventory before using it as there will be NO refund given if your inventory is full and you didn't get that item.\r\n#k#L0#Click Me to proceed!#l");
                chosen = 0;
            } else if (selection == 1) {
				cm.sendSimple("#rPlease check your inventory before using it as there will be NO refund given if your inventory is full and you didn't get that item.\r\n#k#L0#Click Me to proceed!#l");
				chosen = 1;
            } else if (selection == 2) {
				cm.sendSimple("#rPlease check your inventory before using it as there will be NO refund given if your inventory is full and you didn't get that item.\r\n#k#L0#Click Me to proceed!#l");
				chosen = 2;
            }
		} else if (status == 4) {
			var quantity;
            var selStr;
			if (chosen == 0) {
                if (selection == 0) {
                    prize = 0;
                    selStr = "Okay, all of these costs 35,000,000 BossQuest Points\r\nWhich prize would you like to trade your Boss Quest Points for?\r\n#b";
                    for (var i = 0; i < mil35.length; i++)
                        selStr += "#L" + i + "##v" + mil35[i] + "##l #z" + mil35[i] + "##l\r\n";
                    cm.sendSimple(selStr);
                }
			} else if (chosen == 1) {
				if (selection == 0) {
					prize = 1; 
					cm.sendSimple ("Okay, all of these have different prices" +
					"\r\n#rPlease note that you will NOT get an upgraded one if you already have one in your inventory! #k" +
					"#k\r\n#L11#Make All Stats 2500 #i1132000#, (250,000,000 BossQuest Points)" +
					"#k\r\n#L12#Make All Stats 5000 #i1132001#, (500,000,000 BossQuest Points)" +
					"#k\r\n#L13#Make All Stats 7500 #i1132002#, (750,000,000 BossQuest Points)" +
					"#k\r\n#L14#Make All Stats 13337 #i1132003#, (900,000,000 BossQuest Points)" +
					"#k\r\n#L15#Make All Stats 32767#i1132004#, (2,000,000,000 BossQuest Points)");
				}
			} else if (chosen == 2) {
				if (selection == 0) {
					prize = 2; 
					selStr = "Okay, all of these cost 50,000,000 BossQuest Points\r\n"+
						"#rPlease note that you will disconnect if you equip a higher level mount that you!#k\r\n";
					for (var i = 0; i < mil50.length; i++) {
						selStr += "#L" + i + "##v" + mil50[i] + "##l #z" + mil50[i] + "# \r\n";
					}
					cm.sendSimple(selStr);
				}
			}
		} else if (status == 5) {
			var quantity = 1;
            var win;
            if (prize == 0) {
                if (cm.getPlayer().getBossPoints() < 35000000) {
                    cm.sendOk("You do not have #b35,000,000#k Boss Quest Points to trade with. Sorry!");
                    cm.dispose();
                    return;
					}
				var win = mil35[selection];
				cm.getPlayer().setBossPoints(cm.getPlayer().getBossPoints() - 35000000);
				cm.gainItem(win, quantity);
			} else if (prize == 1) {
				if (selection == 11) {
					if (cm.getPlayer().getBossPoints() > 250000000) {
						cm.getPlayer().gainBossPoints(-250000000);
						if (cm.canHold(1132000)) {
                        var equip = Packages.server.MapleItemInformationProvider.getInstance().getEquipById(1132000);
                        equip.setStr(2500);
                        equip.setDex(2500);
                        equip.setInt(2500);
                        equip.setLuk(2500);
                        equip.setWatk(25);
                        equip.setMatk(25);
                        cm.getPlayer().getInventory(Packages.client.MapleInventoryType.EQUIP).addItem(equip);
						cm.reloadChar();
						cm.dispose();
                       } else {
                       cm.sendOk("Your inventory is full.");
                       }
                       cm.dispose();
					   }
				} else if (selection == 12) {  
					if (cm.getPlayer().getBossPoints() > 500000000) {
						cm.getPlayer().gainBossPoints(-500000000);
						if (cm.canHold(1132001)) {
                        var equip = Packages.server.MapleItemInformationProvider.getInstance().getEquipById(1132001);
                        equip.setStr(5000);
                        equip.setDex(5000);
                        equip.setInt(5000);
                        equip.setLuk(5000);
                        equip.setWatk(50);
                        equip.setMatk(50);
                        cm.getPlayer().getInventory(Packages.client.MapleInventoryType.EQUIP).addItem(equip);
						cm.reloadChar();
						cm.dispose();
                       } else {
                       cm.sendOk("Your inventory must be full or you do not have enough BossPoints.");
                       }
                       cm.dispose();
					   }
				} else if (selection == 13) {  
					if (cm.getPlayer().getBossPoints() > 750000000) {
						cm.getPlayer().gainBossPoints(-750000000);
						if (cm.canHold(1132002)) {
                        var equip = Packages.server.MapleItemInformationProvider.getInstance().getEquipById(1132002);
                        equip.setStr(7500);
                        equip.setDex(7500);
                        equip.setInt(7500);
                        equip.setLuk(7500);
                        equip.setWatk(75);
                        equip.setMatk(75);
                        cm.getPlayer().getInventory(Packages.client.MapleInventoryType.EQUIP).addItem(equip);
						cm.reloadChar();
						cm.dispose();
                       } else {
                       cm.sendOk("Your inventory is full.");
                       }
                       cm.dispose();
					   }
				} else if (selection == 14) { 
					if (cm.getPlayer().getBossPoints() > 900000000) {
						cm.getPlayer().gainBossPoints(-900000000);
						if (cm.canHold(1132003)) {
                        var equip = Packages.server.MapleItemInformationProvider.getInstance().getEquipById(1132003);
                        equip.setStr(13337);
                        equip.setDex(13337);
                        equip.setInt(13337);
                        equip.setLuk(13337);
                        equip.setWatk(80);
                        equip.setMatk(80);
                        cm.getPlayer().getInventory(Packages.client.MapleInventoryType.EQUIP).addItem(equip);
						cm.reloadChar();
						cm.dispose();
                       } else {
                       cm.sendOk("Your inventory is full.");
                       }
                       cm.dispose();
					   }
				} else if (selection == 15) {  
					if (cm.getPlayer().getBossPoints() < 2000000000) {
					    cm.sendOk("You do not have enough BossPoints to purchase this item.");
						cm.dispose();
						return;
						cm.getPlayer().gainBossPoints(-2000000000);
						if (cm.canHold(1132004)) {
                        var equip = Packages.server.MapleItemInformationProvider.getInstance().getEquipById(1132004);
                        equip.setStr(32767);
                        equip.setDex(32767);
                        equip.setInt(32767);
                        equip.setLuk(32767);
                        equip.setWatk(100);
                        equip.setMatk(100);
                        cm.getPlayer().getInventory(Packages.client.MapleInventoryType.EQUIP).addItem(equip);
						cm.reloadChar();
						cm.sendOk("You have been awarded with your prize. I hope you are pleased! Good luck with your future ventures into The Boss Quest.");
                       } else {
                       cm.sendOk("Your inventory is full.");
                       }
                       cm.dispose();
					   }
			} else if (prize == 2) {
                if (cm.getPlayer().getBossPoints() < 50000000) {
                    cm.sendOk("You do not have #b50,000,000#k Boss Quest Points to trade with. Sorry!");
                    cm.dispose();
                    return;
				var win = mil50[selection];
				cm.gainItem(4001126, -3000);
				cm.getPlayer().setBossPoints(cm.getPlayer().getBossPoints() - 50000000);
				cm.gainItem(win, quantity);
			}
			cm.sendOk("You have been awarded with your prize. I hope you are pleased! Good luck with your future ventures into The Boss Quest.");
            cm.dispose();
            return;
        }
    }
}
}
}
 
Upvote 0
Is there an easier method to do use the method " } else {" ".

PHP:
} else if (selection == 15) {  
					if (cm.getPlayer().getBossPoints() < 2000000000) {
					    cm.sendOk("You do not have enough BossPoints to purchase this item.");
						cm.dispose();
						return;
						cm.getPlayer().gainBossPoints(-2000000000);
						if (cm.canHold(1132004)) {
                        var equip = Packages.server.MapleItemInformationProvider.getInstance().getEquipById(1132004);
                        equip.setStr(32767);
                        equip.setDex(32767);
                        equip.setInt(32767);
                        equip.setLuk(32767);
                        equip.setWatk(100);
                        equip.setMatk(100);
                        cm.getPlayer().getInventory(Packages.client.MapleInventoryType.EQUIP).addItem(equip);
						cm.reloadChar();
						cm.sendOk("You have been awarded with your prize. I hope you are pleased! Good luck with your future ventures into The Boss Quest.");
                       } else {
                       cm.sendOk("Your inventory is full.");
                       }
                       cm.dispose();
					   }
Everytime I try to use the same method for other options via copy + paste I get errors in my .bat file and It gets messy. I want my NPC to say you do not have enough points for the belt if he doesn't. If he does then he gets to buy it. Having the hardest time of my life figuring this one out...
Try to replace this by every selection :
PHP:
} else if (selection == 15) {  
    if (cm.getPlayer().getBossPoints() >= 2000000000) { // Checking for Boss Points
        if (cm.canHold(1132004)) { // Checking if he can hold
            // This part is if he has all the requirement.
            cm.getPlayer().gainBossPoints(-2000000000);
            var equip = Packages.server.MapleItemInformationProvider.getInstance().getEquipById(1132004);
            equip.setStr(32767);
            equip.setDex(32767);
            equip.setInt(32767);
            equip.setLuk(32767);
            equip.setWatk(100);
            equip.setMatk(100);
            cm.getPlayer().getInventory(Packages.client.MapleInventoryType.EQUIP).addItem(equip);
            cm.reloadChar();
            cm.sendOk("You have been awarded with your prize. I hope you are pleased! Good luck with your future ventures into The Boss Quest.");
            cm.dispose();
            // Complete.
        } else { // If his inventory is full
           cm.sendOk("Your inventory is full.");
           cm.dispose();
       } // Closes the first else, moving to the bossPoint one
   } else { // Is he do not have enough bosspoints
    cm.sendOk("You do not have enough BossPoints to purchase this item.");
    cm.dispose();
    }
}
 
Upvote 0
It works but when I try to add it to the other 3 sections the one before it doesn't work. As in when I don't have enough points for 1 belt it tells me but when I paste the function in to the other parts it doesn't give me the } else part and you don't have enough points message. Doesn't display anything. I also can't buy it either.
 
Upvote 0
Back