-
Re: [Tut] Learning NPC scripts (beginner's guide)
Quote:
Originally Posted by
get31720
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.
Ah, ok. I just saw that cm.startQuest and wondered.
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'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?)
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.
-
Re: [Tut] Learning NPC scripts (beginner's guide)
Quote:
Originally Posted by
randompeep
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?)
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.
if (cm.getPlayer().getMapId() == mapid) {
credits: moogra lol
-
Re: [Tut] Learning NPC scripts (beginner's guide)
I learn alot from this guide :D
-
Re: [Guide] Learning NPC scripts (beginner's guide)
Good job leeching from GameCheetah. I saw this exact guide on gamecheetah. If your going to steal someones guide atleast give credits.
-
Re: [Guide] Learning NPC scripts (beginner's guide)
Quote:
Originally Posted by
HardStylee
Good job leeching from GameCheetah. I saw this exact guide on gamecheetah. If your going to steal someones guide atleast give credits.
Look at the date :)
-
Re: [Tut] Learning NPC scripts (beginner's guide)
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)
-
Re: [Tut] Learning NPC scripts (beginner's guide)
hi wats the cm.command for getting stats
-
Re: [Tut] Learning NPC scripts (beginner's guide)
@ 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
PHP Code:
p.setStr() // sets 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.
-
Re: [Tut] Learning NPC scripts (beginner's guide)
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
-
Re: [Tut] Learning NPC scripts (beginner's guide)
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();
}
}
}
I'm a freaking bit rusty at scripting,lol. Test if it works and if not,post me the bat error.
-
Re: [Tut] Learning NPC scripts (beginner's guide)
@ 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();
}
}
}
-
Re: [Tut] Learning NPC scripts (beginner's guide)
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.
-
Re: [Tut] Learning NPC scripts (beginner's guide)
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.
-
Re: [Tut] Learning NPC scripts (beginner's guide)
~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?
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();
}
}
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.
-
Re: [Tut] Learning NPC scripts (beginner's guide)
hey bro more screenshots plz and maybe even add a vid of hao to check for an item plz and thnx
-
Re: [Tut] Learning NPC scripts (beginner's guide)
@ 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:
-
Re: [Tut] Learning NPC scripts (beginner's guide)
Quote:
Originally Posted by
get31720
@ 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:
Wow you're still here on RaGEZONE
I would think in a year you would be doing something else o.o
@ontopic I learned a bit from this like the cm.openQuest (or w.e it was o.o)
-
Re: [Tut] Learning NPC scripts (beginner's guide)
@ 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.
-
Re: [Tut] Learning NPC scripts (beginner's guide)
Is there a cm.[Command] for NPC to check whether the player/character have the skill?
-
Re: [Tut] Learning NPC scripts (beginner's guide)
I have a question how do you check if the person has both level and item?
-
Re: [Tut] Learning NPC scripts (beginner's guide)
This is a great tut ty so much
-
Re: [Tut] Learning NPC scripts (beginner's guide)
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!)
-
Re: [Tut] Learning NPC scripts (beginner's guide)
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
-
Re: [Tut] Learning NPC scripts (beginner's guide)
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 ----------
Quote:
Originally Posted by
gotenkvg
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
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);
-
Re: [Tut] Learning NPC scripts (beginner's guide)
Quote:
Originally Posted by
billabonker
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();
}
}
}
}