Difference between revisions of "GetCombatTarget - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Leonfenten
imported>Thynar
 
Line 25: Line 25:
; Below will only return a valid actor ID while your
; Below will only return a valid actor ID while your
; cursor is pointing directly on an actor
; cursor is pointing directly on an actor
TargetRef = Game.GetPlayer().GetCombatTarget()
Actor TargetRef = Game.GetPlayer().GetCombatTarget()
Debug.Trace("My target was " + TargetRef)
Debug.Trace("My target was " + TargetRef)
</source>
</source>

Latest revision as of 03:08, 20 March 2015

Member of: Actor Script

Obtains the actor this actor is currently in combat with.

Syntax[edit | edit source]

Actor Function GetCombatTarget() native

Parameters[edit | edit source]

None.

Return Value[edit | edit source]

The actor this actor is currently in combat with (if any).

Examples[edit | edit source]

; Print a message if Bob is in combat with the player
if (Bob.GetCombatTarget() == Game.GetPlayer())
  Debug.Trace("Bob is in combat with the player!")
endIf

; Below will only return a valid actor ID while your
; cursor is pointing directly on an actor
Actor TargetRef = Game.GetPlayer().GetCombatTarget()
Debug.Trace("My target was " + TargetRef)

See Also[edit | edit source]