From NWN Lexicon
Jump to navigationJump to search

Determines the last creature that an attempted attack was made on.


Get the target that the caller attempted to attack - this should be used in conjunction with GetAttackTarget(). This value is set every time an attack is made, and is reset at the end of combat.

Returns OBJECT_INVALID if the caller is not a valid creature.


Set by attempting to attack somebody with ActionAttack, just adding an attack action will set this. It is used in AI scripts such as OnPerception or OnDamaged to determine if the AI is currently validly attacking something (so no need to call AI to do a combat decision against the agressor).

Combine it with GetAttemptedSpellTarget to cover most combat actions. The default AI is usually based around causing ActionAttack or ActionCastSpell so it works well for it. Custom AI might need to take into account other actions or acknowledgement it is already in combat.

Note it is better to use this compared to GetIsInCombat since the combat state usually is already TRUE before the events even fire.



See Also


GetIsInCombat GetAttemptedSpellTarget GetAttackTarget


OnPhysicalAttacked Event

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