100% Credit to jakeHop22 for this, Modified his thread a bit, he's my coding partner so I guess he won't mind :
Combatassistant.java
Here there's only two in the format but you can add more :
Code:
public int[][] slayerReqItems = {{NPCID,ITEMID}, {NPCID,ITEMID}};
Then :
Code:
public boolean needThatItem(int i) {
for (int j = 0; j < slayerReqItems.length; j++) {
if (slayerReqItems[j][0] == Server.npcHandler.npcs[i].npcType) {
if (!c.getItems().playerHasItem(slayerReqItems[j][1],1)) {
if (slayerReqItems[j][1] == 4587) {
c.slayerIName = "Dragon Scimitar";
}
c.sendMessage("You need a " + c.slayerIName + " to attack this NPC.");
return false;
}
}
}
return true;
}
Then under
Code:
if (!goodSlayer(i)) {
resetPlayerAttack();
return;
}
Add
Code:
if (!needThatItem(i)) {
resetPlayerAttack();
return;
}
Player.java
Code:
public String slayerIName;
I didn't link you to his thread because I wanted to modify this part so it handled all items name from the item list ;
Code:
if (slayerReqItems[j][1] == 4587) {
c.slayerIName = "Dragon Scimitar";
}
c.sendMessage("You need a " + c.slayerIName + " to attack this NPC.");
But finaly im lazy