Knowledge base
Knowledge base
Knowledge base
Free, anonymous browsing of Unreal Engine Blueprint examples, node references, and best practices. The same content the WoalzCraft plugin uses to generate Blueprints.
21 results for patrol
Variables: WaypointLocations (Array<Vector>), CurrentWaypointIndex (int). Pattern: EventBeginPlay → set up WaypointLocations array → MoveToNextWaypoint (custom event). MoveToNextWaypoint: GetController → CastTo<AIController> → MoveToLocation(Dest=WaypointLocations[CurrentWaypointIndex], AcceptanceRadius=100) → Bind OnMoveCompleted delegate → In callback: Increment CurrentWaypointIndex (modulo array length) → call MoveToNextWaypoint again. Alternative: Use SimpleMoveToLocation for simpler cases. Requires NavMeshBoundsVolume in scene. GetRandomReachablePointInRadius for random wander.
Pattern: Variables PatrolPoints(Array<Vector>), CurrentIndex(int)=0. BeginPlay: SimpleMoveToLocation(PatrolPoints[0]). OnMoveCompleted (or Tick+distance check): SET CurrentIndex = (CurrentIndex+1) % Array_Length → SimpleMoveToLocation(PatrolPoints[CurrentIndex]). Add Delay between moves for wait time. Use AIMoveTo for more control.
Pattern: Pickup actor with SphereCollision(overlap), StaticMesh visual. OnComponentBeginOverlap → CastTo PlayerCharacter → Success: call AddScore/AddItem interface on player → PlaySoundAtLocation → SpawnEmitterAtLocation → DestroyActor(self). Set collision to OverlapOnlyPawn for performance.
Pattern: Variables CurrentWave(int)=0, EnemiesAlive(int)=0, EnemiesPerWave(Array<int>). StartWave: CurrentWave++ → SET EnemiesAlive=EnemiesPerWave[CurrentWave]. Timer looping: Branch(SpawnedThisWave < EnemiesPerWave[CurrentWave]) → SpawnActor(EnemyClass, RandomSpawnPoint) → SpawnedThisWave++. OnEnemyDeath: EnemiesAlive-- → Branch(EnemiesAlive <= 0) → StartNextWave or Victory.
Legacy Cascade system. Prefer Niagara (SpawnSystemAtLocation) for new projects.
SpawnEmitterAtLocationUE 5.3, 5.4, 5.5, 5.6, 5.7updated 2mo agoPattern: EventAnyDamage → Subtract_FloatFloat(A=CurrentHealth, B=Damage) → Clamp(Value=Result, Min=0, Max=MaxHealth) → SetVariable(Health=ClampResult) → Branch(Condition=(Health <= 0)) → True: call OnDeath custom event. Variables needed: Health (float), MaxHealth (float). EventAnyDamage output pin is 'Damage' (float). Clamp inputs: 'Value', 'Min', 'Max'. All floats.
Pattern: Variables bIsSprinting(bool), Stamina(float)=100, MaxStamina(float)=100, SprintSpeed(float)=1200, WalkSpeed(float)=600, DrainRate(float)=20, RecoverRate(float)=10. Sprint pressed: bIsSprinting=true → SetMaxWalkSpeed(SprintSpeed). Released: bIsSprinting=false → SetMaxWalkSpeed(WalkSpeed). Tick: Branch(bIsSprinting) → Stamina -= DrainRate*DT. Else: Stamina += RecoverRate*DT. Clamp(0, Max). If Stamina<=0 → force stop sprint.
UNiagaraFunctionLibrary::SpawnSystemAtLocation. bAutoDestroy=true for fire-and-forget. Use SpawnSystemAttached to attach to a component.
SpawnSystemAtLocationUE 5.3, 5.4, 5.5, 5.6, 5.7updated 2mo agoDealing damage: Event → ApplyDamage(TargetActor, BaseDamage, InstigatorController, DamageCauser, DamageTypeClass). Receiving: EventAnyDamage → Damage output → Subtract_FloatFloat(CurrentHealth, Damage) → FClamp(Result, 0, MaxHealth) → SET CurrentHealth → Branch(CurrentHealth <= 0) → True: DestroyActor. Initialize CurrentHealth=MaxHealth in BeginPlay.