Anyone know how to detect if a target (or if possible: any 'unit' object) is attackable or not?
Having issues detecting this. Will I need to read the factions dbc for this or is there another solution?
Anyone know how to detect if a target (or if possible: any 'unit' object) is attackable or not?
Having issues detecting this. Will I need to read the factions dbc for this or is there another solution?
Last edited by SinnerG; 03-22-2010 at 09:35 AM.
i'm sitting on this problem too.
at the moment i check via race, type & range, but it doesn't work so well.
anyone found a way or have an idea without using factions dbc?
just check the flags... if it is !IsNotAttackable I'd say it is attackable, right ?Code:/// <summary> /// Returns true if the unit is not attackable /// </summary> public bool IsNotAttackable { get { return Convert.ToBoolean(Flags & (uint)Helper.UnitFlags.NotAttackable); } }
edit: just looked it up and found that it wont do much good...you can always use factions
edit2: you can also just use CGGameUI__UnitReaction. I think it will be easier than factions...maybe wrong though
Last edited by Azzie2k8; 03-22-2010 at 10:08 AM.
Yeah, the flags are mostly useless ^^
Guess there is no other (out of process) solution than using the factions.
It's a mask of a few flags that can cause attackability to turn 'off'. All the flags should be off if the mob is truly attackable.Code:public bool Attackable { get { return (UnitFlags & 0x10382) == 0; } }
Edit: this will also make sure that any neutral NPCs that are attackable at certain rep ranges, are properly marked as not-attackable when neutral. (e.g; Booty Bay, Gadgetzan, Ratchet, etc)
thanks apoc for the "unitflags" hint, but i got no useful results from it.
maybe i looked at the wrong flags. what offsets your code refers to?
UNIT_FIELD_FLAGS, UNIT_FIELD_FLAGS_2,
UNIT_DYNAMIC_FLAGS, UNIT_NPC_FLAGS