Background for Starfield
Member of the Actor script
eventOnCombatStateChanged(ObjectReferenceakTarget, intaeCombatState)

Description

Wiki Description

Event called when this actor's combat state changes.

Documentation Comment

Event that is triggered when this actor's combat state against the target changes
State is as follows:
0 - not in combat
1 - in combat
2 - searching


Caveats

CK Wiki - Notes

  • 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)

Parameters

  1. ObjectReferenceakTarget

    CK Wiki Description

    The Actor that this actor is targeting. May be None if this actor is leaving combat.

  2. intaeCombatState

    CK Wiki Description

    The combat state we just entered, which will be one of the following:* 0:Not in combat

    • 1:In combat
    • 2:Searching

Examples

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

Auto-Generated Example

Scriptname MyCoolScript extends Actor

event OnCombatStateChanged(ObjectReference akTarget, int aeCombatState)
    Debug.trace("Event received - OnCombatStateChanged: akTarget = " + akTarget + " aeCombatState = " + aeCombatState)
endEvent

Related Pages


Additional References

View this event’s page on the Fallout 4 Creation Kit Wiki

Some data provided by the Fallout 4 Creation Kit Wiki. Licensed under the Creative Commons Attribution-Share Alike 4.0 license.