September 10, 20178 yr I cant for the life of me get this to work. I am trying to attack a cow while my player is not in combat and the cow is not in combat. I used so many freaking filters but non of them work. Here is what I currently have: State definer NPC cow = getNpcs().closest(cowFilter); if (cow != null && !myPlayer().isAnimating()) return State.ATTACK; switch case case ATTACK: NPC cow = getNpcs().closest(cowFilter); if (cow != null && !myPlayer().isAnimating()) cow.interact("Attack"); break; cow filter Filter<NPC> cowFilter = new Filter<NPC>(){ public boolean match(NPC npc){ return (npc.getName().equalsIgnoreCase("Cow") || npc.getName().equalsIgnoreCase("Cow calf")) && !npc.isHitBarVisible() && !npc.isAnimating() && npc.isAttackable() && getMap().canReach(npc); } }; Anyone has any idea what I am doing wrong? Edited September 10, 20178 yr by HunterRS
September 10, 20178 yr combat.isFighting(); cow.isUnderAttack combat.isFighting checks if your player is in combat - so change your !myPlayer().isAnimating to !combat.isFighting() Entity.isUnderAttack will check if entity is under attack - and add this to your cow filter Edited September 10, 20178 yr by GPSwap
September 10, 20178 yr Author 20 minutes ago, GPSwap said: combat.isFighting(); cow.isUnderAttack combat.isFighting checks if your player is in combat - so change your !myPlayer().isAnimating to !combat.isFighting() Entity.isUnderAttack will check if entity is under attack - and add this to your cow filter ya just found isFighting, was exactly what I was looking for. Ty for your help
September 10, 20178 yr Author Just now, Alek said: Why not contains "Cow"? Why do you have to make two separate checks? Just did 2 seperate checks one for the State define and the other for the attack itself.
September 10, 20178 yr npc.getName().equalsIgnoreCase("Cow") || npc.getName().equalsIgnoreCase("Cow calf"))
Create an account or sign in to comment