Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomeSearchLatest imagesRegisterLog inwebclient

 

 RSPS Ultimate Beginner Guide.

Go down 
AuthorMessage
The Danzor

Moderator


Moderator
The Danzor


Posts : 49
Join date : 2010-04-23
Age : 27
Location : Use your imagination ^^

RSPS Ultimate Beginner Guide. Empty
PostSubject: RSPS Ultimate Beginner Guide.   RSPS Ultimate Beginner Guide. I_icon_minitimeMon Apr 26, 2010 8:13 am

NO! This is not HOW to make a server......

1. ----- Adding Npc's -----
2. ----- Adding Objects -----
3. ----- Deleting Objects -----
4. ----- Item On Item -----
5. ----- Item On Object -----
6. ----- Cases for Objects -----
7. ----- Adding Menus -----
8. ----- Item Requirements -----
9. ----- Chests Giving Random Items -----
10.----- Npc Drops -----

Purpose = To Put All Tutorials Into One, I Know There Have Been A Lot Of These Before But You Still Get People Asking Questions On Really Basic Things So I Will Try To Explain Them Here. Dont Post If You Think This Is Just Another Nooby Tutorial. I Wont Go Into Detail In Coding A Server, But This Should Explain How To Add NPC's, Add Objects, Add Item On Item, Item on Object, Cases, Adding Menus, Adding Requirements To Things, Chests Giving Random Items, Npc Drops. Therefore, If You Know All This Dont Post If You Think Its Rubbish. Hopefully It Will Actually Help Someone. This isn't a Copy & Past Tutorial As I Will Explain What Things Happen

----- Adding Npc's -----
All Current Servers Have A File Called Autospawn.cfg. This Is Where All NPC's Are Stored In Your Server Therefore Open This And You Should See A List Of Npc's Like The One Below. Example;

Code:

spawn = 461   2844   3351   0   0   0   0   0   1   Rune Store

Now I Will Explain Each Part Of This
Code:

spawn = 461

This Is Telling You What Npc You Want To Spawn, In This Case It Would Be The Npc 461. To Check All The Other Npc ID's Go Into Your NPC.Cfg File, Hit Ctrl+F and Type In The Name Of The Npc Your Looking For Then Just Copy Their ID.

Code:

2844 3351

These Are The X And Y Coordinates Of Where You Want The Npc To Spawn In Your Server, Some Servers Should Have A Command Already In Them Such As ::mypos Or Have Your Coordinates Displayed In The Emotes Menu.

Code:
0   0   0   0   0   1

This Is More Difficult In Explaining, This Code Tells You Where Or If You Want The Npc To Move Around. At The Moment The Npc Would Not Move Because There Are No Coordinates Entered And "Walktype" Is Set To 1 Which Is Stationary. I Have Added An Example To Show You What A Moving NPC Should Have

Code:

spawn = 1156   3497   9505   0   3490   9500   3500   9520   2   Kalph Worker

If You Want The NPC To Move Then Change "Walktype" Into 2 And Then Change The X And Y Positions To How Far You Want The Npc To Walk. The First X and Y Positions Are ALWAYS Smaller Than The Set Coordinates, The Other 2 X and Y Positions Are ALWAYS Bigger.

----- Adding Objects -----
If You Want To Delete Or Add New Global Objects Then You Should Open Your Client.java file. This Will Only Work If Your Server Already Has Global Objects Added, Which All Newly Posted Servers Should Have. Hit Ctrl + F And Find This;

Code:

