Purpose: Alternative NPC drops
Difficulty: 1
Tested On: Shard
Ok so I used emulous since it was released and finally got fed up with it and changed to Shard. I had so many NPC drops for that and I didn't want to rewrite it. And I am posting this in hopes more people will change to Shard. Please no flames about how this is stupid.
first make a new file called Config.java in com/rs/worldserver
add this
Code:
/**
* NPC DROPS
**/
//{npc Type, item id , amount, chance}
public static int[][] NPC_DROPS = {
// if you want the a npc to always drop an item make the chance 0
{1,1038,1,10}, {1,526,1,0}, {1,995,120,2}, // man
****,526,1,0}, // knight
};
save and close plus modify to your drops
Open NPC.Java
import this
Code:
import com.rs.worldserver.Config;
change your processdrops to this.
Code:
public void processDrops() {
Client highestHitter = null;
int highestHit = -1;
for (Map.Entry<Client, Integer> entry : previousAttackers.entrySet()) {
if (entry.getValue() > highestHit) {
highestHit = entry.getValue();
highestHitter = entry.getKey();
}
}
if (highestHitter == null) {
return; // don't worry about it
} else {
int npc = 0;
for(npc = 0; npc < Config.NPC_DROPS.length; npc++){
if(definition.type == Config.NPC_DROPS[npc][0]) {
if(Misc.random(Config.NPC_DROPS[npc][3]) == 0) {
FloorItem item = new FloorItem(Config.NPC_DROPS[npc][1], Config.NPC_DROPS[npc][2], highestHitter, getAbsX(), getAbsY(), getHeightLevel());
Server.getItemManager().newDropFromNPC(item, highestHitter);
}
}
}
previousAttackers = null;
}
}
Edit: Forgot 1 thing open NPCDefinition.java
few lines down youwill see private int type; make it public
save and compile.