Thread: Boss Pets: NPC, Drop & Interface [718]

Page 1 of 4 123 ... LastLast
Results 1 to 10 of 31
  1. #1 Boss Pets: NPC, Drop & Interface [718] 
    Registered Member
    Join Date
    Jan 2016
    Posts
    40
    Thanks given
    1
    Thanks received
    7
    Rep Power
    11
    So i finally figured how to make the boss pets summon if you get them as a drop. If that is all you are looking for skip ahead to step: 5. This will be the full tutorial on how to add everything, the npc the drop and a interface to access the pets . I will add 1 pet to show you how its done. Its the same steps for the rest.
    I will suggest having a backup of your cache before doing any of this.


    Tools you will need:
    Cache Editor: Download

    Step 1:
    [SPOIL]
    Open up Frosty's Cache editor and load in your cache and select NPC and submit.

    Attached image
    [/SPOIL]

    Step 2:

    [SPOIL]
    Now duplicate Npc 1 to the id you want your pet to be. For this post im using id 16000.

    Attached image
    [/SPOIL]

    Step 3:
    [SPOIL]
    Now find the ID of the Boss you want to make a pet for. For this post i will be using King black dragon. so ID 50.

    Now copy over the ints from King black dragon to 16000. I changed the Height to 22 and the Width to 22. Where it says Options change those to:
    null;null;null;null;null;


    Attached image

    Attached image

    Make sure that there is 8 places in the model IDs. If your model only take up 4 spaces do -1;-1;-1;-1;
    And with chat heads add a -1; before the real ID.


    Attached image

    Save the npc and thats all the cache work done if you reload your server now and spawn npc 16000. You should see the npc you just added.

    Attached image
    [/SPOIL]

    Step 4:
    [SPOIL]
    Now navigate to your source and find Pets.java
    And add:
    PET_NAME(-1, -1, -1, Npc ID, -1, -1, 0.0, 0),


    So for me it will be:
    Code:
    KING_BLACK_DRAGON(-1, -1, -1, 16000, -1, -1, 0.0, 0),
    [/SPOIL]

    Step 5:
    [SPOIL]
    Now navigate to Player.java
    And add:


    Code:
    private boolean KbdPet;
    
    public boolean hasKbdPet() {
    		return KbdPet;
    	}
    
    public void setKbdPet(boolean KbdPet) {
    		this.KbdPet = KbdPet;
    	}
    [/SPOIL]

    Step 6:
    [SPOIL]
    Navigate to NPC.java
    Search for "public void drop()"
    In "try" method add:

    Code:
    if (this.getId() == 50 && Utils.getRandom(200) == 0) {//Kbd
    				if (killer.getPet() == null && killer.hasKbdPet() == false) {
    					killer.setKbdPet(true);
    					killer.getPetManager().spawnPet(Pets.KING_BLACK_DRAGON.getBabyItemId(), false);
    					killer.getPackets().sendGameMessage("You have now got yourself a new follower!");
    					return;
    				}
    				if (killer.hasKbdPet() == true) {
    					killer.getPackets().sendGameMessage(" ");
    					return;
    				} else {
    					killer.setKbdPet(true);
    					killer.getPackets().sendGameMessage("You have now got yourself a new follower! You can activate it with ;;bosspets.");
    					return;
    				}
    			}
    [/SPOIL]

    Step 7:
    [SPOIL]
    Now to the interface. It doesnt have to be an interface, it can also be a command or dialogue. For this post im using interface 1312.
    Navigate to your interfaces Folder and create a new .java
    Name it "BossPets.java"

    Now paste this:

    Code:
    package com.rs.game.player.content.interfaces;
    
    import com.rs.game.player.Player;
    import com.rs.utils.Utils;
    import com.rs.Settings;
    import com.rs.game.npc.pet.Pet;
    import com.rs.game.player.content.pet.Pets;
    import com.rs.game.player.content.pet.*;
    
    public class BossPets {
      
    	public static void sendToggle(Player player) {
    		int INTER = 1312;
    		
    		player.getInterfaceManager().sendInterface(INTER);
    		player.getPackets().sendIComponentText(INTER, 27, "Boss Pets");
    		player.getPackets().sendIComponentText(INTER, 38, "Toggle Kbd Pet");
    		player.getPackets().sendIComponentText(INTER, 46, " ");
    		player.getPackets().sendIComponentText(INTER, 54, " ");
    		player.getPackets().sendIComponentText(INTER, 62, " ");
    		player.getPackets().sendIComponentText(INTER, 70, " ");
    		player.getPackets().sendIComponentText(INTER, 78, " ");
    		player.getPackets().sendIComponentText(INTER, 86, " ");
    		player.getPackets().sendIComponentText(INTER, 94, " ");
    		player.getPackets().sendIComponentText(INTER, 102, " ");
    		player.getPackets().sendIComponentText(INTER, 40, " ");
    	}
    	
        public static void handleButtons(Player player, int componentId) {
    		if (componentId == 35) {
    			if (player.hasKbdPet() == true && player.getPet() == null) {
    				player.getPetManager().spawnPet(Pets.KING_BLACK_DRAGON.getBabyItemId(), false);
    				player.getPackets().sendGameMessage("You summon your Kbd pet");
    			} else if (player.hasKbdPet() == true && player.getPet() != null) {
    				player.getPackets().sendGameMessage("You need to dismiss your current follower.");
    			} else {
    				player.getPackets().sendGameMessage("You dont have this pet.");
    			}
    		}
    		
    		if (componentId == 43) {
    			player.getPackets().sendGameMessage("43");
    		}
    		
    		if (componentId == 51) {
    			player.getPackets().sendGameMessage("51");
    		}
    		
    		if (componentId == 59) {
    			player.getPackets().sendGameMessage("59");
    		}
    		
    		if (componentId == 67) {
    			player.getPackets().sendGameMessage("67");
    		}
    		
    		if (componentId == 75) {
    			player.getPackets().sendGameMessage("75");
    		}
    		
    		if (componentId == 83) {
    			player.getPackets().sendGameMessage("83");
    		}
    		
    		if (componentId == 91) {
    			player.getPackets().sendGameMessage("91");
    		}
    		
    		if (componentId == 99) {
    			player.getPackets().sendGameMessage("99");
    		}
    		
    		if (componentId == 70) {
    			player.getPackets().sendGameMessage("70");
    		}
    		
    		if (componentId == 69) {
    			player.getPackets().sendGameMessage("69");
    		}
    		
    	}
    }
    Attached image

    [/SPOIL]

    Step 8:
    [SPOIL]
    Now navigate to ButtonHandler.java
    and add this:

    Code:
    import com.rs.game.player.content.interfaces.BossPets;
    
    if (interfaceId == 1312) {
    	BossPets.handleButtons(player, componentId);
    }
    [/SPOIL]

    Step 9:
    [SPOIL]
    Now to access your new interface. You can either add it to an object, npc or command. For this post im adding it to a command.
    Navigate to regular.java or commands.java, depends on your source.
    And add this:

    Code:
    import com.rs.game.player.content.interfaces.BossPets;
    
    if (cmd[0].equals("bosspets")) {
    		BossPets.sendToggle(player);
    		return true;
    	}
    [/SPOIL]

    It is now all complete :-)

    Preview:

    [SPOIL]
    For this preview i removed the randomizer and added it to a easier NPC.

    Attached image
    [/SPOIL]

    Please feel free to ask if you have any questions or if something doesnt work for you, i will try my best to help out.

    -Zabix
    Reply With Quote  
     

  2. Thankful users:


  3. #2  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    I don't understand why you'd make this a toggle-able thing when you can just use actual pet 'items' just like Jad pet has for example. Other than that part, everything displayed has already been released on numerous occasions. I'd still like an explanation of that question though as it makes no sense whatsoever. Also, this'd look VERY clumsy if one were to do say.. 50 boss pets.
    EDIT:
    Also, this is complete and utter nonsense:
    Code:
    		if (componentId == 43) {
    			player.getPackets().sendGameMessage("43");
    		}
    		
    		if (componentId == 51) {
    			player.getPackets().sendGameMessage("51");
    		}
    		
    		if (componentId == 59) {
    			player.getPackets().sendGameMessage("59");
    		}
    		
    		if (componentId == 67) {
    			player.getPackets().sendGameMessage("67");
    		}
    		
    		if (componentId == 75) {
    			player.getPackets().sendGameMessage("75");
    		}
    		
    		if (componentId == 83) {
    			player.getPackets().sendGameMessage("83");
    		}
    		
    		if (componentId == 91) {
    			player.getPackets().sendGameMessage("91");
    		}
    		
    		if (componentId == 99) {
    			player.getPackets().sendGameMessage("99");
    		}
    		
    		if (componentId == 70) {
    			player.getPackets().sendGameMessage("70");
    		}
    		
    		if (componentId == 69) {
    			player.getPackets().sendGameMessage("69");
    		}
    Could've just gone with
    player.getPackets().sendGameMessage("" + componentId);
    Last edited by Kris; 02-13-2017 at 12:57 AM. Reason: Found another 'major' mistake.
    Attached image
    Reply With Quote  
     

  4. #3  
    Owner of Tartarus

    ShrekTastic's Avatar
    Join Date
    Jun 2015
    Posts
    251
    Thanks given
    110
    Thanks received
    42
    Rep Power
    105
    I like the idea of being able to toggle between pets. Nice release!
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    Jan 2016
    Posts
    40
    Thanks given
    1
    Thanks received
    7
    Rep Power
    11
    Quote Originally Posted by Kris View Post
    I don't understand why you'd make this a toggle-able thing when you can just use actual pet 'items' just like Jad pet has for example. Other than that part, everything displayed has already been released on numerous occasions. I'd still like an explanation of that question though as it makes no sense whatsoever. Also, this'd look VERY clumsy if one were to do say.. 50 boss pets.
    EDIT:
    Also, this is complete and utter nonsense:
    Code:
    		if (componentId == 43) {
    			player.getPackets().sendGameMessage("43");
    		}
    		
    		if (componentId == 51) {
    			player.getPackets().sendGameMessage("51");
    		}
    		
    		if (componentId == 59) {
    			player.getPackets().sendGameMessage("59");
    		}
    		
    		if (componentId == 67) {
    			player.getPackets().sendGameMessage("67");
    		}
    		
    		if (componentId == 75) {
    			player.getPackets().sendGameMessage("75");
    		}
    		
    		if (componentId == 83) {
    			player.getPackets().sendGameMessage("83");
    		}
    		
    		if (componentId == 91) {
    			player.getPackets().sendGameMessage("91");
    		}
    		
    		if (componentId == 99) {
    			player.getPackets().sendGameMessage("99");
    		}
    		
    		if (componentId == 70) {
    			player.getPackets().sendGameMessage("70");
    		}
    		
    		if (componentId == 69) {
    			player.getPackets().sendGameMessage("69");
    		}
    Could've just gone with
    player.getPackets().sendGameMessage("" + componentId);
    To be honest i just find it cleaner without any inventory items. And so i thought of putting them into a interface. i added all the other compnentIds so it was easier just to copy from king black dragon pet into the other once..

    Quote Originally Posted by TartarusPS View Post
    I like the idea of being able to toggle between pets. Nice release!
    Thanks
    Reply With Quote  
     

  6. #5  


    RS Wiki's Avatar
    Join Date
    Mar 2011
    Age
    29
    Posts
    9,688
    Thanks given
    1,752
    Thanks received
    3,103
    Rep Power
    5000
    Good work on your efforts, i'm sure it'll advance the 503+ revisions well.
    All the best,
    Wiki




    coming soon
    Reply With Quote  
     

  7. #6  
    Registered Member
    Join Date
    Jan 2016
    Posts
    40
    Thanks given
    1
    Thanks received
    7
    Rep Power
    11
    Quote Originally Posted by RS Wiki View Post
    Good work on your efforts, i'm sure it'll advance the 503+ revisions well.
    Thanks :-)
    Reply With Quote  
     

  8. #7  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by zabix18 View Post
    To be honest i just find it cleaner without any inventory items. And so i thought of putting them into a interface. i added all the other compnentIds so it was easier just to copy from king black dragon pet into the other once..



    Thanks
    Okay I don't understand how this is any cleaner but alright. I think you've mistaken it with the inventory models that most people do - such as a representative 'book' or 'pouch' or whatever.. However you can just use the actual NPC model as an inventory model in case you didn't know.
    However regarding the second part, alright. But what's up with the if sentences? You don't need any. Just print the componentId variable as I showed up there. No need to over-do the simple things.
    Attached image
    Reply With Quote  
     

  9. #8  
    Registered Member
    Join Date
    Jan 2016
    Posts
    40
    Thanks given
    1
    Thanks received
    7
    Rep Power
    11
    Quote Originally Posted by Kris View Post
    Okay I don't understand how this is any cleaner but alright. I think you've mistaken it with the inventory models that most people do - such as a representative 'book' or 'pouch' or whatever.. However you can just use the actual NPC model as an inventory model in case you didn't know.
    However regarding the second part, alright. But what's up with the if sentences? You don't need any. Just print the componentId variable as I showed up there. No need to over-do the simple things.
    I just made it like that. Can't explain why.
    Reply With Quote  
     

  10. #9  
    Respected Member


    Kris's Avatar
    Join Date
    Jun 2016
    Age
    26
    Posts
    3,638
    Thanks given
    820
    Thanks received
    2,642
    Rep Power
    5000
    Quote Originally Posted by zabix18 View Post
    I just made it like that. Can't explain why.
    Alright. Not going to bash or anything, just trying to give some constructive criticism on some parts of this snippet before some douchebag comes here and flames you like hell. I can see beginners doing it this way - I myself used to think similarly to how you've thought this through when I didn't know much about java. To each their own I suppose. Good job.
    Attached image
    Reply With Quote  
     

  11. #10  
    Registered Member
    Join Date
    Jan 2016
    Posts
    40
    Thanks given
    1
    Thanks received
    7
    Rep Power
    11
    Quote Originally Posted by Kris View Post
    Alright. Not going to bash or anything, just trying to give some constructive criticism on some parts of this snippet before some douchebag comes here and flames you like hell. I can see beginners doing it this way - I myself used to think similarly to how you've thought this through when I didn't know much about java. To each their own I suppose. Good job.
    Alright. Thanks
    Reply With Quote  
     

Page 1 of 4 123 ... LastLast

Thread Information
Users Browsing this Thread

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


User Tag List

Similar Threads

  1. Req 667/718 boss pets!
    By VILJO in forum Models
    Replies: 2
    Last Post: 03-02-2016, 10:34 AM
  2. [718] Adding boss pets [NPC+ITEM]
    By Cosmic Rune in forum Snippets
    Replies: 15
    Last Post: 02-18-2016, 06:46 PM
  3. Boss pets (Npc part)
    By rogers in forum Tutorials
    Replies: 36
    Last Post: 01-02-2016, 03:42 AM
  4. 718 Changing NPC drops
    By Old Oak in forum Help
    Replies: 5
    Last Post: 06-07-2014, 05:55 PM
  5. 718 Npc Drops
    By tm g in forum Help
    Replies: 0
    Last Post: 07-30-2012, 03:11 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •