Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Sign up now!

(Resolved) Problems establishing if player is in combat

Joined
Nov 5, 2014
Messages
505
I'm having loads of trouble trying to establish if the local player is in combat, methods which have worked fine in the past are now not working correctly.

I've tried a few different ways, but this is the method which I have used in the past which is consistently returning false even when the player is attacking and being attacked by loads of different npcs.

Code:
private Boolean isInCombat(Actor a) {
        return a.getTarget() != null || !Npcs.newQuery().within(fightArea).filter(new Filter<Npc>() {
            @Override
            public boolean accepts(Npc npc) {
                return npc.getTarget() == a;
            }
        }).results().isEmpty();
    }

Any idea what's up with this?

Thanks

@Cloud
 
Top