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.
[/SPOIL]
Step 2:
[SPOIL]
Now duplicate Npc 1 to the id you want your pet to be. For this post im using id 16000.
[/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;
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.
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.
[/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");
}
}
}
[/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.
[/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