I'm saying Dev's know what they are doing. Not need to be perfect, but you seem to have no idea of what you're doing.
Printable View
I'm just thinking that you're retard, because you can't read, yet, try to find a way to makes me say something that does goes "invert" to what I already said.
And if you read my post it does says:
Indeed, I'm not perfect, I made a lot of mistakes that are uncountable, we are humans, but, make mistake and not knowing what you're doing are two things way different.Quote:
I'm saying Dev's know what they are doing. Not need to be perfect, but you seem to have no idea of what you're doing.
That last sentence response you next post. :sleep:
Lol I'm sorry I just had to point that out.
Fine, I call truce. Do you?
I'll refrain from starting a useless flame war and end up infraction ban crazy from a mod but whatev.
Just saying, there are many devs. Some great such as yourself, some not, like me. We're not all like DeadlyData and can do amazing things. But hey its all practice and takes time.
Yay no mod involved ._.
Flame warz avoided.
Confused with level 3.
How do i know when to put else and when to put else if?
I get it now :D Thank you I can finally edit this damn npc i've been working on
http://i84.photobucket.com/albums/k3...pleserver4.jpg
i get stuck at the character screen still
i've done everything correctly, from mysql to wz files
help please !
where do i find tutorial for how to add php code into server (MySQL)? i can't just paste it in and run it would comes out alot of errors. any help?
http://i84.photobucket.com/albums/k3...pleserver4.jpg
i get stuck at the character screen still
i've done everything correctly, from mysql to wz files
help please !
sorry for newb question
but whats the command to check mesos?
Thx this helped me alot!!!
I was just wondering.... What do I do with the script?
where does it go?
I made it into a .cpp in Visual C++ but where do I save it to?
aaand,
How do I choose what the NPC looks like and where it's placed (Ex. Nana (H), location: FM)
Well worth my 20 mins reading this!
Amazing guide!
I will sure get into making a server some day. It looks fun.
Ty again!
hope im not bumping an old thread. it was on the first page so i thought it was okay...
I have a question. What if you are using cm.ModifyNX? how would you put that in a script?
Looks simple enough, nice job organizing it.
How do I have it check more than one item in "if(cm.haveItem(itemcode));"?
is there a npc command to give gp, cause i cant find it anywhere o.o
ARGHHH !
whats wrong with it ???
How comes it always says "Fuck You" O= ?!PHP Code:/*
Oh , look Staars :D *****
*/
var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.sendOk("Fuck You :D");
cm.dispose();
} else {
if (status >= 0 && mode == 0) {
cm.sendOk("FUUUUUCK YOU :D 8==========>");
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendYesNo("Stop clicking ... FCK YOU !");
} else if (status == 1) {
cm.sendNext("You suck ... same like your mom!");
} else if (status == 2) {
cm.warp(3, 0);
cm.sendNext("You shitty noob fail @ coding ! so ... FUCK YOU !");
cm.dispose();
}
}
}
Where can i change this ?
HELP PLZZZzzzzZZZ !!!
You should be able to figure it out. Read the damn code.
how'd i add a pic of a mob inside my NPC , like for skillz #s[skillid]# . is it #m[mobid]# for mobs then ?
ok this is the nubist Q of the day im having issues DL C++ and or C# my comp is gay and it wont DL, is there another program i can use to code
Great guide. Used this about a week ago and it helped me out a lot.
after you make your script how do you add it to ur server?
Would my script work?
Just making sure :/Quote:
/* Mikaela's Custom Wedding Script #1 */
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("See you later");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 1) {
cm.sendNext("Hello, I'm the head organizer of NhatMs Weddings");
}
else if (status == 0) {
cm.sendYesNo("Are YOU getting married?!");
}
else if (status == 0) {
cm.sendOk("Fantastic! Have your mate talk to me, too, to meet you in the dressing room");
cm.warp([680000100], [0]);
cm.dispose();
}
else if (status == 1)
cm.sendOk("I know how you feel...");
cm.dispose();
}
}
}
arigatou thank you this has helped me alot in my past projects
get31720, you may want to add that comments can be put in two ways:
or:Code://Like this...
Code:/* Like
This
.
.
.
*/
Great tut, especially simple because I already know actionScript and a bit of javaScript already. +thank'd.
Cool tutorial, helped me lots.
But, I have a problem with this script.
What's wrong with it?Code:/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
var status = 0;
function start() {
status = -1;
action(1,0,0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.sendOk("Now I'm going emo 'cuz you want talk to me D:");
cm.dispose();
} else {
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendNext("Hello! My name is Duey and TEST NPC made by #d Jurkey");
} else if (status == 1) {
cm.sendGetText("What's your name?");
} else if (status == 2) {
cm.sendNext("Hello #b" + cm.getText() + "#k! Glad to meet you!");
} else if (status == 3) {
cm.sendNext("Do you want 100 NX Cash and 1 million mesos? It only works if you are SuperGM");
} else if (status == 4) {
if (cm.getJob().equals(net.sf.odinms.client.MapleJob. SUPERGM)) {
cm.gainNX(100);
cm.gainMeso(10000);
cm.sendOk("Enjoy and goodbye!");
cm.dispose();
}
}
}
}
Thanks for this guild. I can learn much more from here. :)
goood
I'm using the pack rev 107 and I was asking if someone can tell me which commend is use to make a NPC spawn a monster...
cm.spawnMonster doesn't exist so.....HELP XD
Hi this is my first post ever on RageZone, but I
Hello, thanks for this guide Angel! It is very useful.
Um, I know this is a very simple script, but I have been having trouble setting up a server (RuntimeExceptions and whatnot), so I can't really test this. Is it set up correctly? (Particularly the (status == 3) part.)
Thanks for answering!PHP 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("See you around!");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 0) {
cm.sendNext("Hello, welcome to RandompeepMS!");
cm.dispose();
}
else if (status == 1) {
cm.sendNext("How goes the hunting?");
cm.dispose();
}
}
else if (status == 2) {
cm.sendSimple("Do you need mesos? \r\n#L0#Yes, I'm broke and need some to start!#l\r\n#L1#No, but can I have some anyways?#l\r\n#L2#No, thank you.#l");
}
}
else if (status == 3) {
if (selection == 0) {
if (cm.getmeso() <= 1000) {
cm.gainmeso([500000]);
cm.sendOk("Wow, you really do need mesos. Well, I do not have much myself, but I hope it'll do.")
cm.dispose();
}
else {
cm.sendOk("No, you aren't. Don't rip me off!");
cm.dispose();
}
else if (selection == 1) {
if (cm.getmeso() <= 1000000) {
cm.gainmeso([100000]);
cm.sendOk("Well, you don't really need it, but... have a little anyways.");
cm.dispose();
}
else {
cm.sendOk("You don't have enough already? Stop leeching off my mesos; you have more than me now!");
cm.dispose();
}
else if (selection == 2) {
cm.sendOk("You're an honest one. Unfortunately I don't have anything else to give you. Maybe some other day. (When I figure out how to code adding fame/karma!");
cm.dispose();
}
}
}
}
}
Note: I have since figured out how to give fame. But, does it work on a server with karma instead?
Also, could you check this:
It's just the last part of the above script. Thank you for checking and (hopefully) answering the question!PHP Code:else if (selection == 2) {
cm.sendOk("You're an honest one. Unfortunately I don't have anything else to give you. Maybe some other day.");
cm.dispose();
if (cm.getFame() <= 25) {
cm.gainFame([1]);
}
}
}
}
}
}
Also, how do you use these? How do you determine which NPC gets the script?
Yo man,
I'm trying to edit my prize giver so my players can get cool items, It used to work just fine but now it wont work? can you correct what i did wrong Please and thank you!:D:
Quote:
/*Yellow Balloon
*/
/*Made By Saber
*/
var status = 0;
var l = "Welcome to the Custom Event ITEM Shop!, choose an item you'd wish to trade in for \r\n\n#fUI/UIWindow.img/QuestIcon/3/0#\r\n\n#L0#1#i1002140##t1002140# ~ 200 Tickets#l\r\n\n#L1# 1#i1042003##t1042003# ~ 400 tickets#l\r\n\n#L2# 1#i1062007##t1062007# ~ 1500 tickets#l\r\n\n#L3# 1#i1322013##t1322013# ~ 1500 tickets#l\r\n\n#L4# 1#i1442023##t1442023# ~ 50 tickets#l\r\n\n#L5# 1#i1012106##t1012106# ~ 700 tickets#l\r\n\n#L6# 1#i1012086##t1012086# ~ 420 tickets#l\r\n\n#L7# 1#i1012076##t1012076# ~ 580 tickets#l\r\n\n#L8# 1#i1012077##t1012077# ~ 20 tickets#l\r\n\n#L9# 1#i1452060##t1452060# ~ 900 tickets#l";
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.sendYesNo("Do you have any #i5220001# Event Tickets? If You Do You Can Trade It For Some Nice Items!");
}else if(status == 1){
cm.sendSimple(l+r);
}else if(status == 2){
if(!cm.haveItem(5220001)){
cm.sendOk("Come Back When You Have Some Event Tickets");
cm.dispose();
}else if(selection >= 0 && selection <= 0 && !cm.haveItem(5220001,200)){
cm.sendOk("Come Back When You Obtain A few Event Tickets");
cm.dispose();
}else if(selection >= 1 && selection <= 1 && !cm.haveItem(5220001,400)){
cm.sendOk("Come Back When You Obtain A few Event Tickets");
cm.dispose();
}else if(selection >= 2 && selection <= 2 && !cm.haveItem(5220001,1500)){
cm.sendOk("Come Back When You Obtain A few Event Tickets");
cm.dispose();
}else if(selection >= 3 && selection <= 3 && !cm.haveItem(5220001,1500)){
cm.sendOk("Come Back When You Obtain A few Event Tickets");
cm.dispose();
}else if(selection >= 4 && selection <= 4 && !cm.haveItem(5220001,50)){
cm.sendOk("Come Back When You Obtain A few Event Tickets");
cm.dispose();
}else if(selection >= 5 && selection <= 5 && !cm.haveItem(5220001,700)){
cm.sendOk("Come Back When You Obtain A few Event Tickets");
cm.dispose();
}else if(selection >= 6 && selection <= 6 && !cm.haveItem(5220001,420)){
cm.sendOk("Come Back When You Obtain A few Events Tickets");
cm.dispose();
}else if(selection >= 7 && selection <= 7 && !cm.haveItem(5220001,580)){
cm.sendOk("Come Back When You Obtain A few Events Tickets");
cm.dispose();
}else if(selection >= 8 && selection <= 8 && !cm.haveItem(5220001,20)){
cm.sendOk("Come Back When You Obtain A few Events Tickets");
cm.dispose();
}else if(selection >= 9 && selection <= 9 && !cm.haveItem(5220001,900)){
cm.sendOk("Come Back When You Obtain A few Events Tickets");
cm.dispose();
}else{
if(selection == 0){
cm.gainItem(1002140,1);
cm.gainItem(5220001,-200);
}else if(selection == 1){
cm.gainItem(1042003,1);
cm.gainItem(5220001,-400);
}else if(selection == 2){
cm.gainItem(1062007,1);
cm.gainItem(5220001,-1500);
}else if(selection == 3){
cm.gainItem(1322013,1);
cm.gainItem(5220001,-1500);
}else if(selection == 4){
cm.gainItem(1442023,1);
cm.gainItem(5220001,-50);
}else if(selection == 5){
cm.gainItem(1012106,1);
cm.gainItem(5220001,-700);
}else if(selection == 6){
cm.gainItem(1012086,1);
cm.gainItem(5220001,-420);
}else if(selection == 7){
cm.gainItem(1012076,1);
cm.gainItem(5220001,-580);
}else if(selection == 8){
cm.gainItem(1012077,1);
cm.gainItem(5220001,-20);
}else if(selection == 9){
cm.gainItem(1452060,1);
cm.gainItem(5220001,-900);
}
cm.sendOk("There you go, Hope You Enjoy It");
cm.dispose();
}
}
}
}
Hey everyone! I'm back! I haven't scripted much but I remember so I'll be trying to fix your scripts again.
@ gnomedrago
I saw you got some help on Clysse's thread. I fixed yours anyway. Tell me if it works.
@ randompeepPHP 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("Okay then, if you still want to try a #bJumpquest#k, talk to me!");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 0) {
cm.sendNext("Hi, I'm Nana of Orbis! I'm the #bUnrealStory Jumpquest Npc#k!!");
}
else if (status == 1) {
cm.sendSimple("Where do you want me to take you?#b\r\n#L0#The Chimney JQ#l\r\n#L1#The Physical Training#l#k\r\n\r\nAt the end of each #bJumpquest#k there will be a Npc who gives rewards! So grab your chance and");
} // You had an extra }
else if (status == 2) {
if (selection == 0) {
cm.warp(0, 0); // cm.warp not cm.Warp small mistakes like these can stop the command from working.
cm.dispose();
}
else if (selection == 1) {
cm.warp(0, 0);
cm.dispose();
}
}
}
}
Karma are points recorded in the Database right? I don't think there's an NPC command to add Karma but check your NPCConversationManagar sql anyway.
PHP 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("See you around!");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 0) {
cm.sendNext("Hello, welcome to RandompeepMS!");
} // remember that when you add a dispose(); it ends the conversation so save it for the end.
else if (status == 1) {
cm.sendNext("How goes the hunting?");
} // extra }
else if (status == 2) {
cm.sendSimple("Do you need mesos? \r\n#L0#Yes, I'm broke and need some to start!#l\r\n#L1#No, but can I have some anyways?#l\r\n#L2#No, thank you.#l");
} // extra }
else if (status == 3) {
if (selection == 0) {
if (cm.getMeso() <= 1000) { // Caps the M in Meso or the cm. won't work
cm.gainMeso(500000); // no [] I know people get confused because it shows the [] in the cm. commands spoiler
cm.sendOk("Wow, you really do need mesos. Well, I do not have much myself, but I hope it'll do."); // forgot a ;
cm.dispose();
}
else {
cm.sendOk("No, you aren't. Don't rip me off!");
cm.dispose();
}
} // This closes the if (selection == 0) {
else if (selection == 1) {
if (cm.getMeso() <= 1000000) {
cm.gainMeso(100000);
cm.sendOk("Well, you don't really need it, but... have a little anyways.");
cm.dispose();
}
else {
cm.sendOk("You don't have enough already? Stop leeching off my mesos; you have more than me now!");
cm.dispose();
}
} // This closes the else if (selection == 1) {
else if (selection == 2) {
if (cm.getFame() <= 25) {
cm.sendOk("You're an honest one. Unfortunately I don't have anything else to give you. Maybe some other day.");
cm.gainFame(1); // no []
cm.dispose();
}
else {
cm.sendOk("You're an honest one. Unfortunately I don't have anything else to give you. Maybe some other day.");
cm.dispose();
}
}
}
}
}
@ get -
Your layout is ugly.PHP Code:var status;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode != 1) {
cm.dispose();
return;
}
status++;
if (status == 0) {
cm.sendNext("Hi, I'm Nana of Orbis! I'm the #bUnrealStory Jumpquest Npc#k!!");
} else if (status == 1) {
cm.sendSimple("Where do you want me to take you?#b\r\n#L0#The Chimney JQ#l\r\n#L1#The Physical Training#l#k\r\n\r\nAt the end of each #bJumpquest#k there will be a Npc who gives rewards! So grab your chance and");
} else if (status == 2) {
var warpMap;
if (selection == 0) {
warpMap = 0;
} else if (selection == 1) {
warpMap = 1;
}
cm.warp(warpMap, 0);
cm.dispose();
}
}
sigh... what happened to the days when none of that mattered and all that was important was the script working :(
@ PinkGatsby
So, I use a different way to start my scripts.
So, the way I start my scripts are spaced out so it seems long.
So, I like to space out my } like this:
So, I don't use variables in my scripts all the time.PHP Code:}
else {
If they work, they work. If that's how you like to do your scripts that's fine, but don't come here and say my layout is ugly. I'm not furious at you just annoyed you'd say that in my own thread.
@ kamoda
Doesn't it not work completely or stops are a certain point? Use spacing I think you're missing some brackets.
Thanks! One other question, how do you create custom quest IDs to make your own quest?
LOL.
You couldn't put 15 seconds max in to making the script more readable. People like you are the reason that some of the stuff people releases are hard to interpret and manage and hence chance of memory leaks. (Talking about Java in general.)
The script works but is it easily readable ? No.PHP Code:var status;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode != 1) {
cm.dispose();
return;
}
status++;
i
f
(status == 0)
{
cm.sendN
ext("Hi, I'm Nana of Orbis! I'm the #bUnrealStory Jumpquest Npc#k!!");
} else
if (status == 1) {
cm.sendSi
mple("Where do you want me to take you?#b\r\n#L0#The Chimney JQ#l\r\n#L1#The Physical Training#l#k\r\n\r\nAt the end of each #bJumpquest#k there will be a Npc who gives rewards! So grab your chance and");
} else if (status == 2)
{
var warpMap;
if
(selection == 0) {
warpMap = 0;
} else if (selection == 1) {
warpMap = 1;
}
cm.warp(warpMap, 0);
cm.dis
pose();
}
}
Then what does that make you? At least get has helped ALOT of people through this thread. Read through the entire thread and see for yourself. Regardless of it being "neat" or "better organized", it gets the job done, and if it teachs noobs along the way how to code NPCs, then so be it.
Two questions.
1. Same as the one from earlier. How do you actually make a custom quest ID, so your quests work?
2. How do you script an NPC so that it says something different from its original. Like, for example, a storage NPC summons a boss. (I was given cm.c.getPlayer().getMapId(), but I don't even know where to put that in the script.)
@ randompeep
1. A custom quest ID for a quest you made compeltly by yourself? I'm sorry, I haven't heard or done that before. I've just started playing private servers again so I haven't seen any servers do that either. Most people just make the NPC require you to get an item and check for the item.
2. I'm not sure what you mean. You mean the kind of NPC that says stuff already and even if you add a script it won't change? Explain a little more.
@ PinkGatsby
Could you please stop? Could you at least say something helpful while you're critisizing me? Why are you posting all this stuff against me? What do you have against me? Could you just PM me how you feel instead of writing it all in my tutorial?
I script this way and I show people how to script this way because it's straightforward and simple.
Here's a serious and true suggestion: If you truly want people to start scripting better with more variables and stuff, then do me and a lot of other people in this community a big favor. Go write a tutorial on how you script. Just stop critisizing my tutorial. I'm sure you wouldn't like it if you had a NPC scripting tutorial and someone started saying your work was ugly and unorganized.
Ah, ok. I just saw that cm.startQuest and wondered.
I've seen vids of people reusing NPCs for different purposes. For example, the Mu Lung storage NPC was placed on another map and summoned bosses for people to train on. I don't know if the original storage keeper still worked normally, but obviously someone could change what the NPC did. (The point is, if the last part is true, how do you code an NPC to do one thing on one map, and do another thing on another map?)Quote:
2. I'm not sure what you mean. You mean the kind of NPC that says stuff already and even if you add a script it won't change? Explain a little more.
I don't know, I don't even know where to place the script after it's finished, or how to specify which NPC uses it. :?: Though, because my private server isn't up yet, I can't even test the 4 or so scripts I have had time to write.
I learn alot from this guide :D
Good job leeching from GameCheetah. I saw this exact guide on gamecheetah. If your going to steal someones guide atleast give credits.
hey uuh. how make a script.. notpad?
or w/e its java script right?
Edit: i maked one whit notepad but how let it work
i have only my notpad (where to put)
hi wats the cm.command for getting stats
@ Tropicano-Marc
You can make a script on nearly anything. Including regular Notepad. Save it as a .js file and put it in your scripts > NPC folder and you're done :]
@ koldoleboy
To be honest. I have no idea. I tried search some info. on it and this is what I found:
I managed to find a few scripts that actually checked for AP. Whether this works or not is completely unknown to me. I could not find it in the NPCCommandProcessor.java but you could try.
In the scripts they used:
PHP Code:p.getStr() // checks for Str (Same applys to Dex,Int,and Luk
Bascially the same sort of thing with cm. commands except it had p. All the scripts I could find used this. The only reason I'm IFing it is because I couldn't find it in the repacks. Good Luck tell me if this works or not. Somebody else will probably reply with a better answer or agree with this.PHP Code:p.setStr() // sets Str (Same applys to Dex,Int and Luk
Hey there I got problem and I hope you guys can help me out.
I need a code for a NPC to warp players somewhere BUT they need a certain level to get warped.
this is what I need,
- If a player is level 120 then he/she gets warped to map ("xxx")
- If a player is BELOW level 120 he/she gets warped to FM("910000000")
Can someone help me out?
Kind regards,
Frank
I'm a freaking bit rusty at scripting,lol. Test if it works and if not,post me the bat error.PHP Code:var status = 0;
var mapxxx = 1000000;
var fm = 910000000;
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("Alright, see you next time.");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 0) {
if(cm.getLevel() >= 120) {
cm.sendNext("You're gonna be warped to map xxx.");
status = 9;
} else if (cm.getLevel() < 120) {
cm.sendNext("You're not Level 120 yet,so you'll be warped to FM!");
status = 11;
}
} else if (status == 10) {
cm.warp(mapxxx);
cm.dispose();
} else if (status == 12) {
cm.warp(fm);
cm.dispose();
}
}
}
@ Frank + Lejgolacsz
Thanks Lejgolacsz for making his NPC script. I found a few problems. I didn't get to test it, but it should work. If not say what happened when you clicked the NPC.
PHP Code:var status = 0;
var mapxxx = 1000000;
var fm = 910000000;
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("Alright, see you next time.");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 0) {
if(cm.getLevel() >= 120) {
cm.sendNext("You're gonna be warped to map xxx.");
status = 10; // Status is CHANGED to 10 (not added 10)
} else if (cm.getLevel() < 120) {
cm.sendNext("You're not Level 120 yet,so you'll be warped to FM!");
status = 12;
}
} if (status == 10) { // If status is 10 then this will happen. I also changed the else if to if
cm.warp(mapxxx);
cm.dispose();
} else if (status == 12) { // If status is 12 this will happen
cm.warp(fm);
cm.dispose();
}
}
}
THANKS ANGEL! This guide helped lots. :]
I'd like to ask, though, is there a way I can make an NPC that would keep track of how many mesos it was given total. For example, PlayerA gives the NPC 1,000 mesos, then PlayerB comes back and gives the NPC another 1,000 mesos, making the NPC say that it is currently carrying 2,000 mesos.
hmm get31720,but doesn't the cm.sendNext increase the status below it by one already? That's what I had always when I made my scripts.
So if you do cm.sendNext() and status 10 after it,you need to do else if for status 11.
~Angel~ can you help me with this script?
I change this script so that we need 99 X-mas Present Box to exchange one of the Santa Equipment,but if we only have one and choose one of the following selection we will lose all of our X-mas Present Box.Can you change it so that the remaining X-mas Present Box will not gone?
This script works perfectly,the problem is you will lose all your X-max Present Box,example if you have only 90 X-mas Present Box and you choose one of the selection,your X-Mas Box Present will gone without getting your desire Santa's Equipment.Code:/* Author ~ johnlth93, xb0ib0ix3 and vincent - Zairean Dev
*
* X'mas Event
*
* 9201030.js: Happy Village - X'mas Present Box Item Exchanger.... Fixed a serious error in selection 4,5 (can get item without X'mas Present Box)
*/
function start() {
cm.sendSimple("Hello,Would you like to exchange #v4000423# for my Santa Equipments? You can get some from the Box on the ground. #bNotice#k:#rIf you don't have enough #v4000423# please don't exchange,because you will lose all your #v4000423# without getting your desire item.#k\r\n#L0# 99 #v4000423# for a #v1002225# #k\r\n#L1# 99 #v4000423# for a #v1012007##k\r\n#L2# 99 #v4000423# for a #v1082101##k\r\n#L3# 99 #v4000423# for a #v1051049# #k\r\n#L4# 99 #v4000423# for a #v1070005##k\r\n#L5# 99 #v4000423# for a #v1071016##k\r\n#L6# 99 #v4000423# for a #v1050119# #k\r\n#L7# 99 #v4000423# for a #v1050019# #k\r\n#L8# 99 #v4000423# for a #v1051131# #k\r\n#L9# 99 #v4000423# for a #v1702166# #k\r\n#L10# 99 #v4000423# for a #v1702100# #k\r\n#L11# 99 #v4000423# for a #v1702008# #k\r\n#L12# 99 #v4000423# for a #v1002479# #k\r\n#L13# 99 #v4000423# for a #v1052046#");
}
function action(mode, type, selection) {
cm.dispose();
if (selection == 0) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1002225,1);
cm.sendOk("Happy Merry Christmas with the #v1002225#");
} else if (selection == 1) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1012007,1);
cm.sendOk("Happy Merry Christmas with the #v1012007#");
} else if (selection == 2) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1082****1);
cm.sendOk("Happy Merry Christmas with the #v1082101#");
} else if (selection == 3) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1051049,1);
cm.sendOk("Happy Merry Christmas with the #v1051049#");
} else if (selection == 4) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1070005,1);
cm.sendOk("Happy Merry Christmas with the #v1070005#");
} else if (selection == 5) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1071016,1);
cm.sendOk("Happy Merry Christmas with the #v1071016#");
} else if (selection == 6) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1050119,1);
cm.sendOk("Happy Merry Christmas with the #v1050119#");
} else if (selection == 7) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1050019,1);
cm.sendOk("Happy Merry Christmas with the #v1050019#");
} else if (selection == 8) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1051131,1);
cm.sendOk("Happy Merry Christmas with the #v1051131#");
} else if (selection == 9) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1702166,1);
cm.sendOk("Happy Merry Christmas with the #v1702166#");
cm.dispose();
} else if (selection == 10) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1702****1);
cm.sendOk("Happy Merry Christmas with the #v1702100#");
cm.dispose();
} else if (selection == 11) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1702008,1);
cm.sendOk("Happy Merry Christmas with the #v1702008#");
cm.dispose();
} else if (selection == 12) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1002479,1);
cm.sendOk("Happy Merry Christmas with the #v1002479#");
cm.dispose();
} else if (selection == 13) {
cm.haveItem(4000423,99);
cm.gainItem(4000423,-99);
cm.gainItem(1052046,1);
cm.sendOk("Happy Merry Christmas with the #v1052046#");
cm.dispose();
}
}
hey bro more screenshots plz and maybe even add a vid of hao to check for an item plz and thnx
@ JackBread
You would need to keep the information in a table in your MySql DB. Look it up. Once you have that the NPC can be scripted to edit the numbers in the table for the character
@ Lejgolacsz
Hmm... I'm not sure. Try it and tell me which way works.
@ Kanzaki123
Sorry, I'm not completely fixing the script for you but I'll tell you what I see wrong. The cm.haveItem need to be use in the if and else way. Look at the guide for examples. Also you
'll need to make an else for the cm.haveItem because if they DON'T have it then the script needs to know what to do.
@ Epic
The check for Item and Mesos are mentioned in there.
Sorry about all the short replies. I can only check this on weekends and it's hard to answer all you at once D:
@ L♥ve
I actually don't really play maplestory at all anymore. I play something different, but I check my guide every now and then for new posts and PMs.
Is there a cm.[Command] for NPC to check whether the player/character have the skill?
I have a question how do you check if the person has both level and item?
This is a great tut ty so much
What about if you want to let someone die, is there a command for that, and something to decrease HP? I tried to look up Roger's script (Beginner world, youknow, the guy from "The Apple"!) but it wasn't in my repack O_O And for so far I know there aren't any other NPC's who decrease HP or actually KILL players.
So do you know these commands?
(I'm sorry if this could be found anywhere I was in a rush and my tried searches resulted in nothing!)
lol nice guide and i finally understand on how to do this but how lets say u want to give someone more than one item should it look like
cm.gainItem(2000005,2000006); might not be an actuall item but i jsut want to know im trying to make a custom mount npc
dude! thsi is an awesome tutorial!
this should be made sticky!
i really learned alot here.
i might even make some releases :P
---------- Post added at 10:41 PM ---------- Previous post was at 10:36 PM ----------
actually,
if you wanna have more than one item
if its quantity then its suppose to be cm.gainItem(itemid, quantity);
if its different items
cm.gainItem(itemid, 1 or different quantity)
cm.gainItem(itemid, 1 or different quantity);
after the first cm.gainItem(itemid, 1 or different quantity)
there must be a ;
for some reason.
i have no idea why.
please correct me if im wrong!
example :
cm.gainItem(1002820, 1)
cm.gainItem(1012006, 1);
cm.gainItem(2000005, 300);
cm.gainItem(2022121, 15);
cm.gainItem(2022123, 15);
cm.gainItem(1702153, 1);
cm.gainItem(1040129, 1);
cm.gainItem(1062081, 1);
cm.gainItem(1102142, 1);
cm.gainItem(1102146, 1);
cm.gainItem(1082162, 1);
cm.gainItem(1072325, 1);
cm.gainItem(1302024, 1);
cm.gainItem(1092035, 1);
cm.gainItem(1050018, 1);
cm.gainItem(1051017, 1);
cm.gainItem(5010030, 1);
cm.gainItem(5072000, 10);
cm.gainItem(5000031, 1);
cm.gainItem(50000*** 1);
cm.gainItem(5000033, 1);
cm.gainItem(2120000, 500);
cm.gainItem(5390000, 5);
thats what i did and my npc doesn't work lol anyone know what do do?? or can tell me what im doing wrong??
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, oh ya thanks for saying thank you hidden for making this and taking up an hour of time u were apost to be doing ur homework :)");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 0) {
cm.sendNext("Hello there im hiddens fisrt custom npc!");
}
else if (status == 1) {
cm.sendSimple("You have custom mounts.\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 custom mounts? Here I'll give you some make sure u have 45 open slots ass.!");
cm.gainItem(01902015,1);
cm.gainItem(01902016,1);
cm.gainItem(01902017,1);
cm.gainItem(01902018,1);
cm.gainItem(01902022,1);
cm.gainItem(01902023,1);
cm.gainItem(01902024,1);
cm.gainItem(01902025,1);
cm.gainItem(01912011,1);
cm.gainItem(01912015,1);
cm.gainItem(01912016,1);
cm.gainItem(01912017,1);
cm.gainItem(01912018,1);
cm.gainItem(01902014,1);
cm.gainItem(01902015,1);
cm.gainItem(01902016,1);
cm.gainItem(01902017,1);
cm.gainItem(01902025,1);
cm.gainItem(01902025,1);
cm.gainItem(01912010,1);
cm.gainItem(01912011,1);
cm.gainItem(01912012,1);
cm.gainItem(01912013,1);
cm.gainItem(01912014,1);
cm.gainItem(01912015,1);
cm.gainItem(01912016,1);
cm.gainItem(01912017,1);
cm.gainItem(01912018,1);
cm.gainItem(01902026,1);
cm.gainItem(01902027,1);
cm.gainItem(01902031,1);
cm.gainItem(019020***1);
cm.gainItem(01902033,1);
cm.gainItem(01902034,1);
cm.gainItem(01902035,1);
cm.gainItem(01902037,1);
cm.gainItem(01912019,1);
cm.gainItem(01912021,1);
cm.gainItem(01912024,1);
cm.gainItem(01912025,1);
cm.gainItem(01912026,1);
cm.gainItem(01912027,1);
cm.gainItem(01912028,1);
cm.gainItem(01912030,1);
cm.dispose();
}
}
else if (status == 2) {
if (selection == 0) {
cm.sendOk("Okay here you go make sure u have 45 open spots in your inventory");
ccm.gainItem(01902015,1);
cm.gainItem(01902016,1);
cm.gainItem(01902017,1);
cm.gainItem(01902018,1);
cm.gainItem(01902022,1);
cm.gainItem(01902023,1);
cm.gainItem(01902024,1);
cm.gainItem(01902025,1);
cm.gainItem(01912011,1);
cm.gainItem(01912015,1);
cm.gainItem(01912016,1);
cm.gainItem(01912017,1);
cm.gainItem(01912018,1);
cm.gainItem(01902014,1);
cm.gainItem(01902015,1);
cm.gainItem(01902016,1);
cm.gainItem(01902017,1);
cm.gainItem(01902025,1);
cm.gainItem(01902025,1);
cm.gainItem(01912010,1);
cm.gainItem(01912011,1);
cm.gainItem(01912012,1);
cm.gainItem(01912013,1);
cm.gainItem(01912014,1);
cm.gainItem(01912015,1);
cm.gainItem(01912016,1);
cm.gainItem(01912017,1);
cm.gainItem(01912018,1);
cm.gainItem(01902026,1);
cm.gainItem(01902027,1);
cm.gainItem(01902031,1);
cm.gainItem(019020***1);
cm.gainItem(01902033,1);
cm.gainItem(01902034,1);
cm.gainItem(01902035,1);
cm.gainItem(01902037,1);
cm.gainItem(01912019,1);
cm.gainItem(01912021,1);
cm.gainItem(01912024,1);
cm.gainItem(01912025,1);
cm.gainItem(01912026,1);
cm.gainItem(01912027,1);
cm.gainItem(01912028,1);
cm.gainItem(01912030,1);
cm.dispose();
}
else if (selection == 1) {
cm.sendOk("Thanks for thanking hidden for taking up an hour of his time meanie");
cm.dispose();
}
}
}
}
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, oh ya thanks for saying thank you hidden for making this and taking up an hour of time u were apost to be doing ur homework :)");
cm.dispose();
return;
}
if (mode == 1) {
status++;
}
else {
status--;
}
if (status == 0) {
cm.sendNext("Hello there im hiddens fisrt custom npc!");
}
else if (status == 1) {
cm.sendSimple("You have custom mounts.\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 custom mounts? Here I'll give you some make sure u have 45 open slots ass.!");
function action(mode, type, selection) {
cm.dispose();
if (selection == 0) {
cm.gainItem(01902015,1);
cm.gainItem(01902016,1);
cm.gainItem(01902017,1);
cm.gainItem(01902018,1);
cm.gainItem(01902022,1);
cm.gainItem(01902023,1);
cm.gainItem(01902024,1);
cm.gainItem(01902025,1);
cm.gainItem(01912011,1);
cm.gainItem(01912015,1);
cm.gainItem(01912016,1);
cm.gainItem(01912017,1);
cm.gainItem(01912018,1);
cm.gainItem(01902014,1);
cm.gainItem(01902015,1);
cm.gainItem(01902016,1);
cm.gainItem(01902017,1);
cm.gainItem(01902025,1);
cm.gainItem(01902025,1);
cm.gainItem(01912010,1);
cm.gainItem(01912011,1);
cm.gainItem(01912012,1);
cm.gainItem(01912013,1);
cm.gainItem(01912014,1);
cm.gainItem(01912015,1);
cm.gainItem(01912016,1);
cm.gainItem(01912017,1);
cm.gainItem(01912018,1);
cm.gainItem(01902026,1);
cm.gainItem(01902027,1);
cm.gainItem(01902031,1);
cm.gainItem(019020***1);
cm.gainItem(01902033,1);
cm.gainItem(01902034,1);
cm.gainItem(01902035,1);
cm.gainItem(01902037,1);
cm.gainItem(01912019,1);
cm.gainItem(01912021,1);
cm.gainItem(01912024,1);
cm.gainItem(01912025,1);
cm.gainItem(01912026,1);
cm.gainItem(01912027,1);
cm.gainItem(01912028,1);
cm.gainItem(01912030,1);
cm.dispose();
}
}
else if (status == 2) {
if (selection == 0) {
cm.sendOk("Okay here you go make sure u have 45 open spots in your inventory");
function action(mode, type, selection) {
cm.dispose();
if (selection == 0) {
ccm.gainItem(01902015,1);
cm.gainItem(01902016,1);
cm.gainItem(01902017,1);
cm.gainItem(01902018,1);
cm.gainItem(01902022,1);
cm.gainItem(01902023,1);
cm.gainItem(01902024,1);
cm.gainItem(01902025,1);
cm.gainItem(01912011,1);
cm.gainItem(01912015,1);
cm.gainItem(01912016,1);
cm.gainItem(01912017,1);
cm.gainItem(01912018,1);
cm.gainItem(01902014,1);
cm.gainItem(01902015,1);
cm.gainItem(01902016,1);
cm.gainItem(01902017,1);
cm.gainItem(01902025,1);
cm.gainItem(01902025,1);
cm.gainItem(01912010,1);
cm.gainItem(01912011,1);
cm.gainItem(01912012,1);
cm.gainItem(01912013,1);
cm.gainItem(01912014,1);
cm.gainItem(01912015,1);
cm.gainItem(01912016,1);
cm.gainItem(01912017,1);
cm.gainItem(01912018,1);
cm.gainItem(01902026,1);
cm.gainItem(01902027,1);
cm.gainItem(01902031,1);
cm.gainItem(019020***1);
cm.gainItem(01902033,1);
cm.gainItem(01902034,1);
cm.gainItem(01902035,1);
cm.gainItem(01902037,1);
cm.gainItem(01912019,1);
cm.gainItem(01912021,1);
cm.gainItem(01912024,1);
cm.gainItem(01912025,1);
cm.gainItem(01912026,1);
cm.gainItem(01912027,1);
cm.gainItem(01912028,1);
cm.gainItem(01912030,1);
cm.dispose();
}
}
else if (selection == 1) {
cm.sendOk("Thanks for thanking hidden for taking up an hour of his time meanie");
cm.dispose();
}
}
}
}
---------- Post added at 11:31 AM ---------- Previous post was at 11:26 AM ----------
not sure if that works.
I can't really figure out what's wrong with this one! :sleep:Code:/*
** NPC: Cesar (2101017)
** Map: Maple Road (ID:20000)
*/
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) {
if(cm.haveItem(4001027)) {
cm.sendNext("Cesar checks for medal.");
}
if(cm.haveItem(4001029)) {
cm.sendOk("Cesar takes food! Cesar gives scroll!");
cm.gainItem(4001029,-1);
cm.gainItem(4001028,1);
cm.dispose();
}
else {
cm.sendOk("Cesar gives stone!");
cm.gainItem(4001035,1);
cm.dispose();
}
}
else if (status == 1) {
cm.warp(30000,0);
cm.dispose();
}
}
}
I'm sorry to bother anyone with this! Brackets are fine! (12 }'s and 12 {'s)
It would be nice if anyone could find an answer for this one!
cool, thanks, can u make it dor downloads? .rar/.zip?
Wow, thanks for keeping this guide alive guys. I can't believe many people still read and thank this guide.
@Gnomedrago
I know it's too late to fix your script for you, but I'm just going to say so the answer is on the same page as your question if anyone comes to see it.
The 2nd if(cm.haveItem()) needs to be
else if(cm.haveItem())
I come and check to see if this thread is still alive every now and then. I makes me happy it helps so many people. Thanks everyone!
I don't understand what the mode means.
Like in here,
Code:if (mode == -1) {
This is cody script ,Quote:
/* Cody
*/
importPackage(net.sf.odinms.client);
var status = 0;
var job;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
} else {
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendOK("Hello. I'm Cody. Nice to meet you! =)");
cm.dispose();
return;
}
}
}
when i replace with another script .
It won't update to my new script .(v75 arberms)
Last time i host using v62 , it will always auto update the scripts even the server is running .
How to solve it ? ty :O:
Something is wrong in my script oO The selection 0 part doesn't work the other part does help xD?
Code:var status = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == 1) {
status++;
}else{
status--;
}
if (status == 0) {
cm.sendSimple("Hey there. would you like to \r\n#L0# Trade 1 billion mesos for a tetris piece#l \r\n or \r\n #L1#Trade a tetris piece for 1 billion mesos#l");
}else if (status == 1){
if (selection == 0) {
if (cm.getMesos() >= 1000000000){
cm.sendOk("Congratz! succesfull trade!");
cm.gainItem(4030002, 1);
cm.gainMesos(-1000000000);
cm.dispose();
}else{
cm.sendOk("You don't have enough mesos! Go hunt more :D");
cm.dispose();
}
}else if (selection == 1) {
if (cm.haveItem(4030002) >= 1) {
cm.sendOk("Congratz! succesfull trade!");
cm.gainItem(4030002, -1);
cm.gainMesos(1000000000);
cm.dispose();
}else{
cm.sendOk("You dont have a tetris piece! Go hunt mesos :D");
cm.dispose();
}
}
}
}
HEY! i am new here :3 and new to making a sever.. and i folowed you giude. it is good.. but.. i created v55 and when i click my npc, it is not opening anything.... i did a super rebirth with your guides.. can you edit it for me?
link : http://www.mediafire.com/?tm5xjgmj0z0
:http://www.filefront.com/16581077/9010004.rar
HEY! i am new here :3 and new to making a sever.. and i folowed you giude. it is good.. but.. i created v55 and when i click my npc, it is not opening anything.... i did a super rebirth with your guides.. can you edit it for me?
link : http://www.mediafire.com/?tm5xjgmj0z0
:http://www.filefront.com/16581077/9010004.rar
Nice job made about 3 npc's from scratch with this, took me a while though anyways nice job :).
Quote:
If god was a dj, life was a dance floor, rhythem was the love, then we are the music.
nice explanation...im still learning the basics, i'm trying to add more lines to this...ive tried...and one way i tried it d/c'ed me f6...lol, so if you or anyone could help explain how to do that to me...it would be greatly appreaciated.
is there any way to spawn mobs with npc?
I get an Auto-DC when I talk to Thomas Swift with this code. Can anyone help please?
PHP Code:// Thomas Swift [Heneseys] / [Amoria]
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) {
if (cm.getPlayer().getMapId() == 100000000){
cm.sendYesNo("Hi there, would you like to goto Amoria?");
} else if (status == 1){
cm.sendSimple("Alright then, enjoy your stay there. Come back to me from there if you want to ever head back.");
cm.warp(680000000, 0);
cm.dispose();
} else {
cm.sendOk("Ok then. Come back when you are interested.");
cm.dispose();
}
if (cm.getPlayer().getMapId() == 680000000){
cm.sendYesNo("Hey, would you like to go back to Henesys?");
} else if (status == 2){
cm.sendSimple("Alright then, I will take you back.");
cm.warp(100000000, 0);
cm.dispose();
} else {
cm.sendOk("Ok, come back whenever you want to leave.");
cm.dispose();
}
}
}
}
thanks really nice
Not 100% sure, but you can try this...
PHP Code:// Thomas Swift [Heneseys] / [Amoria]
var hene = 0;
var amor = 0;
function start() {
if (cm.getPlayer().getMapId() == 100000000) {
cm.sendYesNo("Hi there, would you like to goto Amoria?");
hene == 1;
} else if (cm.getPlayer().getMapId() == 680000000) {
cm.sendYesNo("Hey, would you like to go back to Henesys?");
amor == 1;
}else{
cm.sendOk("I'm doing good here.");
cm.dispose();
}
}
function action(mode, type, selection) {
if (mode > 0) {
if (hene == 1) {
cm.sendOk("Alright then, enjoy your stay there. Come back to me from there if you want to ever head back.");
cm.warp(680000000, 0);
} else if (amor == 1) {
cm.sendOk("Alright then, I will take you back.");
cm.warp(100000000, 0);
}else{
cm.sendOk("Ok then. Come back when you are interested.");
}
cm.dispose();
}
}
Didn't work, but then I am trying this with selections.. Would this work?:
PHP Code:var status = 0;
var AMORIA = 0;
var HENESYS = 0;
function start() {
status = -1;
action(1, 0, 0);
}
function action(mode, type, selection) {
if (mode == -1) {
cm.sendSimple("Alright then, come back later when you want to.");
cm.dispose();
} else {
if (mode == 0 && status == 1) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
HENESYS++;
if ((cm.getPlayer().getMapId() == 100000000) && (HENESYS == 1)){
cm.sendSimple("Would you like to goto Amoria? \r\n#L0#Yes#l \r\n#L0L1#No#l");
switch(selection){
case 0:
status++;
cm.sendSimple("Alright, then I will take you there");
AMORIA++;
HENESYS--;
cm.dispose();
break;
case 1:
status++;
cm.sendSimple("Alright then come back when you want to.");
cm.dispose();
break;
}
} else if ((cm.getPlayer().getMapId() == 680000000) && (AMORIA == 1)){
cm.sendSimple("Hey! Would you like to go back to Henesys now? \r\n#L0#Yes#l \r\n#L0L1#No#l");
switch(selection){
case 0:
status++;
cm.sendSimple("Alright, I will take you back then");
AMORIA--;
HENESYS++;
cm.dispose();
break;
case 1:
status++;
cm.sendSimple("Alright, then come back when you want to.");
cm.dispose();
}
}
}
}
}
Try this
Remember to @dispose yourself.PHP Code:// Thomas Swift [Heneseys] / [Amoria]
function start() {
if (cm.getPlayer().getMapId() == 100000000) {
cm.sendYesNo("Hi there, would you like to goto Amoria?");
} else if (cm.getPlayer().getMapId() == 680000000) {
cm.sendYesNo("Hey, would you like to go back to Henesys?");
}else{
cm.sendOk("I'm doing good here.");
cm.dispose();
}
}
function action(mode, type, selection) {
if (mode > 0) {
cm.sendOk("Alright then, enjoy your stay there. Come back to me from there if you want to ever head back.");
cm.warp(680000000, 0);
else{
cm.sendOk("Alright then, I will take you back.");
cm.warp(100000000, 0);
}
cm.dispose();
}else{
cm.sendOk("Ok then. Come back when you are interested.");
cm.dispose();
}
}
Hey, I read this and it helped a LOT. Made my first NPC, and it worked ^^
But I tried making a second, and I can't click on the NPC. I tried editing it alot, nothing.
What did I do wrong, I know it's something with the elses and if's when I got to the selections....PHP 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.sendSimple("Hey, I exchange mesos for items!\r\n#b#L0#I want to exchange one billion mesos for one #i4031545##l");
cm.sendDispose();
}
if (selection == 0) {
cm.sendOk("Are you sure you want to trade?");
cm.getMeso(1000000000);
}
else {
cm.sendOk("You don't have enough mesos.");
cm.dispose();
}
else if (status == 1) {
if (selection == 0) {
if (cm.getMeso(1000000000));
cm.gainItem(4031545, 1);
cm.gainMeso(-1000000000);
cm.dispose();
}
}
}
}
Please and thanks!
Hey,
I really liked your tutorial and it helped me out alot. But when I try to add the script into a npc, i get an error that says : You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntac to use near 'var status = 1' at line 1
I got this even with the simple npc you made, so it can't be the script!?
I hope you guys can help me =)
Thank you! ;D
Heey I cant get this script to work, can you guys help me??
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 == 0) {
cm.dispose();
return;
}
if (mode == 1)
status++;
else
status--;
if (status == 0) {
cm.sendYesNo("I can make you a Female... LOL. Are you ready? (Remember THAT you need to Change Channel, That Way the Sex Transfer Will Be Succesfull)");
} else if (status == 1) {
if (cm.getMeso() >= 20000000);
cm.gainMeso(-20000000);
cm.getChar().setGender(1);
cm.sendOk("Alright, we're done.");
cm.dispose();
else
cm.sendOk("You don't have enough mesos")
cm.dispose();
}
}
}
PHP Code:function start() {
cm.sendYesNo("I can make you a Female... LOL. Are you ready? (Remember THAT you need to Change Channel, That Way the Sex Transfer Will Be Succesfull)");
}
function action(mode, type, selection) {
if (mode == -1) {
cm.dispose();
return;
} else if (mode == 0) {
cm.sendOk("Alright, come back when you change your mind.");
cm.dispose();
}else{
if (cm.getMeso() >= 20000000) {
cm.gainMeso(-20000000);
cm.getChar().setGender(1);
cm.sendOk("Alright, we're done.");
}else{
cm.sendOk("You don't have enough mesos");
}
cm.dispose();
}
}