NewObjects() {

Under This You Should See One Of These Two;

Code:

         makeGlobalObject(XXXX, YYYY, ID, DIRECTION, 10)


Code:

         addGlobalObject(XXXX, YYYY, ID, DIRECTION, 10)

Example;


Code:
         makeGlobalObject(2853, 3348, 6552, -1, 10);//altar

Explenation;

Code:
(XXXX, YYYY

These Are Simply Just The X and Y Coordinates Of Where You Want Your Globalobject To Be Placed.


Code:
, ID,

Go Find The ID Of The Object You Want To Add And Put It In Here.

Code:
, DIRECTION,

This will determine which way your object will face.


Code:
10)

This tells you what the thing you are adding, if your only adding Objects Then DO NOT change it otherwise it wont work.

----- Deleting Objects -----
To Delete Global Objects Go Into Client.java, Hit Ctrl + F And Search For This
Code:

Deleteobjects() {

Then Scroll Down And You Should See Something Like This
Code:

Code:
           deletethatobject(2785, 3175); //plant

This Is Much Simpler Than Adding Objects As All You Need To Do Is Enter The X & Y Coordinates Of The Object You Want To Delete. NOTE: If You Delete An Object You Will Not Be Able To Place A New Object In The Position Of The Deleted Object, If You Want To Place A New Object Simply Add That Object As It Will Automatically Change The Object Thats In Its Place.

----- Item On Item -----
Item On Item Is Simply What It Is, You Use A Certain Item On Another Item And That Can Give Anything From Money, Any Other Item, Exp, Messages etc. Go Into Your Client.java (If Your Server Has A Text File With Item on Items Then Open That) And Under Any Command You Can Add This


Code:
            else if(itemUsed == 243 && useWith == 233) {
               deleteItem(243, getItemSlot(243), 1);
               addItem(241, 1);
            }

Explenation;

Code:

         else if(itemUsed == 243 && useWith == 233) {

This Is Just Telling Which Items Will Be Used Together. However, This Will Only Go One Way. You Will Need To Create Another One Of These If You Wanted The Item 233 To Be Used With Item 243. At This Time Only 243 Can Be Used With 233.

Code:
               deleteItem(243, getItemSlot(243),

1);
This Is Telling You That When You Use The Two Items That The Item 243 Will Be Deleted From Your Inventory.

Code:
               addItem(241, 1);

When You Use The Two Items Together You Will Receive The Item 241. If Your Wondering, I Used This For Herblore When Your Adding Herbs To The Vial Of Water.

This Is As Simple As It Gets, If You Want Anything Else You Should Try It On Your Own, All I Have Done Is Just Explained What Will Happen When You Use Two Items. You Can Also Add Messages, Requirements And Much More. Just So You Know What It Looks Like I Have Posted An Example Of A Much Complicated Item On Item Below:


Code:
            else if(itemUsed == 99 && useWith == 231) {
               if(playerLevel[15] >= 28) {
                  deleteItem(99, getItemSlot(99), 1);
                  deleteItem(231, getItemSlot(231), 1);
                  addItem(139, 1);
                  addSkillXP(20000, 15);
               } else {
                  sendMessage("You need a higher herblore level to make this potion.");
               }

----- Item On Object -----
This Is Also Simple, You Use A Certain Item On A Certain Object And That Can Teleport You, Give You Items, Exp, Open Interfaces etc. First, Go Into Your Client.java, Hit Ctrl + F And Find This


Code:
+atObjectID+" atObjectY: "+atObjectY+" itemS

IF When You Searched For The Code Above And You Couldn't Find Anything Like It Then Try Find This

Code:

atObjectID ==
You Should Find Something Like This


Code:
                                if (useItemID == ITEMID && atObjectID == OBJECTID)
                                {
            teleportToX = XXXX;
            teleportToY = YYYY;
                                sendMessage("---- YOUR MESSAGE -----");
                                sendMessage("---- YOUR MESSAGE 2 ---");
                                }

This Is A Simple Item On Object, Again, You Can Make It Much More Complex By Adding Things Such As Exp, Level Requirements etc. Its Telling You That When You Use That Item On That Object You Will Be Teleported And Then You Will Get Two Messages On Your Chat Box.


----- Cases for Objects -----
Cases Represent Objects That Work On Their Own i.e. Portals. Again, You Can Make A Case Very Simple By Adding Certain Messages Or Make It More Complicated. Go Into Your Client.java and Find This

Code:

//QUEST_1 OBJECTS

If You Cannot Find It In Your Server Then Simply Find A Object That Makes You Do Something i.e. Haystacks And Search For Their Case. So Haystacks Would Be Case 300; Because The Object ID Of The Haystack Is 300.
Underneath What You have Just Found You Should See A Lot Of Cases, Find The Object ID You Want To Use (Make Sure The Object Is Usable) And Then Simply Name it "Case OBJECTID;". Example;


Code:
case 4499:
break;

You Should always add a "break;" to show that you are ending that code. Thats it, nothing is added yet so lets add a teleport to this case.

Code:
case 4499:
teleportToX = XXXX;
teleportToY = YYYY;
break;

This will teleport you to those coordinates when you click on that object. This is at its simplest and it can be used for a ladder or portal. I have coded in a custom castle wars minigame and i used cases for my portals. This is an example of what i coded.

Code:
case 4388: // zammy home
if (playerHasItem(4513) == true && playerHasItem(4514) == true){
sendMessage("You cannot enter with other god items.");
sendMessage("They have been removed.");
deleteItem(4513, getItemSlot(4513), 1);
deleteItem(4514, getItemSlot(4514), 1);
teleportToX = 2441;
teleportToY = 3090;
} else {
if (playerEquipment[playerCape] == 4514 && playerEquipment[playerHat] == 4513) {
sendMessage("You cannot enter with zammy items.");
sendMessage("Please use the bankbooth and store them safely.");
} else {
if (playerEquipment[playerCape] == 4516 && playerEquipment[playerHat] == 4515) {
teleportToX = 2422;
teleportToY = 9526;
sendMessage("You are teleported to the waiting arena.");
sendMessage("Use the portal to begin castle wars.");
} else {
if (playerHasItem(4516) == true && playerHasItem(4515) == true){
sendMessage("Please put on your cape and hat.");
} else {
if (playerHasItem(4516) == false && playerHasItem(4515) == false){
addItem(4515, 1);
addItem(4516, 1);
sendMessage("You get your hat and cape.");
}
}
}
}
}
break;

Feel free to use this, to explain what this does. If The Other Player Has The Opposing God Items On Or In Their Inventory They Will Be Removed. If The Player Does Not Have A Cape Or Hood They Will Get One And By Only Allowed To Enter If They Wear It. Like I Said You Can Add Anything To Cases .

----- Adding Menus -----
In This Part I Will Only Show You How To Add A Menu When You Click On The Skill Icon. Feel Free To Use This If You Need To But I Wont Tell You All Of The Menus. To add a menu so when you click on a skill icon it opens go into your client.java and find

Code:
case 21234: // Burst Of Strength

Above that you should see a line and then above that line you can add all the cases for skill menus.


Code:
case 2161: // attackskillmenu
{
Attackskillmenu();
}
break;

This is just an example of one, the attack skill menu. To add a working menu find this

Code:
public void updatePlayers()

If you using a prviously coded server then when you scroll down you should see already made menus. Then just add this one under the last }.


Code:
   public void Attackskillmenu()
   {

               sendQuest("", 8144);  //Title
               clearQuestInterface();
               sendQuest("", 8145);
               sendQuest("", 8149);
               sendQuest("", 8151);
                    sendQuest("", 8152);
               sendQuest("", 8153);
               sendQuestSomething(8143);
               showInterface(8134);
               flushOutStream();
            }

In the title box enter the name of the skill menu.

Code:
               sendQuest("", 8145);

This is the title of the page.


Code:
               sendQuest("", 8145);
               sendQuest("", 8149);
               sendQuest("", 8151);
                    sendQuest("", 8152);
               sendQuest("", 8153);

Here you just put in what you want your menu to have. If it has a gap in number that means that there is a space between lines. Just add more numbers if you want to have a bigger menu. If you wanted to have a menu open by command then you could use something like this below;

Code:
if (command.startsWith("Attackskillmenu")) {
Attackskillmenu();
}

----- Item Requirements -----
Here I Will Explain How to Add Item Requirements i.e. 80 attack for d bow. First of all go into your client.java and find this.

Code:
public int GetCLRanged(int ItemID) {

When you search this underneath you should see a lot of these;


Code:

         if (ItemID == 10713) {
         return 99;
   }

This outlines The Item ID (10713) and then the return 99; tells you what level you need to be able to wear it. As this is under Range it means that you need 99 range to be able to wear that specific item. You can find more underneath or above that one for all different levels. ( This may be different on other sources, im using Czar)

----- Chests Giving Random Items -----
Here we can add a chest that will give random items when the person clicks on it. We will need to modify/add two files, item2 and client.java. First of all go into your item2 and search for

Code:
public static int runerock

under the whole thing you should see.

Code:
public static int runerock[] = {451,451,451,451,451,451,451};

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

This tells you that when you click on this particular rock that you will only get the item 451 (rune ore). Dont use this as a base for mining because it sucks.

Code:
public static int runerock[] = {451,451,451,451,451,451,451};

This is showing what you are declaring, you have to rename runerock to anything that you want. Where you have the 451 items you should also delete them. The item on the left hand side will be the most likely item received from the rock and the item furthest right will be the least likely item recieved from the rock.

Code:
    public static int randomRuneRock()
    {
       return runerock[(int)(Math.random()*runerock.length)];

Where you have runerock you would have to change to what you named it in the first code. Heres an example of what a barrows chest would look like.


Code:
public static int Barrows[] = {4708,4710,4712,4714,4716,4718,4720,4722,4724,4726,4728,4730,4732,4734,4736,4738,4743,4745,4747,4749,4751,4753,4755,4757,4759};

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

This is showing you that the item 4708 will be the most likely item received from the chest and that item 4759 will be the least likely.
To add this to a chest go into your client.java and find a case for that chest (look at cases at the top for help)


Code:
case 10284:
addItem(Item2.randomBarrows(), 1);
teleportToX = XXXX;
teleportToY = YYYY;
break;

This would give the person an item from the barrowschest and then teleport them outside.

----- Npc Drops -----
Npc Drops are kind of similar to random chests but Npc Drops aren't added in client.java. First of all, go into your item2 and do thesame thing that you did in random chests. Just copy + paste an already done code and rename it to what you want. You can use this if you want but its just an example.

Code:
public static int NAME[] = {ID,ID,ID,ID,ID,ID,ID,ID};

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

Where you can see NAME change it to what ever you like but it has to be kept the same. Where you can see ID then add item ID's that you want, the one on the left will be the most likely to drop and the one on the right will be the least likely to drop. When you have done that go into your NPChandler and find this.


Code:
npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller

Keep searching until you find something similar to this:

Code:
if(npcs[NPCID].npcType == NPCID) {
ItemHandler.addItem(Item2.randomNAME(), npcs[NPCID].absX, npcs[NPCID].absY, 1, GetNpcKiller(NPCID), false);

Here where you can see NPCID just enter the NPC that when you kill will drop those items. Where You Can see NAME enter the name you entered earlier in item2 so that it can load it here when they die. Thats IT!

And There You Have it. I Hoped This Helped With Any Problems That You Were Having. If You Still Have Problems Post Them Here. NO FLAMING PLS TY!
Back to top Go down
 
RSPS Ultimate Beginner Guide.
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: Corrupted V2 :: Player-Made Guides-
Jump to: