Skip to main content

CNPC_Trooper

Lane trooper (npc_trooper). Guardians and walkers are separate classes.

public sealed class CNPC_Trooper : CAI_CitadelNPC

Namespace: DeadworksManaged.Api
Inherits / implements: CAI_CitadelNPC
Source: Entities/CNPC_Trooper.cs#L11

Notes​

The game pools troopers: hidden ones are CAI_BaseNPC.IsDormant and come back as new spawns, possibly on another team or lane. A stored reference can become a different trooper.

Properties​

CNPC_Trooper.Lane​

Lane the trooper walks, or 0 for none.

Signature

public int Lane { get; }

Source: Entities/CNPC_Trooper.cs#L19

CNPC_Trooper.UsingBossWeapon​

True while the trooper fires its anti-boss weapon at a guardian or walker.

Signature

public bool UsingBossWeapon { get; }

Source: Entities/CNPC_Trooper.cs#L22

Methods​

CNPC_Trooper.Create()​

Spawns a lane trooper, like citadel_spawn_trooper. Returns null on failure.

Signature

public static CNPC_Trooper? Create(Vector3 position, int team, TrooperType type = TrooperType.Normal, Vector3? angles = null, bool snapToGround = true)

Parameters

  • position: Spawn position.
  • team: 2 Amber, 3 Sapphire.
  • type: Trooper type.
  • angles: Pitch, yaw, roll. Null faces +X.
  • snapToGround: Drop it to the ground below position.

Notes The trooper joins the lane nearest position. A free pooled trooper of the same type is reused.

Source: Entities/CNPC_Trooper.cs#L34