Jump to content

Featured Replies

Posted
comment_50666

Afternoon All!

Just a quick one, I'm trying to get Keris to hit more against Kaphite NPC's. Here's what I've written, and for some reason it isn't working?

in PlayerCombat.java

public boolean hasKeris(Player player) {
		int weaponId = player.getEquipment().getWeaponId();
		return weaponId == 10581 || weaponId == 10582 || weaponId == 10583;
	}

also in PlayerCombat.java

		if (target instanceof NPC) {
				NPC n = (NPC) target;
			if (n.getId() == 1157 && hasKeris(player)) {
				double strengthBonus = player.getCombatDefinitions().getBonuses()[CombatDefinitions.STRENGTH_BONUS];
					strengthBonus += 250;
					}
				}

I'm attacking the NPC ID 1157 with Keris but it isn't hitting...

I also tried dragging the NPC names using the below (which also didn't work!):

if (target instanceof NPC) {
				NPC n = (NPC) target;
				if (n.getDefinitions().name.contains("Kalphite")) {
			if(weaponId == 10581) {

Does anyone understand why this won't work?

Cheers,

Wzrd

Create an account or sign in to comment