woahhh thanks man i need this.
will be added!
thanks!
|
|
Description Of HyreScape Server Pet Adding
Description: To add pets to your server and to make your server, helps bring a lot more people to your server.
Difficulty: 7/10
Assumed Knowledge: Copy and paste, change things around.
Tested Server: My Server, HyreScape.
Files/Classes Modified: Client.java, Adding Java Docs, Sever.java, and NPCHandler.java
Before we start I would like to say, I didn’t make this code, this code was made by Ashton. I didn’t leech this. I asked for help and he helped me so much I wanted to post this for that. He is a great coder. And if you are going to rep me, please remember I dident make this. But I did add it to my server and post everything else. Tutorial took me 1 hour to make the whole thing. Also please do not flame me, this is a very great thing and im tired of people dissing on cool things. So if you dont like this, leave it and dont say a word.
To add rep to Ashton please click here: [Only registered and activated users can see links. ]
Ashton’s Profile: [Only registered and activated users can see links. ]
Procedure Of HyreScape Server Pet Adding
Step 1:
Make a new file called Cats.java. Make sure that when you add that file make sure that the C in Cats in capitalized. Then add this into that folder:
[PHP]public class Cats {
public int GetCatNpc(int catitem) {
if(catitem == 1555) return 761;
if(catitem == 1556) return 762;
if(catitem == 1557) return 763;
if(catitem == 1558) return 764;
if(catitem == 1559) return 765;
if(catitem == 1560) return 766;
if(catitem == 1561) return 768;
if(catitem == 1562) return 769;
if(catitem == 1563) return 770;
if(catitem == 1564) return 771;
if(catitem == 1565) return 772;
if(catitem == 1566) return 773;
if(catitem == 7585) return 3507;
return 0;
}
public int GetCatItem(int catnpc) {
if(catnpc == 761) return 1555;
if(catnpc == 762) return 1556;
if(catnpc == 763) return 1557;
if(catnpc == 764) return 1558;
if(catnpc == 765) return 1559;
if(catnpc == 766) return 1560;
if(catnpc == 768) return 1561;
if(catnpc == 769) return 1562;
if(catnpc == 770) return 1563;
if(catnpc == 771) return 1564;
if(catnpc == 772) return 1565;
if(catnpc == 773) return 1566;
if(catnpc == 3507) return 7585;
return 0;
}
}[/PHP]
Step 2:
Go to your client.java and find this:
[PHP]public class client extends Player implements Runnable {[/PHP]
Then add this code right under that:
[PHP]public void SpawnPet(int ID) {
server.client.newPetNPC(ID, absX, absY-1, heightLevel, absX-1, absY-1, absX+1, absY-1, 1, server.npcHandler.GetNpcListHP(ID), false, playerId);
}[/PHP]
Step 3:
Now go to your command and add this:
[PHP]if (command.equalsIgnoreCase("cat")) {
SpawnPet(3507);
sendMessage("Cat spawned, this was made by Ashton at Rune-Server.org!");
}[/PHP]
Step 4:
Ok now you need to go to you NPCHandler.java, and search for this code:
[PHP]public class NPCHandler {[/PHP]
Add this code right under that:
[PHP]public void newPetNPC(int npcType, int x, int y, int heightLevel, int rangex1, int rangey1, int rangex2, int rangey2, int WalkingType, int HP, boolean Respawns, int summonedBy) {
int slot = -1;
for (int i = 1; i < maxNPCs; i++) {
if (npcs[i] == null) {
slot = i;
break;
}
}
if(slot == -1)
return;
if(HP <= 0) {
HP = 100;
}
NPC newNPC = new NPC(slot, npcType);
newNPC.absX = x;
newNPC.absY = y;
newNPC.makeX = x;
newNPC.makeY = y;
newNPC.moverangeX1 = rangex1;
newNPC.moverangeY1 = rangey1;
newNPC.moverangeX2 = rangex2;
newNPC.moverangeY2 = rangey2;
newNPC.walkingType = WalkingType;
newNPC.HP = HP;
newNPC.MaxHP = HP;
newNPC.MaxHit = (int)Math.floor((HP / 10));
if (newNPC.MaxHit < 1) {
newNPC.MaxHit = 1;
}
newNPC.heightLevel = heightLevel;
newNPC.Respawns = Respawns;
newNPC.followPlayer = summonedBy;
newNPC.followingPlayer = true;
npcs[slot] = newNPC;
}[/PHP]
Step 5:
Compile your server, if you have any questions please use the links below before posting on this thread these boards may help you.
Done!
Please use these links to anser any questions:
Official Pets Thread: [Only registered and activated users can see links. ]
**BEFORE YOU SEND A MESSAGE TO ASHTON PLEASE POST ON THREAD**
Send Message To Ashton: [Only registered and activated users can see links. ]
Once again I would like to thank Ashton, he helped me through this whole process. And I would like everyone who uses this code on their server, weather work on not to please thank Ashton. He is a really great coder and he really dose deserves our thanks!
My Server's Video Of Pets
Here is the pets fully working in my server. Please click on link, full screen:
[Only registered and activated users can see links. ]
woahhh thanks man i need this.
will be added!
thanks!

Independent, watch the video.

pretty cool for those who didn't use the other sources it came with
This is ripped from Reenscape 121, or previous versions.

Since when do you call for the client though server in class client?Code:public void SpawnPet(int ID) { server.client.newPetNPC(ID, absX, absY-1, heightLevel, absX-1, absY-1, absX+1, absY-1, 1, server.npcHandler.GetNpcListHP(ID), false, playerId); }
you could do this code for many other Npcs, am i correct?
| « My Custom Pk Box!!! (part 2) | Hit Delay. » |
| Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |