To create a turret mod, press the “Create Mod” button, and select “Create New Mod”:
To modify a turret (in this case a world-placed shotgun turret CM_Turret_01_world), it is necessary to create a SFPSModComponent.
It is recommended to name this component so that it is easy to understand which Actor it will affect, and in what way. For this example, the name BP_RapidFireShotgunTurret is used, as the mod increases the firing rate of the turret and changes its visuals.
After this component has been created it needs to be assigned in the ModRegistry:
Once this entry has been added, modifications are done inside the BP_RapidFireShotgun->BeginPlay event, as shown in this example.
First section lowers the barrel muzzle location, second section modifies shooting behavior, and the third section changes the “turret base” mesh.
The following functions can be used to further modify turret visuals:
SetTurretBaseMesh - Replaces turret base mesh. In the case of the turrets without active aiming (shotgun turret), base mesh is the only mesh that is required to change.
For the ground-placed active-aiming turrets, base mesh are the “legs”, and in the case of the ceiling mounted turret, it is the mounting plate. It is important to avoid changing the scale of this component, as it will affect other components that are parented to it (pivot meshes, particle effects, critical hit zones etc.). Returns base mesh Static Mesh Component reference, which (if valid) can be used to adjust its transform, materials etc.
SetTurretYawPivotMesh - Replaces the mesh of the active-aiming turret which is responsible for adjusting the yaw angle of aiming (usually the part that connects the “base” and the “pitch” components). Returns yaw mesh Static Mesh Component reference, which (if valid) can be used to adjust its transform, materials etc.
SetTurretPitchPivotMesh - Replaces the mesh of the active-aiming turret which is responsible for adjusting the pitch angle of aiming (usually the part that holds the attached barrel). Returns pitch mesh Static Mesh Component reference, which (if valid) can be used to adjust its transform, materials etc.
SetTurretEffectsSettings - Replaces turret visual and audio effects
GetTurretEffectsSettings - Returns current “Effects Settings” as a blueprint struct
SetPerceptionSettings - Modifies turret’s target perception settings
GetPerceptionSettings - Returns current “Effects Settings” as a blueprint struct
SetElectricitySettings - Modifies turret’s battery capacity and charge/discharge rates
GetElectricitySettings - Returns current “Electricity Settings” as a blueprint struct
SetCriticalDamageMultiplier - Sets critical damage multiplier (multiplier of the damage that the turret receives if hit in its “critical area”)
GetCriticalDamageMultiplier - Returns current critical damage multiplier
SetBarrelSettings - Modifies barrel/muzzle offset which defines the origin of a fired projectile
GetBarrelSettings - Returns current “Barrel Settings” as a blueprint struct
SetTurretShootingSettings - Modifies turret shooting settings (like ammo type, damage per hit, rate of fire etc.)
GetShootingSettings - Returns current “Shooting Settings” as a blueprint struct
SetIsWorldPlaced - Defines turret as “world-placed” (a turret that is placed as a part of the map, rather than constructed by players during the game)
IsWorldPlaced - Returns if the turret is defined as “world-placed”