Skip to content

AI

7 tools. Back to the index.

add_ai_stimuli_source

Additive, idempotent.

Adds a UAIPerceptionStimuliSourceComponent to an actor and registers it as a source for the supplied AISense (default Sight). Idempotent: re-run returns the existing component.

Parameter Type Required Description
actor_name string yes Display label or internal name of the target editor-world actor (required)
sense string no "Sight" | "Hearing" | "Damage" (default "Sight")

Returns: { actor_name: string, component_name: string, sense: string, registered: bool, already_existed: bool }

configure_ai_sight_radius

Destructive, idempotent.

Set SightRadius and LoseSightRadius (default sight_radius times 1.5) on the sight config of the AIPerceptionComponent of an AI-possessed pawn or an AIController. The actor is looked up in the editor world, not PIE, so an unpossessed pawn is an error. Returns sight_radius, lose_sight_radius and sight_sense_count; 0 means no sight config, nothing changed.

Parameter Type Required Description
actor_name string yes Object name or editor label of the pawn or AIController in the editor world; the first match is used.
sight_radius number yes New SightRadius in cm, greater than 0.
lose_sight_radius number no New LoseSightRadius in cm, the distance at which an already seen target is lost, 0 or more; default sight_radius times 1.5.

Returns: { actor_name, sight_radius, lose_sight_radius, sight_sense_count }

create_ai_controller_blueprint

Additive, idempotent.

Create a Blueprint asset parented to AAIController, compile and save it. Idempotent: if the asset already exists it is loaded and returned.

Parameter Type Required Description
name string yes Asset name (e.g. BP_EnemyAIController)
package_path string no Target /Game package path (optional, default "/Game/Blueprints")

Returns: { name: string, asset_path: string, parent_class: string, generated_class: string, is_ai_controller: bool, already_existed: bool, created: bool }

get_actor_team

Read-only.

Reads the native FGenericTeamId assigned to an actor (or its Controller, for a Pawn possessed by an AAIController). Returns the engine-reserved NoTeam id (255) if neither the actor nor its Controller implements IGenericTeamAgentInterface.

Parameter Type Required Description
actor_name string yes Display label or internal name (required)

Returns: { actor_name, team_id, resolved_on: "actor"|"controller"|"none", is_no_team }

get_ai_perceived_actors

Read-only.

List the actors that the AIPerceptionComponent of an AI-possessed pawn, or of an AIController, currently perceives by any sense, without changing anything. The actor is looked up in the editor world, not PIE, so an unpossessed pawn is an error. Returns count and perceived [{actor_name}]; no last-sensed time is included.

Parameter Type Required Description
actor_name string yes Object name or editor label of the pawn or AIController in the editor world; the first match is used.

Returns: { actor_name, perceived: [{actor_name}], count }

set_actor_team

Destructive, idempotent.

Assigns a native FGenericTeamId to an actor via IGenericTeamAgentInterface, falling back to the actor's Controller when the actor itself doesn't implement the interface (e.g. an ACharacter possessed by an AAIController — the only class implementing it in vanilla UE 5.8). Refreshes any UAIPerceptionComponent listeners on the resolved agent so Sight/Hearing/Touch affiliation filtering (cached at listener-update time) reflects the new team immediately.

Parameter Type Required Description
actor_name string yes Display label or internal name (required)
team_id number yes Required int in [0, 254] (255 is the engine-reserved NoTeam id)

Returns: { actor_name, team_id, applied, resolved_on: "actor"|"controller", perception_listeners_refreshed }

set_native_team_attitude

Destructive, idempotent.

Installs (once per process) a custom FGenericTeamId::AttitudeSolver backed by an MCP-owned symmetric table, then records the pairwise attitude for team_a/team_b. Pairs not explicitly set fall back to the engine's own default (same team -> Friendly, else Hostile). This drives the engine's own AI Perception affiliation filtering (Sight/Hearing/Touch DetectionByAffiliation), which reads FGenericTeamId::GetAttitude directly.

Parameter Type Required Description
team_a number yes Required int in [0, 255].
team_b number yes Required int in [0, 255].
attitude string yes Required: "Friendly"|"Neutral"|"Hostile".

Returns: { team_a, team_b, attitude, resolved_attitude, solver_installed }