Welcome Guest ( Log In | Register)



2 Pages V   1 2 >  
Closed TopicStart new topic
> Runescape 2 Private Server: Code/guide 1, Creating a wilderness training zone.
nol
post Jun 3 2007, 04:34 PM
Post #1


Super Member
*********

Group: [HOSTED]
Posts: 257
Joined: 27-May 07
Member No.: 43,758



Purpose: To make a cool training area in the wild.

Difficulty: 1-3

Classes Modified:Client.java, shop.cfg, autospawn.cfg, npchandler, item2.java, shop.cfg

Assumed Knowledge: Copy/paste, basic knowledge of cases, and how to search.

Credits: 10% fedexer(global object tut), 10% to my friend for teaching me how to make monsters drop random things, 80% me for the idea, and comming up with it.

REQUIREMENTS: Make sure that your server can use herblore, mining, woodcutting, theiving, and prayer. You must also have fedexer's global objects code.

Other This is my first tutorial, so please give me comments, I hope everyone likes (I used pimpscape/phonescape as server base)

Step one

Open up client.java, search for case 409, if you don't have it refer to 1a just below, if you do, replace it with this:

CODE
case 409:
case 10638:
if(actionTimer == 0) {
sendMessage("You start praying..");
addSkillXP((7000*playerLevel[5]), 5);
addItem(4832, 1);
setAnimation(1979);
actionTimer = 15;
sendMessage("The gods hear you and reward you!");


note: I did not make this code, just make sure its there, then change the 7000, to any exp you wish for a player to get when prayer at the altar

1a. if you don't have it, search for
CODE
case 2643:


add it after that.

Step two

Search for
CODE
public void OBJECTS()


(still in client.java)
you should see something like this:

CODE
Addaobject(3255,3431,2213,2,10,0);// something


after the last one of those add this

CODE
Addaobject(3151,3673,2213,-3,10,0);// Bank booth wild
                Addaobject(3151,3674,2213,-3,10,0);// Bank booth wild
                Addaobject(3151,3675,2213,-3,10,0);// Bank booth wild
                Addaobject(3151,3676,2213,-3,10,0);// Bank booth wild
                Addaobject(3151,3677,2213,-3,10,0);// Bank booth wild
                Addaobject(3151,3678,2213,-3,10,0);// Bank booth wild
        Addaobject(3157,3666,409,0,10,0);// Prayer Altar = EXP
        Addaobject(3139,3675,2106,0,10,0);// Rune Rocks
        Addaobject(3142,3671,2106,0,10,0);// Rune Rocks
        Addaobject(3139,3678,2106,0,10,0);// Rune Rocks
        Addaobject(3146,3667,2106,0,10,0);// Rune Rocks
        Addaobject(3146,3673,2105,0,10,0);// Addy rocks
        Addaobject(3145,3676,2105,0,10,0);// Addy rocks
        Addaobject(3143,3679,2105,0,10,0);// Addy rocks
        Addaobject(3141,3677,2105,0,10,0);// Addy rocks
        Addaobject(3139,3678,2105,0,10,0);// Addy rocks
        Addaobject(3143,3667,2103,0,10,0);// Mith Rocks
        Addaobject(3141,3667,2103,0,10,0);// Mith Rocks
        Addaobject(3143,3664,2103,0,10,0);// Mith Rocks
        Addaobject(3146,3669,2103,0,10,0);// Mith Rocks
        Addaobject(3148,3672,2103,0,10,0);// Mith Rocks
        Addaobject(3140,3671,2096,0,10,0);// Coal
        Addaobject(3145,3678,2096,0,10,0);// Coal
        Addaobject(3145,3675,2096,0,10,0);// Coal
        Addaobject(3145,3673,2096,0,10,0);// Coal
        Addaobject(3145,3671,2096,0,10,0);// Coal
        Addaobject(3142,3673,2096,0,10,0);// Coal
        Addaobject(3143,3676,2096,0,10,0);// Coal
        Addaobject(3144,3675,2096,0,10,0);// Coal
        Addaobject(3143,3673,2096,0,10,0);// Coal
        Addaobject(3143,3674,2096,0,10,0);// Coal
        Addaobject(3166,3673,1306,0,10,0);// Magic Tree
        Addaobject(3171,3662,1306,0,10,0);// Magic Tree
        Addaobject(3179,3669,1306,0,10,0);// Magic Tree
        Addaobject(3179,3679,1306,0,10,0);// Magic Tree
        Addaobject(3151,3684,2562,0,10,0);// Gem Stall
        Addaobject(3155,3673,2562,0,10,0);// Portal 1
        Addaobject(3157,3673,2467,0,10,0);// Portal 2
        Addaobject(3159,3673,2562,0,10,0);// Portal 3
        Addaobject(3159,3666,859,0,10,0);// Skull on post
        Addaobject(3156,3666,859,0,10,0);// skull on post


REMEMBER PORTAL 1 2 3
Step three

Open up autospawn.cfg

at the bottom add this:

CODE
//Wild training camp//
spawn = 557    3171    3664    0    3171    3664    3171    3664    1    Herblore Shop
spawn = 542    3179    3681    0    3179    3681    3179    3681    1    Wildy Rogue Shop
spawn = 559    3149    3668    0    3149    3668    3149    3668    1    Mining shop
spawn = 1615    3158    3678    0    3158    3678    3158    3678    2    Abyssal Demon - 87
spawn = 1615    3172    3686    0    3172    3686    3172    3686    2    Abyssal Demon - 88
spawn = 1615    3161    3683    0    3161    3683    3161    3683    2    Abyssal Demon - 89
spawn = 1615    3177    3665    0    3047    10343    3047    10343    2    Abyssal Demon - 90
spawn = 1615    3175    3660    0    3046    10341    3046    10341    2    Abyssal Demon - 91


Step four

Open up shops.cfg
add these shops:

CODE
shop = 19    Mining_Shop                         2    2    1265    100    1267    100    1269    100    1273    100    1271    100    1275    1    5013    100    
shop = 17    Herb_Shop                    2    2    257    100    251    100    231    100    255    100    199    100    249    100    233    100    233    100    227    1000
shop = 27    Wilderness_Rogue_shop               2    2    5553    10    5554    10    5555    10    5556    10    5557    10    1712    100


Step 5
Open up client.java again for one last time. Remember the portal 1,2,3? We are now gonna add it so it teles you somewhere.

Search for OBJECT CLICK ONE and add:
CODE
if (objectX == 3155 && objectY == 3673) // Wild Training Portal 1
                          {
                          teleportToX = THE X TELE CORD;
                          teleportToY = THE Y TELE CORD;
                          }
                          if (objectX == 3157 && objectY == 3673) // Wild Training Portal 2
                          {
                          teleportToX = THE X TELE CORD;
                          teleportToY = THE Y TELE CORD;
                          }
                          if (objectX == 3159 && objectY == 3673) // Wild Training Portal 3
                          {
                          teleportToX = THE X TELE CORD;
                          teleportToY = THE Y TELE CORD;
                          }


Step 6

Heres the final step. This step will add drops to the abyssal demons

FIRST

open up NPChandler.java

search for Abyssal, if you do not have it already add this:
CODE
}
if(npcs[NPCID].npcType == 1615) {
ItemHandler.addItem(Item2.randomAbyssal(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);
}


NEXt open up item2.java, search for this

public static int abyssal

if you don't have it, then add it (go down more)

if you do have it, delete it.

So now you shouldn't have it.

Add this in place of it:

CODE
public static int abyssal[] = {995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995
,995,995,995,995,995,995,995,995,995
,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995,995
,995,995,995,995,995,995,995,995,995,995,995,995,3140,3140,3140
,3140,4131,4131,4131,4131,4131,4131,4131,4131,4151,4151,4151,4151,4151,4151,4151
,4151,4151,4151,4151,4151,4151,4151,4151,4151,4151,4151,4151,
4151,4151,4151,4151,4151,4151,4151,4151,4151,4151,4151,4151,4151,4088,4088,4088,
4088,4088,4088,4088,4088,4088,4088,4088,4088,4088};

    public static int randomAbyssal()
    {
        return abyssal[(int)(Math.random()*abyssal.length)];
    }



All done smile.gif Thanks for those who made tuts to help me out with this.

The training place is in Carrallangar, which is a ancient teleport. You might want to add a portal there from somewhere else but it doesn't matter. ENJOY smile.gif

Please give some comments, ive been making this for awhile now...finally pulled it together with my friend figuring out drops



theres more to see tho of course tongue.gif


NOTE: my name is andrew1234321 on moparscape forums, incase u see that account that posted this, if you don't beleive me I can confirm it there.

TUTORIAL NUMBER 2!!!

Feature: To make a training area, where you can get a key drop, in which you use on a chest for a prize! Also other training things.

Server Base: Enrit 2.0 (unreleased) should work on any though

Assumed Knowledge: Copy and Pasting, and fedexer's global object tut. Also the skill of reading might help.

Difficulty: 1-3

Credits:
Nwfd1025 for allowing me to use some of his easter egg hunt minigame
Fedexer for his global objects tut
Me for putting this all together/doing coding

------------------------

First open up your client.java, search for

CODE
public void Deleteobjects() {


Add these after the last deletethatobject.

CODE
deletethatobject(2513, 3371); //TRAINING
        deletethatobject(2516, 3370); //TRAINING
        deletethatobject(2514, 3369); //TRAINING
        deletethatobject(2511, 3373); //TRAINING
        deletethatobject(2509, 3371); //TRAINING
        deletethatobject(2505, 3370); //TRAINING
        deletethatobject(2507, 3370); //TRAINING
        deletethatobject(2514, 3368); //TRAINING
        deletethatobject(2511, 3365); //TRAINING
        deletethatobject(2515, 3365); //TRAINING
        deletethatobject(2514, 3367); //TRAINING
        deletethatobject(2511, 3369); //TRAINING
        deletethatobject(2507, 3368); //TRAINING
        deletethatobject(2510, 3367); //TRAINING
        deletethatobject(2508, 3366); //TRAINING
        deletethatobject(2516, 3378); //TRAINING
        deletethatobject(2516, 3377); //TRAINING
        deletethatobject(2515, 3379); //TRAINING
        deletethatobject(2517, 3379); //TRAINING


Now go find your commands, add this one

CODE
else if (command.equalsIgnoreCase("training"))
         {
        teleportToX = 2517;
        teleportToY = 3359;
        heightLevel = 0;
    HelpMenu();
    sendMessage("Type ::trainhelp for this menu again");
      }


change command name to w/e you wish it to be.

Now open up autospawn.cfg..

add this at the end

CODE
//Training//
spawn = 110    2517    3377    0    0    0    0    0    1    Fire giant
spawn = 110    2515    3371    0    0    0    0    0    1    Fire giant
spawn = 110    2510    3374    0    0    0    0    0    1    Fire giant
spawn = 110    2508    3377    0    0    0    0    0    1    Fire giant
spawn = 110    2506    3371    0    0    0    0    0    1    Fire giant


Now open up your client.java again

Find case 75, replace with this:

CODE
case 75:
if (playerHasItem(4273) == true){
deleteItem(4273, getItemSlot(4273), 3);
addItem(962, 1);
sendMessage("The key's vanish...");
sendMessage("Congrats on the reward!");
} else {
sendMessage("You need 3 keys to claim a reward!");
}


Search for FishingHelpMenu under the last } add

CODE
public void HelpMenu()
    {

                    sendQuest("@dre@Training Area Help Menu", 8144);  //Title
                    clearQuestInterface();
                    sendQuest("@dre@First kill the Fire giants for a key", 8145);
                    sendQuest("@dbl@Once you have 3 of the keys use@dbl@", 8148);
                    sendQuest("@dbl@them on one of the chests@dbl@", 8149);
                    sendQuest("@dbl@They will be deleted from your inventory@dbl@", 8150);
                    sendQuest("@dbl@You should now get a reward!!!@dbl@", 8151);
                    sendQuest("@dbl@Code Created by Nate@dbl@", 8153);
                    sendQuest("@dbl@who goes by andrew1234321 on moparscape forums@dbl@", 8154);
                    sendQuestSomething(8143);
                    showInterface(8134);
                    flushOutStream();
    }

(if you doubt i made this, because it says created by nate, don't, because my name is seriously nate, but for some reason i was stupid and signed up as andrew1234321)

Now search for rules until you find this

CODE
else if (command.equalsIgnoreCase("rules"))
    {
        
    menuMaker("@blu@rules", "rules");


now above/below it put

CODE
else if (command.equalsIgnoreCase("trainhelp"))
    {
        
        HelpMenu();    
    }



now, its time to get into the better part of this code.
Open up npchandler.java

search for "abyssal"

add this UNDER it

CODE
if(npcs[NPCID].npcType == 110) {
ItemHandler.addItem(Item2.randomFg(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);
}


now open up item2.java, search abyssal, and add this under it

CODE
public static int Fg[] = {7158,7158,7158,7158,7158,7158,7158,7158,7158,7158,7158,
7158,7158,6740,6740,6740,6740,6740,6740,6740,6740,6740,6740,6740,6740,6740,4087,
4087,4087,4087,4087,4087,4273,4273
,4273,4273,995,995,995,995,995,995,995,995,995,995,4273,4273};
    public static int randomFg()
    {
        return Fg[(int)(Math.random()*Fg.length)];
    }


Now to get down to the making of global objects.

Search for
CODE
public void OBJECTS()


Add these



CODE
Addaobject(2512,3363,75,0,10,0);// Chest
        Addaobject(2511,3363,75,0,10,0);// Chest
        Addaobject(2510,3363,75,0,10,0);// Chest




enjoy smile.gif)

TUTORIAL NUMBER 3

Purpose: To create Menu's
Skill level: Regular people - 1/10, mentally unstable - 10/10
Needed knowledge: Find function + Copy/Paste

This tutorial is very simple if followed correctly

First you must decide one of the following (if you pick letter a, follow all steps ending with a, ex: 1a)
A: Do a command to tele you somewhere, when teleing you open the menu(automatically opens menu when you use the tele command
B: Use a command to open the menu

SEARCH FOR EVERYTHING IN client.java

A

1. search for
CODE
else if (command.equalsIgnoreCase

add this under the last }

CODE
else if (command.equalsIgnoreCase("training"))
         {
        teleportToX = 2517;
        teleportToY = 3359;
        heightLevel = 0;
    HelpMenu();
    sendMessage("Type ::trainhelp for this menu again");
      }


change the teleportToX/Y to the X/Y coordinates u want to tele to, change training to name of command (in this case, you will type ::training to open up the menu) change HelpMenu to another name, (make sure the (); is still at end) change the message to any mesage you want when opening, if you don't want a message, simply take away that line. REMEMBER WHAT YOU PUT IN PLACE OF HelpMenu (this is CaSe SeNsItIv3)

Next go back to the top of client.java and search for:

public void

till you find something that is like


public void ModMenu()

or something VERY close

add this under the last }

CODE
public void HelpMenu()
    {

                    sendQuest("@dre@Training Area Help Menu", 8144);  //Title
                    clearQuestInterface();
                    sendQuest("@dre@First kill the Fire giants for a key", 8145);
                    sendQuest("@dbl@Once you have 3 of the keys use@dbl@", 8148);
                    sendQuest("@dbl@them on one of the chests@dbl@", 8149);
                    sendQuest("@dbl@They will be deleted from your inventory@dbl@", 8150);
                    sendQuest("@dbl@You should now get a reward!!!@dbl@", 8151);
                    sendQuest("@dbl@Code Created by Nate@dbl@", 8153);
                    sendQuest("@dbl@who goes by andrew1234321 on moparscape forums@dbl@", 8154);
                    sendQuestSomething(8143);
                    showInterface(8134);
                    flushOutStream();
    }


change all the text to you want, each one of those is a new line. the 8154); or w/e at the end tells you what line, if you wish to add more add this:

sendQuest("@dbl@who goes by andrew1234321 on moparscape forums@dbl@", 8154);

make sure you change the number to 1 higher or 2 or 3 depending on how much you wanna do, or you can delete them.

Change public void HelpMenu to what you changed HelpMenu to before..

CONGRATS! you made your first menu!

B

if you just wish to create a command to open the menu, without teleporting, do this:

1. search for
CODE
else if (command.equalsIgnoreCase

add this under the last }

CODE
else if (command.equalsIgnoreCase("training"))
         {
    HelpMenu();
    sendMessage("Type ::trainhelp for this menu again");
      }


Take away sendmessage line if you dont want a message, and make sure you remember HelpMenu, change it to what you want, change "training" to what you want, then go to letter A and follow through with what it says! (dont add the command in letter A)


Enjoy this quick tut i just whipped up!

TUTORIAL NUMBER 4

Purpose: To teach about commands and creating them!
Skill level needed: 1/10
Knowledge needed: Copy/Paste

with all of the following types of commands, please search
CODE
if (command.startsWith(

and add what is needed after the first }

First I will start with TELE COMMANDS

Tele commands are pretty simple, they are used for quickly teleporting, and giving you ways to teleport without giving experience points.

CODE
if (command.equalsIgnoreCase("commandname"))
    {
        teleportToX = X Coordinate;
        teleportToY = Y Coordinate;
                heightLevel = 0;
    }


Please add this code after the first }, fill out the command as necisary, such as X would be the X coordinate, and Y would be the Y coordinate, command name would be the command name, so if u left it like this, ::commandname would execute the command.

Next I will explain Level COMMANDS

these commands add a certain level to the given user, when wanted.
CODE
if (command.equalsIgnoreCase("train") && (playerRights >= 3))
{
addSkillXP(14000000, 0);
addSkillXP(14000000, 1);
addSkillXP(14000000, 2);
addSkillXP(14000000, 3);
addSkillXP(14000000, 4);
addSkillXP(14000000, 5);
addSkillXP(14000000, 6);
sendMessage("Enrit Has Trained U to A Master");
}


this command is simple, i will explain the first line
CODE
addSkillXP(14000000, 0);

the 0 represents the skill number, in this case its attack, the 14000000 is the experience added.

Here is a list of skills and their numbers:
CODE
Attackxp = 0
Strengthxp = 2
Defencexp = 1
Hitpointsxp = 3
Prayerxp = 5
Magicxp = 6
Rangexp = 4
Runecraftxp = 20
Herblorexp = 15
Agilityxp = 16
Craftingxp = 12
Fletchingxp = 9
Slayerxp = 18
Miningxp = 14
Smithingxp = 13
Fishingxp = 10
Cookingxp = 7
Firemaking = 11
Woodcutting = 8
Farming = 19

ITEM COMMANDS

these add items to the user's inventory, just simply add this command

CODE
else if (command.startsWith("command name"))
{
addItem(itemID,NUMBER);

}


Just fill out the command like normal

ADDING IT SO YOU MUST BE X LEVEL TO EXECUTE THE COMMAND

Simply add this to the command, nothing really hard, pretty simple, just add it! Add it at the end of the first line of the code, make sure to take away the last ) and replace it with a space, otherwise you will get errors
CODE
&& playerRights >= 0)

change the 0 to 1,2,3,or keep it 0

0 = regular user
1 = mod
2 = admin
3 = owner

most people don't add it if its for a regular user, because its already programmed this way.


TUTORIAL NUMBER 5


Purpose: Learn about cases
Skill level: 5/10

This isnt a copy paste tutorial, so you REALLY have to know what your doing. This isn't for the beginers, it took me awhile to learn this myself, but it works tongue.gif and its fun adding things to weird items. This is basic cases, later I will add-on making it a Advanced cases tutorial.

What are cases? They are things your server calls apon when clicking a object. Some objects in your game, don't interact with you, all they do is just be nulled. this isn't very good use for them now is it? How bout you create a way make it better!

1. Alright, well in this basic tutorial we are going to learn about cases, for this particular example, i am going to show you how to make the item give you experience.

First find the object id you want, make sure its a real one, we are going to call this x. Now in your client.java file, search for
CODE
case x:

make sure "x" is replaced with the correct number. Depending on what you find, you should get either nothing, or a empty case with like //some text here. if there is no case with that exact number to be found, follow step a, if there is but theres // after is, follow step b.

Step A

If there is nothing like that case to be found search for
CODE
case 409:


if that isnt to be found search for

CODE
/*OBJECT CLICK ONE*/


Add this case under it

CODE
case x:
if(actionTimer == 0) {
sendMessage("message 1");
addSkillXP((xpyouget*playerLevel[skill number]), skill number);
addItem(ITEM ID, Number of items);
setAnimation(1979);
actionTimer = 15;
sendMessage("message 2");
}
break;


Change Message 1 + 2 to whatever, or you can get rid of those lines.

Change the skill xp line to fit your needs (make sure the * is still there)

change case x to your case number, change the add item stuff, if you dont want to add a item, then delete that line

if your really advanced, change the setAnimation number to what you want, you must have a list for this but I don't have it sorry.

Its pretty basic

Step B

if you do have case x, then do the last part of step A and delete your case x before actually starting. And enjoy easy cases smile.gif

This post has been edited by nol: Jun 6 2007, 08:29 PM
Go to the top of the page
 
+Quote Post
TripleH13
post Jun 3 2007, 04:36 PM
Post #2


Privileged Member
*********

Group: Members
Posts: 623
Joined: 26-August 05
Member No.: 11,160



thanks for this. I was interested in doing this but it seemed very complicated. Still seems very complicated but this step by step will certainly help so thanks again.
Go to the top of the page
 
+Quote Post
nol
post Jun 3 2007, 08:41 PM
Post #3


Super Member
*********

Group: [HOSTED]
Posts: 257
Joined: 27-May 07
Member No.: 43,758



To be honest, I knew no java what so ever when i started coding servers, nothing but html. Now its so much easier tongue.gif you'll get the hang of it, I can make more tutorials if you want too.
Go to the top of the page
 
+Quote Post
robocz033
post Jun 5 2007, 08:56 PM
Post #4


Premium Member
********

Group: Members
Posts: 165
Joined: 28-April 07
From: Where ever i feel appropriate
Member No.: 42,321



thats how i was too, then coding servers really helped me learn java. so now i know like 4 languages and learning 1 more.
Go to the top of the page
 
+Quote Post
nol
post Jun 21 2007, 10:59 PM
Post