Lukedawesome
January 22nd, 2011, 17:57
What this does: Makes you require an item to attack ALL npcs.
What it's good for: GOD....IDK? don't hate.
in playervsnpc.java right under:
public void Attack(NPC n) {
add this:
if(p.getInventory().contains(*ITEM ID*, 1)) {
} else {
p.getActionSender().sendMessage("You need a *ITEM HERE* to attack.");
p.getActionSender().sendMessage("Type ::*ITEM HERE* to get one");
n.Attacking = false;
p.resetAttack();
return;
}
You'll have to create a command that gives you that item, or you can make an NPC do it. But, i recommend you give one in your starter package.
Now...if you have Noszscape, and your item on death drops don't work, you need to add this in your deathevent.java
Right under:
p.getActionSender().sendMessage("Oh dear, you have died.");
Put:
p.getInventory().deleteItem(*ITEM ID HERE*, 1);
I don't think I left anything out, but if i did, just comment
What it's good for: GOD....IDK? don't hate.
in playervsnpc.java right under:
public void Attack(NPC n) {
add this:
if(p.getInventory().contains(*ITEM ID*, 1)) {
} else {
p.getActionSender().sendMessage("You need a *ITEM HERE* to attack.");
p.getActionSender().sendMessage("Type ::*ITEM HERE* to get one");
n.Attacking = false;
p.resetAttack();
return;
}
You'll have to create a command that gives you that item, or you can make an NPC do it. But, i recommend you give one in your starter package.
Now...if you have Noszscape, and your item on death drops don't work, you need to add this in your deathevent.java
Right under:
p.getActionSender().sendMessage("Oh dear, you have died.");
Put:
p.getInventory().deleteItem(*ITEM ID HERE*, 1);
I don't think I left anything out, but if i did, just comment