From NWN Lexicon
Jump to navigationJump to search

Determines the current foe under attack by the specified creature.

object GetAttackTarget(
    object oCreature = OBJECT_SELF


Creature currently involved in combat. (Default: OBJECT_SELF)


Get the attack target of oCreature.

It gets cleared when the attack action is removed or you lose your target (if they die or go invisible) or the round ends.


This is useful in OnCombatRoundEnd since it is retained, unlike GetAttemptedAttackTarget, so you can determine who you were attacking in the previous round.

In other uses it can be good to see what a creature is intentionally targeting for the purposes of, for instance, knowing if you can parry them or sneak attack them.

It is not set when a creature is casting a spell at something, only when ActionAttack or similar actions are used. To know if they're casting a spell use GetCurrentAction. Since casting a spell can be on the ground you won't be able to tell what they're directly casting against.



See Also


GetIsInCombat GetAttemptedAttackTarget GetAttemptedSpellTarget GetCurrentAction


OnPhysicalAttacked Event OnCombatRoundEnd

 author: Jody Fletcher, editor: Charles Feduke, additional contributor(s): Jon McCarty, Noel Borstad