Snoopy
October 20th, 2010, 06:18
WELL this is for the few of you who want to learn to code, and make a new server. this is just covering the basics like:
adding commands
changing what NPC's say
LETS GET STARTED
..::--~~adding Commands!~~--::..
ok 1st off, open Client.JAVA and hit ctrl + f and search for:
customCommand
it should have this:
private void customCommand(String command)
if(command.startsWith("bonar")){
it may be different with other servers, but this is for delta based which is easiest to code.
BASICALLY, what private void customCommand(string command) means, is its the list of commands u enter with ::#### so yeah everything u enter in there ( i have bonar ) u type liek ::bonar and it fulfils the specifications u enter in "java" scripting.
OK so how u add comannds
after the (string command) press enter fr fresh line. then add:
if(command.startsWith("****")){
replace the ***** with what u want the command to be. so today we'll be adding the "home" command which teleports u home.
k next line. press enter again and add"
toX == ####;
toY == ####;
replace #### with the co-ords of ur home. usually delta has a ::mypos command. if u want edgevill as yo home, here are the co-ords
X = 3087
Y = 3493
so now your command should look like:
if (command.startsWith("home") && playerRights >= 0){
toX = 3087;
toY = 3493;
(dont worry about the && playerRights >= 0){ just yet)
ok now if u want it to say something on personal screen, like saying "welcome home motherfucker" you add this under the last ;
sM("Welcome home motherfucker!");
so when u type ::home that messege pops up.
if u want something the whole world to see, add this:
yell("Some lazy Motherfucker has teleported to HOME");
NOW if u want it to have the playername, add this:
yell(" ["+playerName+"] has teleported HOME");
so once uve done all you want to add to this command, finish it off with this on a fresh line:
}
so your finished command should look like this:
if (command.startsWith("home") && playerRights >= 0){
toX = 3087;
toY = 3493;
sM("home sweet home.");
}
now save and compile.
..::--~~Changing what NPC's say!~~--::..
right so 1st, open NPChandler.JAVA and search for whatever the NPC is saying, so something like "welcome to ***" or whatever something is u want to change. now hit ctrl + f and search for
Code:
"welcome to"
then u might see something sorta like this
if (npcs[i].npcType == 815) {
if (misc.random2(10) == 1) {
npcs[i].updateRequired = true;
npcs[i].textUpdateRequired = true;
npcs[i].textUpdate = "Welcome To SnoopysWorld -Owner Snoopy!";
}
or what ever it is u want to change, then just change it and save.
if u want to add a NPC that says something, under the "}" make a fresh line and add this:
if (npcs[i].npcType == ###) {
if (misc.random2(10) == 1) {
npcs[i].updateRequired = true;
npcs[i].textUpdateRequired = true;
npcs[i].textUpdate = "*****";
}
now on the ### change it to the NPC id u want, and change the **** to the text u want it to say. NEXT go into autospawn.cfg ( in config folder ) and add that npc id on bottom and add the co-ordinates (find them urself) then yeah save that and compile
ADDING MORE SOON
CREDITS:
85% to me for writing it
15% to various tuts helping me learn to code
HOPE THIS HELPS SOME PEOPLE
adding commands
changing what NPC's say
LETS GET STARTED
..::--~~adding Commands!~~--::..
ok 1st off, open Client.JAVA and hit ctrl + f and search for:
customCommand
it should have this:
private void customCommand(String command)
if(command.startsWith("bonar")){
it may be different with other servers, but this is for delta based which is easiest to code.
BASICALLY, what private void customCommand(string command) means, is its the list of commands u enter with ::#### so yeah everything u enter in there ( i have bonar ) u type liek ::bonar and it fulfils the specifications u enter in "java" scripting.
OK so how u add comannds
after the (string command) press enter fr fresh line. then add:
if(command.startsWith("****")){
replace the ***** with what u want the command to be. so today we'll be adding the "home" command which teleports u home.
k next line. press enter again and add"
toX == ####;
toY == ####;
replace #### with the co-ords of ur home. usually delta has a ::mypos command. if u want edgevill as yo home, here are the co-ords
X = 3087
Y = 3493
so now your command should look like:
if (command.startsWith("home") && playerRights >= 0){
toX = 3087;
toY = 3493;
(dont worry about the && playerRights >= 0){ just yet)
ok now if u want it to say something on personal screen, like saying "welcome home motherfucker" you add this under the last ;
sM("Welcome home motherfucker!");
so when u type ::home that messege pops up.
if u want something the whole world to see, add this:
yell("Some lazy Motherfucker has teleported to HOME");
NOW if u want it to have the playername, add this:
yell(" ["+playerName+"] has teleported HOME");
so once uve done all you want to add to this command, finish it off with this on a fresh line:
}
so your finished command should look like this:
if (command.startsWith("home") && playerRights >= 0){
toX = 3087;
toY = 3493;
sM("home sweet home.");
}
now save and compile.
..::--~~Changing what NPC's say!~~--::..
right so 1st, open NPChandler.JAVA and search for whatever the NPC is saying, so something like "welcome to ***" or whatever something is u want to change. now hit ctrl + f and search for
Code:
"welcome to"
then u might see something sorta like this
if (npcs[i].npcType == 815) {
if (misc.random2(10) == 1) {
npcs[i].updateRequired = true;
npcs[i].textUpdateRequired = true;
npcs[i].textUpdate = "Welcome To SnoopysWorld -Owner Snoopy!";
}
or what ever it is u want to change, then just change it and save.
if u want to add a NPC that says something, under the "}" make a fresh line and add this:
if (npcs[i].npcType == ###) {
if (misc.random2(10) == 1) {
npcs[i].updateRequired = true;
npcs[i].textUpdateRequired = true;
npcs[i].textUpdate = "*****";
}
now on the ### change it to the NPC id u want, and change the **** to the text u want it to say. NEXT go into autospawn.cfg ( in config folder ) and add that npc id on bottom and add the co-ordinates (find them urself) then yeah save that and compile
ADDING MORE SOON
CREDITS:
85% to me for writing it
15% to various tuts helping me learn to code
HOPE THIS HELPS SOME PEOPLE