Astaroth Admin


Data inscrierii: 04/Oct/2006 Mesaje: 2640 Localitate: MuZone World!
|
Trimis: 05/05/2007 22:20 Titlul subiectului: Another NPC |
|
|
Basically, this NPC takes money, and once he gets a certain amount of money, something happens. A GM sets what happens as a message. This could be anything from new NPCs added to an event happening.
A gm sets the thing to happen and how much money he needs. Once he gets that amount of money, he sends a message that the money chest is full.
You can only give him money if he hasn't reached his current goal.
This is easily adaptable to take items in lieu of money. For example, you can specify a db amount needed, or a met amount needed. Hell, you can even specify a money amount but allow certain items to be worth a certain amount of money.
| Cod: |
// gimp
// NPC ID: some new one
// Location: Desert 2, in the abandoned city, or desert 1, in the oasis
String[] dlg=null;
switch(option)
{
case -1:
{
String[] tm = null; // so we don't get the "tm may not have been set" error
if (gm() > 0) {
tm = {
"AVATAR 1",
"TEXT The more people donate to me, the quicker things happen.",
"OPTION0 What things?",
"OPTION1 I'd like to donate.",
"OPTION2 How much more money do you need?",
"OPTION10 Set message.",
"OPTION12 Set donate amount.",
"OPTION-1 Get your own money."
};
} else {
tm = {
"AVATAR 1",
"TEXT The more people donate to me, the quicker things happen.",
"OPTION0 What things?",
"OPTION1 I'd like to donate.",
"OPTION2 How much more money do you need?",
"OPTION-1 Get your own money."
};
}
dlg = tm;
break;
}
case 0:
{
String[] tm={
"AVATAR 1",
"TEXT " + globsval("pubworks"),
"OPTION-1 Okay, cool."
};
dlg=tm;
break;
}
case 1:
{
String[] tm = null;
if (globval("pubworks") == 0) {
tm = {
"AVATAR 1",
"TEXT I've already reached my money goal. Thanks anyways.",
"OPTION-1 I see."
};
} else {
tm = {
"AVATAR 1",
"TEXT Please enter the amount you wish to donate below.",
"INPUT3 Donate: ",
"OPTION-1 Nevermind."
};
}
dlg=tm;
break;
}
case 2:
{
String[] tm={
"AVATAR 1",
"TEXT I need " + globval("pubworks") + " more silvers.",
"OPTION-1 Okay, thank you."
};
dlg=tm;
break;
}
case 3:
{
// make sure input is an integer
int x = 0;
try {
val = Integer.parseInt(input);
} catch (Exception e) {
String[] tm = {
"AVATAR 1",
"TEXT The number you put in is not an integer.",
"OPTION12 Sorry, let me try again.",
"OPTION-1 Nevermind then."
}
dlg = tm;
break;
}
int old = globval("pubworks");
if (old - x < 0) {
x += old - x;
}
setglobval("pubworks", old - x);
String[] tm={
"AVATAR 1",
"TEXT Thank you, you have donated " + x + " silvers.",
"OPTION-1 Sweet."
};
dlg=tm;
if (globval("pubworks") == 0) {
atcommand("@gm Public money goal attained.");
atcommand("@gm Public money goal attained.", 60000);
}
break;
}
case 10:
{
if (gm() < 1) {
String[] tm={
"AVATAR 1",
"TEXT Fuck yourself.",
"OPTION-1 Ok."
};
dlg=tm;
break;
}
String[] tm={
"AVATAR 1",
"TEXT What would you like to set the message to?",
"INPUT11 Message: ",
"OPTION-1 Nevermind."
};
dlg=tm;
break;
}
case 11:
{
if (gm() < 1) {
String[] tm={
"AVATAR 1",
"TEXT Fuck yourself.",
"OPTION-1 Ok."
};
dlg=tm;
break;
}
setglobsval("pubworks", input);
String[] tm={
"AVATAR 1",
"TEXT Set.",
"OPTION-1 Thanks."
};
dlg=tm;
break;
}
case 12:
{
if (gm() < 1) {
String[] tm={
"AVATAR 1",
"TEXT Fuck yourself.",
"OPTION-1 Ok."
};
dlg=tm;
break;
}
String[] tm={
"AVATAR 1",
"TEXT How much will the donate value needed be?",
"INPUT13 Amount: ",
"OPTION-1 Nevermind."
};
dlg=tm;
break;
}
case 13:
{
if (gm() < 1) {
String[] tm={
"AVATAR 1",
"TEXT Fuck yourself.",
"OPTION-1 Ok."
};
dlg=tm;
break;
}
// and here's some code to make sure input is an integer
int val = 0;
try {
val = Integer.parseInt(input);
} catch (Exception e) {
String[] tm = {
"AVATAR 1",
"TEXT The number you put in is not an integer.",
"OPTION12 Sorry, let me try again.",
"OPTION-1 Nevermind then."
}
dlg = tm;
break;
}
setglobval("pubworks", val);
String[] tm={
"AVATAR 1",
"TEXT Set.",
"OPTION-1 Thanks."
};
dlg=tm;
break;
}
}
|
script by gimp _________________
 |
|