# Debugging When an enemy does something odd, these show why. ## Gameplay Debugger Press **'** (apostrophe) in play, look at an enemy, and open the **Squadcraft** category (number 5 by default). For that enemy: - squad, role and team; - alert state and what it is doing right now (Patrol, Orders, TakeCover, Retreat, Advance, Hide, Peek, Fire, Suppress, BlindFire, Pinned, Reload, Rethink, Flank, Grenade, Evade, Vault, OpenDoor, RegroupOnOrder, CoverCompromised...); - its profile and its suppression (red when suppressed); - every enemy it remembers, with its awareness, whether it is seen, lost or known from the squad, and whether it holds the attack token; - its cover: high or low, and which sides it can lean out from; - the ability system tags (cooldowns, firing, telegraph). In the world it draws a line to each enemy it knows (green when seen, orange to the last known location) and its cover spot with an arrow to the wall. ## Visual Logger Tools > Debug > Visual Logger, press Record, play, stop. Every Squadcraft enemy logs: - every shot, from muzzle to impact (red hit, white miss) with what it hit; - every melee sweep; - every change of alert state and of activity; - the cover it picked and out of how many; - the flank spot it picked; - when its cover stopped hiding it from the target. Scrub the timeline to see the fight again, decision by decision. ## Console | Command | What it shows | |---|---| | `Squadcraft.Debug.Attacks 1` | Every shot and melee sweep drawn in the world for 2 s | | `Squadcraft.Debug.Squads 1` | Every squad in the world: role, doing, suppression and ammo over each AI, a line to its leader, red lines from the attack token holders to their target | | `Squadcraft.Cover.Draw 10` | Every cover spot for 10 s: green high, yellow low, red claimed, cyan the sides to lean out from | | `Squadcraft.Cover.Generate` | Finds cover again over every Nav Mesh Bounds Volume, over the next frames | ## In the editor The **Squadcraft** button on the level editor's toolbar (and the same under **Tools**): - **Preview Cover** finds the cover of the open level right now, without playing, the way the AIs will when play starts, and draws every spot: yellow low, green high, cyan the sides to lean out from. A message says how many and how long it took. Build the navmesh first (Build > Build Paths): cover is found on it. **Clear Cover Preview** takes it away. Change a wall, preview again. With World Partition it covers the cells loaded in the editor. - **Squad Panel** (also Tools > Debug > Squadcraft Squads) lists every Squadcraft AI while the game plays in the editor, squad by squad, four times a second: what it is, its role, what it is doing, its order, its alert state, health (or the time left to bleed out), suppression, morale (broken, surrendered), ammo and cover. Click a name to select the body; the details panel shows the rest. ## The demo's overlay The demo HUD draws over each AI near the camera what it is, its role, what it is doing in plain words ("leaning out", "pinned: firing blind over cover", "dragging a friend to cover"), and three bars: health, suppression, morale. H hides it. It is canvas code in `ASQDemoHUD`, so it shows in a packaged game; copy it for your own debug HUD. It reads the AI controllers, which live on the server: single player and listen server only. ## Common problems **They stand still.** No navmesh (press P), or the controller has no Behavior StateTree (the log says so). **They never find cover.** The Nav Mesh Bounds Volume does not cover the floor near the walls, or the walls don't block the cover trace channel (Visibility by default, Project Settings > Plugins > Squadcraft Cover > Cover Trace Channel). Run `Squadcraft.Cover.Draw` to see what was found. **They don't react to the player.** The player has a team equal to theirs, or Treat Players As Hostile is off. See [Using your own character](2-your-own-character.html). **Shots go through the player.** Shots trace by object type (World Static, World Dynamic, Pawn, Physics Body, Destructible), because character capsules ignore the Visibility channel. If your player's collision uses a custom object type, add it to the fire ability's Shot Object Types. **Animations don't play.** The action is empty in the set, the set is not on the controller, or the Anim Blueprint has no slot with the entry's name (`UpperBody` or `DefaultSlot` on a new set). On clients, the set has to be an asset, not one made at runtime. Bind On Animation Action on the pawn's SQ Animation component to see what arrives. **The player takes no damage.** The engine only damages pawns when a game mode exists, and only on the server. Check that your health system listens to Event AnyDamage.