Skip to main content

CCitadelPlayerBotNPCBrain

AI of a bot hero (npc_player_bot_brain), a hidden NPC. Get it from CCitadelPlayerPawn.BotBrain.

public sealed class CCitadelPlayerBotNPCBrain : CAI_CitadelNPC

Namespace: DeadworksManaged.Api
Inherits / implements: CAI_CitadelNPC
Source: Entities/CCitadelPlayerBotNPCBrain.cs#L15

Notes​

With Bots.AiEnabled on, the brain moves the hero itself and may drop a CAI_BaseNPC.MoveTo order for its own plans, such as a zipline. With it off, call ApplyMovement to walk the hero along the brain's path.

Properties​

CCitadelPlayerBotNPCBrain.Pawn​

Hero this brain drives.

Signature

public CCitadelPlayerPawn? Pawn { get; }

Source: Entities/CCitadelPlayerBotNPCBrain.cs#L29

Methods​

CCitadelPlayerBotNPCBrain.ApplyMovement()​

Fills in a usercmd that walks the bot along its brain's path. Returns false, leaving the usercmd alone, if the brain has nowhere to go.

Signature

public bool ApplyMovement(CCitadelUserCmdPB usercmd, Vector3? lookAt = null)

Parameters

  • usercmd: Usercmd to fill in.
  • lookAt: Point to aim at while moving. Null faces the direction of travel.

Notes Call on each of the bot's usercmds in IDeadworksPlugin.OnProcessUsercmds, with Bots.AiEnabled off, after CAI_BaseNPC.MoveTo. The first usercmd after MoveTo also returns false: treat only several false results in a row as arrival. The bot stops about 50 units from the goal.

Source: Entities/CCitadelPlayerBotNPCBrain.cs#L48