AC_AutoTurretStats
Last updated
Last updated
AC_AutoTurretStats
is the main actor component attached to every turret. It controls targeting, stat values, firing logic, and filtering. Everything from how a turret locks on to how it picks a target is controlled here.
Well-commented and fully modular.
Functions are clearly named to be self-explanatory.
Once you review Create , you should understand how everything connects.
By default, all Line Traces (used for LOS, visibility, and aiming checks) rely on the Visibility collision channel.
✅ Out of the Box:
Designed for quick implementation in most UE5 projects.
Works without needing any special project settings.
🛠️ Advanced Projects:
If you're using custom trace channels for AI, environment, or gameplay visibility:
You’ll need to update the trace channels in the relevant functions inside AC_AutoTurretStats
.
Look for functions related to:
Line of Sight checks
Clear Shot conditions
Target acquisition logic
🧠 Pro Tip: Centralize the trace channel as a configurable variable if you want to quickly swap between channels for different turrets or enemy types.
Filtering logic goes beyond distance. For more accurate decisions, turrets pull info directly from the target actors using two key requirements:
BPI_CombatInterface
AC_BasicStats
These provide:
Health
Damage
Level
Other customizable combat attributes
🛠️ Advanced Custom Filtering
If you want to change how turrets interpret or prioritize targets, here’s what you need to look at:
InfoToFilterFunction
Central logic hub for fetching and interpreting data from potential targets. Replace this if using a custom interface.
LowOrHigh
Tells the system whether a filter is optimized for high values (e.g., HP) or low values (e.g., Distance). Make sure to update this to match your custom EN_Targeting enums.
EN_Targeting
(Enum)
Expand or modify this enum to include new targeting behaviors (e.g., “Most Aggro”, “Weakest Shield”, etc). Be sure to update associated logic in the other two functions above.
To help with defensive behavior:
You can use the BP_MasterObjective
actor in your level to mark a structure, area, or point your turret should prioritize protecting.
If your turret’s targeting priority is set to Distance to Objective
, this actor will become the reference point.
You can modify the type of Actor by adjusting the DefineDefensiveObjective function showed below
Controlled via a simple boolean inside AC_AutoTurretStats
.
Named clearly: LaserSight .
Default: False.
Can be enabled/disabled at runtime, giving players or designers a visual aid toggle.
Example: Shown in action in the Penetration Map Demo.
Trace Channel
Visibility
✅ Yes
Target Data Source
BPI_CombatInterface + AC_BasicStats
✅ Yes
Targeting Priorities
EN_Targeting Enum
✅ Yes
Filtering Logic
InfoToFilterFunction
✅ Yes
Objective Reference
BP_MasterObjective
✅ Yes
Targeting Laser
Off
✅ Runtime toggle
If you ever plan to build faction-specific targeting, squad-aware behavior, or non-stat-based priority (like buffs or debuffs), this modular system gives you all the hooks you need.