Re: [Tut] Learning NPC scripts (beginner's guide)
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.
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("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();
}
}
}
}
@ randompeep
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();
}
}
}
}
}
Re: [Tut] Learning NPC scripts (beginner's guide)
@ get -
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();
}
}
Your layout is ugly.
Re: [Tut] Learning NPC scripts (beginner's guide)
sigh... what happened to the days when none of that mattered and all that was important was the script working :(
Re: [Tut] Learning NPC scripts (beginner's guide)
@ 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.
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.
Re: [Tut] Learning NPC scripts (beginner's guide)
Thanks! One other question, how do you create custom quest IDs to make your own quest?
Re: [Tut] Learning NPC scripts (beginner's guide)
Quote:
Originally Posted by
get31720
@ 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.
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.
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.)
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();
}
}
The script works but is it easily readable ? No.
Re: [Tut] Learning NPC scripts (beginner's guide)
Quote:
Originally Posted by
PinkGatsby
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.)
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();
}
}
The script works but is it easily readable ? No.
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.
Re: [Tut] Learning NPC scripts (beginner's guide)
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.)
Re: [Tut] Learning NPC scripts (beginner's guide)
Quote:
Originally Posted by
bboy242
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.
I'm pretty sure I've created and fixed more npcs for other people than the thread starter. Remember the NPC helpdesk ? Sigh Shawn, why are you defending this guy
Re: [Tut] Learning NPC scripts (beginner's guide)
@ 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.
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 :)