Thread: Fully Working Server Pets

Page 1 of 11 123 ... LastLast
Results 1 to 10 of 104
  1. #1 Fully Working Server Pets 
    Registered Member HyreScape's Avatar
    Join Date
    May 2008
    Posts
    527
    Thanks given
    1
    Thanks received
    1
    Rep Power
    42
    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. ]
     

  2. #2  
    hmu

    Jakey's Avatar
    Join Date
    Sep 2007
    Age
    31
    Posts
    6,489
    Thanks given
    109
    Thanks received
    277
    Rep Power
    1218
    woahhh thanks man i need this.

    will be added!

    thanks!
    to contact me, PM me on rune-server.
     

  3. #3  
    Registered Member
    Your Name's Avatar
    Join Date
    Oct 2007
    Age
    29
    Posts
    1,442
    Thanks given
    0
    Thanks received
    4
    Rep Power
    172
    So with your command you gonna make it so you can only spawn that one cat?
    [Only registered and activated users can see links. ]



    MoparScape name = Doodooss
     

  4. #4  
    Donator


    Join Date
    Sep 2006
    Age
    27
    Posts
    2,106
    Thanks given
    73
    Thanks received
    54
    Rep Power
    491
    Yea, I helped him and posted the code
    And made it with dhareauxk
    [Only registered and activated users can see links. ]
     

  5. #5  
    Registered Member HyreScape's Avatar
    Join Date
    May 2008
    Posts
    527
    Thanks given
    1
    Thanks received
    1
    Rep Power
    42
    Independent, watch the video.
     

  6. #6  
    The Stygian Empire


    Join Date
    Nov 2006
    Age
    29
    Posts
    466
    Thanks given
    1
    Thanks received
    0
    Rep Power
    152
    pretty cool for those who didn't use the other sources it came with
     

  7. #7  
    Donator

    tj007razor's Avatar
    Join Date
    Feb 2007
    Posts
    895
    Thanks given
    2
    Thanks received
    9
    Rep Power
    210
    Dude, use code tags, not PHP. It hurts my eyes.

    [Only registered and activated users can see links. ]

    [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ] | [Only registered and activated users can see links. ]
     

  8. #8  
    Ben
    Guest
    This is ripped from Reenscape 121, or previous versions.
     

  9. #9  
    Registered Member

    Join Date
    Oct 2007
    Posts
    2,413
    Thanks given
    254
    Thanks received
    479
    Rep Power
    2785
    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);
    }
    Since when do you call for the client though server in class client?
     

  10. #10  
    Joe9099
    Guest
    you could do this code for many other Npcs, am i correct?
     

Page 1 of 11 123 ... LastLast

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •