Difference between revisions of "OnCombatStateChanged - Actor"

From the CreationKit Wiki
Jump to navigation Jump to search
imported>Jlundin
(Created page with 'Category:Scripting Category:Papyrus Category:Events '''Member of:''' Actor Script Event called when this actor's combat state changes. == Syntax == <source lang…')
 
imported>Leonfenten
Line 17: Line 17:
**1: In combat
**1: In combat
**2: Searching
**2: Searching
Through a lot of testing I have found the OnCombatStateChanged() event will not fire if attached to the Player.


== Examples ==
== Examples ==

Revision as of 16:38, 17 April 2012

Member of: Actor Script

Event called when this actor's combat state changes.

Syntax

Event OnCombatStateChanged(Actor akTarget, int aeCombatState)

Parameters

  • akTarget: The Actor that this actor is targeting. May be None if this actor is leaving combat.
  • aeCombatState: The combat state we just entered, which will be one of the following:
    • 0: Not in combat
    • 1: In combat
    • 2: Searching

Through a lot of testing I have found the OnCombatStateChanged() event will not fire if attached to the Player.

Examples

Event OnCombatStateChanged(Actor akTarget, int aeCombatState)
  if (akTarget == Game.GetPlayer())
    if (aeCombatState == 0)
      Debug.Trace("We have left combat with the player!")
    elseif (aeCombatState == 1)
      Debug.Trace("We have entered combat with the player!")
    elseif (aeCombatState == 2)
      Debug.Trace("We are searching for the player...")
    endIf
  endIf
endEvent

See Also