- Joined
- Jul 21, 2008
- Messages
- 124
- Reaction score
- 47
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.
@ 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.
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:
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:
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();
}
}
}
}
}
Last edited:

