OnCombatStateChanged - Actor

From the Fallout4 CreationKit Wiki
Jump to navigation Jump to search

Member of: Actor Script

Event called when this actor's combat state changes.

Syntax[edit | edit source]

Event OnCombatStateChanged(Actor akTarget, int aeCombatState)

Parameters[edit | edit source]

  • 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

Examples[edit | edit source]

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

Notes[edit | edit source]

  • Actors can have multiple targets - akTarget will be the current combat target at the time the event happened.
  • If listening for combat state changes on the player, the target will be the closest target in the player's combat group (since the player doesn't really have a target)

See Also[edit | edit source]