Skip to main content

Blueprint Reference

Every Blueprint in the pack, with its editable properties and the functions meant for you. Paths are relative to Content/AITurret.

Turret​

BP_TurretPawnBase​

Blueprints/Core/BP_TurretPawnBase is the base of every turret: mesh, firing, health, damage states and destruction. It implements BPI_TeamAgent, BPI_Destructible and BPI_Highlightable.

Components: TurretSceneComponent, MeshComponent (skeletal mesh), HealthComponent (AC_Health), NumberPop (BP_NumberPop).

PropertyTypeDescription
TeamIDByteTeam of the turret (255 = no team)
VelocityScaleFloatProjectile speed in cm/s (1000)
bDualBarrelBoolFire from both barrels
DualBarrelShootDelayFloatDelay of the second barrel in seconds
ProjectileClassClassProjectile to spawn (BP_TurretProjectile)
Name_SocketMuzzle, Name_SocketMuzzleLeft, Name_SocketMuzzleRightNameMuzzle sockets on the mesh (muzzle, muzzle_left, muzzle_right)
ShootSound, ResetTurretSound, DamageSound, DestructionSoundSoundSounds for shot, reset, damage and destruction
MuzzleFlashEffect, ProjectileEffectNiagara SystemMuzzle flash and projectile trail
DestroyedActorClassClassDebris actor spawned on destruction
DamageStateThresholdPercentagesFloat arrayHealth fractions for the damage states (0.75, 0.5, 0.25)
DamageStateEffectClassesClass arrayEffect actor per damage state
DamageStateEffectOffsetVector arrayOffset of each damage-state effect
HealthBarWidgetClassClassHealth bar widget (WBP_Healthbar)
HealthBarHeightFloatHeight of the health bar at actor scale 1 (300)
TurretRotationRotatorAim of the head, set by the controller, replicated; drives the Animation Blueprint
FunctionDescription
OnProjectileImpactCalled when one of this turret's projectiles hits something. Empty: override it to deal damage
SpawnShootFXShot sound and muzzle flash. Override for custom effects
ResetTurretCalled by the controller when it gives up its target
PlayDamageFeedbackSound, damage number and health bar after taking damage. Runs on every machine
PlayDestructionHides the turret and spawns the debris actor and a field that breaks it. Runs on every machine
UpdateDamageStatesShows the damage-state effects for a health fraction
GetSocketLocationFromMeshWorld location of a socket on the mesh

BP_TurretPawn and BP_TurretPawn2​

Blueprints/Turret/BP_TurretPawn (dual barrel, SKM_Turret) and BP_TurretPawn2 (single barrel, SKM_Turret_Single_HighPoly). Both are children of BP_TurretPawnBase with VelocityScale 4000, TeamID 1, AI Controller Class BP_TurretAIController and their own debris actor (BP_DestroyedTurret1, BP_DestroyedTurret2).

BP_TurretAIController​

Blueprints/Turret/BP_TurretAIController sees with its AIPerception component (sight sense), picks a hostile target, leads it and fires.

PropertyDefaultDescription
TrackingTimeout3.0Seconds without a hostile in sight before the turret resets
TrackPlayerTimerRate0.1Seconds between aim updates
ShootProjectileTimerRate0.7Seconds between shots
TrackingActivetrueTrack targets
ShootingActivetrueFire at targets
TrackedActorCurrent target (read only)
TeamIDCopied from the possessed turret
FunctionDescription
GetTeamAttitudeFriendly, Neutral or Hostile for an actor. Override to change who the turret attacks
IsHostileGetTeamAttitude is Hostile
OnTeamsChangedEvent: call after changing teams at runtime, so the turret re-checks its target
IsActorStillPerceivedThe actor is seen and hostile
FindOtherHostileFirst perceived hostile actor other than the given one
IsControlledTurretDeadThe possessed turret is dead or dying

Example children in Blueprints/Examples: BP_TurretAIController_01, _02, _03 (sight 600, 1500, 2000 cm) and BP_TurretAIController_AlwaysFriendly.

BP_TurretProjectile​

Blueprints/Turret/BP_TurretProjectile: a sphere with a projectile movement component, no gravity, BlockAllDynamic collision and a life span of 5 seconds. InitializeProjectile(Velocity, TrailEffect) is called by the turret right after spawning. Its OnImpact dispatcher reaches the turret's OnProjectileImpact.

Core​

AC_Health​

Blueprints/Core/AC_Health: health component. Damage arrives through Apply Damage on the owner or through ChangeHealth.

PropertyDefaultDescription
MaxHealth100Health at spawn and upper limit (replicated)
bDamageImmunefalseIgnore damage; healing still applies
HealthCurrent health, server-authoritative (RepNotify)
DeathStateE_DeathState: NotDead, DeathStarted, DeathFinished (RepNotify)
Function or dispatcherDescription
ChangeHealth(Delta, Instigator)Server only. Negative damages, positive heals. Starts death at 0
GetHealth, GetMaxHealth, GetHealthNormalized, IsDeadOrDyingQueries
StartDeath, FinishDeathServer only. Advance the death state
OnHealthChanged, OnMaxHealthChangedDispatchers, fire on every machine
OnDeathStarted, OnDeathFinishedDispatchers, fire on every machine

BFL_Turret​

Blueprints/Core/BFL_Turret: function library.

FunctionDescription
CalculateFiringSolution(ShooterPosition, TargetPosition, TargetVelocity, ProjectileSpeed, ShooterVelocity)Direction to fire so a projectile of that speed intercepts a target moving at constant velocity. Success is false when no interception is possible
GetTeamOfActor(Actor)TeamID from BPI_TeamAgent on the actor, or on its controller for a pawn
GetAttitudeBetweenTeams(TeamA, TeamB)Same team Friendly, other team Hostile

BPI_TeamAgent​

Blueprints/Core/BPI_TeamAgent: interface with GetTeamID. Implement it on a pawn or its controller to give the pawn a team. Actors without it have no team; a pawn without a team is hostile to turrets.

BP_NumberPop​

Blueprints/Core/BP_NumberPop: component that shows damage numbers through NS_DamageNumbers. AddNumberPop(WorldLocation, NumberToDisplay, bIsCriticalDamage).

Damage states and debris​

  • Blueprints/DamageStates/BP_DamageState_Sparks, _Smoke, _Fire: effect actors attached to a damaged turret.
  • Blueprints/Turret/BP_DestroyedTurret1, BP_DestroyedTurret2: debris actors that break apart.

UI​

  • UI/WBP_Healthbar: health bar above a turret (SetHealthPercent).
  • UI/WBP_DemoMessage: the example map's on-screen messages (ShowMessage(Message, Duration)).

Examples​

BlueprintPurpose
BP_TeamPlayerControllerPlayer controller with a TeamID, implements BPI_TeamAgent
BP_TeamPadGives the player its team when stepped on, then calls OnTeamsChanged on every turret controller
BP_ThirdPersonCharacterTemplate character with the demo keys (F, T, X) and ShowDemoMessage
BP_ThirdPersonGameModeUses BP_TeamPlayerController and BP_ThirdPersonCharacter

Animation​

Characters/Turret1/ABP_Turret and Characters/Turret3/ABP_Turret2 rotate the turret head from the pawn's TurretRotation.