GetNumCombatActorsFromActor

From GECK
Jump to: navigation, search


A function added by the ShowOff NVSE Plugin.

Description

Returns the amount of in-combat actors that are allies/enemies to the calling actor reference.

If the first argument (maxDistance) is omitted, it defaults to 0. If set to a number above 0, the distance (in game Units) between the calling actor and each combat actor is checked; if the distance is smaller or equal to maxDistance, the combat actor can make its way into the resulting numActors count.

The type of actor to be counted can be optionally filtered via the flagsBitMask argument (bit values are written under Notes).
If flagsBitMask is omitted, it defaults to 0. If left at 0, flagsBitMask is internally set to 3, meaning both combat allies and targets are counted.

This function can be used either in a script, or as a Condition.

Syntax

[help]
(numActors:int) actorRefr.GetNumCombatActorsFromActor maxDistance:float flagsBitMask:int

Example

int iNumActors

let iNumActors := player.GetNumCombatActorsFromActor

Will return the number of actors that are targeting or allied to the player. Equivalent to `player.GetNumCombatActorsFromActor 0 0`.

let iNumActors := player.GetNumCombatActorsFromActor 500

Same as above, except that the amount of actors is further filtered by checking if the distance between each actor to the player is less or equal to 500.

let iNumActors := SunnyREF.GetNumCombatActorsFromActor 0 6

Returns the amount of actors that are not invisible and are combat targets to SunnyREF.

Notes

flagsBitMask works with the following values:

Flags Bit Decimal Value
Include combat allies 0 1
Include combat targets 1 2
No invisible actors 2 4
Only detected actors 3 8
  • Only detected actors was added in version 1.25. With it toggled, only combat actors that actorRefr can detect are counted (further filters still apply).
  • No invisible actors works by checking if either the actor's Invisibility or Chameleon actor values are greater than 0.

See Also