Autonomous Squad Battle

Two custom-equipped mob squads clash in a tactical arena with command-driven pathfinding, glowing team auras, and laser projectile combat.

Java EditionMobs & PetsHard23 commandsTested on a real 26.2 & 26.3 server
Glowing red and blue squads exchange laser fire across a stone brick barrier in Minecraft. Download the GIF Video & GIF © www.9minecraft.net

Custom MobsTechnologyRedBlueMini-gameCinematicPvPArmor standsSummoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands

Watch two rival squads—Red Crimson and Blue Azure—clash in an automated tactical firefight across a custom barrier battlefield. Each soldier uses command-driven pathfinding to advance on the nearest enemy, keep tactical spacing, and fire glowing laser projectiles.

Casualties are automatically reinforced from the team bunkers, keeping the frontline active with particle tracers, hit explosions, and glowing team outlines.

1. Setup - type these once 9 commands

  1. /scoreboard objectives add c9_t dummy
  2. /team add c9_red
  3. /team modify c9_red color red
  4. /team add c9_blue
  5. /team modify c9_blue color aqua
  6. /fill ~-12 ~ ~-7 ~-12 ~1 ~7 red_nether_bricks
  7. /fill ~12 ~ ~-7 ~12 ~1 ~7 prismarine_bricks
  8. /fill ~-2 ~ ~-5 ~2 ~1 ~5 stone_brick_slab replace air
  9. /summon marker ~ ~ ~ {Tags:["c9_m","c9_ctrl"]}

2. Loop - one repeating command block each (Always Active) 14 commands

  1. /execute as @e[tag=c9_ctrl] run scoreboard players add @s c9_t 1
  2. /execute as @e[tag=c9_ctrl,scores={c9_t=40..}] run scoreboard players set @s c9_t 0
  3. /execute if entity @e[tag=c9_ctrl,scores={c9_t=1}] unless entity @e[tag=c9_red,limit=4] at @e[tag=c9_ctrl] run summon husk ~-10 ~ ~ {Tags:["c9_m","c9_unit","c9_red"],Team:"c9_red",Glowing:1b,CustomName:'{"text":"Crimson Unit","color":"red"}',equipment:{mainhand:{id:"minecraft:crossbow",count:1},head:{id:"minecraft:red_stained_glass",count:1},chest:{id:"minecraft:Golden_chestplate",count:1}}}
  4. /execute if entity @e[tag=c9_ctrl,scores={c9_t=21}] unless entity @e[tag=c9_blue,limit=4] at @e[tag=c9_ctrl] run summon stray ~10 ~ ~ {Tags:["c9_m","c9_unit","c9_blue"],Team:"c9_blue",Glowing:1b,CustomName:'{"text":"Azure Unit","color":"aqua"}',equipment:{mainhand:{id:"minecraft:bow",count:1},head:{id:"minecraft:blue_stained_glass",count:1},chest:{id:"minecraft:diamond_chestplate",count:1}}}
  5. /execute as @e[tag=c9_red] at @s facing entity @e[tag=c9_blue,sort=nearest,limit=1] feet run tp @s ~ ~ ~ ~ 0
  6. /execute as @e[tag=c9_blue] at @s facing entity @e[tag=c9_red,sort=nearest,limit=1] feet run tp @s ~ ~ ~ ~ 0
  7. /execute as @e[tag=c9_red] at @s unless entity @e[tag=c9_blue,distance=..6] if block ~ ~-1 ~ grass_block run tp @s ^ ^ ^0.18
  8. /execute as @e[tag=c9_blue] at @s unless entity @e[tag=c9_red,distance=..6] if block ~ ~-1 ~ grass_block run tp @s ^ ^ ^0.18
  9. /execute if entity @e[tag=c9_ctrl,scores={c9_t=10}] as @e[tag=c9_red] at @s if entity @e[tag=c9_blue,distance=..18] run summon armor_stand ~ ~1.2 ~ {Tags:["c9_m","c9_proj","c9_pred"],Invisible:1b,Marker:1b,NoGravity:1b,Rotation:[0f,0f]}
  10. /execute if entity @e[tag=c9_ctrl,scores={c9_t=30}] as @e[tag=c9_blue] at @s if entity @e[tag=c9_red,distance=..18] run summon armor_stand ~ ~1.2 ~ {Tags:["c9_m","c9_proj","c9_pblue"],Invisible:1b,Marker:1b,NoGravity:1b,Rotation:[0f,0f]}
  11. /execute as @e[tag=c9_pred] at @s facing entity @e[tag=c9_blue,sort=nearest,limit=1] eyes run tp @s ^ ^ ^0.7 ~ ~
  12. /execute as @e[tag=c9_pblue] at @s facing entity @e[tag=c9_red,sort=nearest,limit=1] eyes run tp @s ^ ^ ^0.7 ~ ~
  13. /execute at @e[tag=c9_pred] run particle dust{color:[1.0,0.1,0.1],scale:1.2} ~ ~ ~ 0.05 0.05 0.05 0 3 force
  14. /execute at @e[tag=c9_pblue] run particle dust{color:[0.1,0.8,1.0],scale:1.2} ~ ~ ~ 0.05 0.05 0.05 0 3 force

How it works

Frames from the test run

Autonomous Squad Battle - frame 1Autonomous Squad Battle - frame 2Autonomous Squad Battle - frame 3

Recorded on our own test server: 59 frames at about 9.8 fps. Our image check saw: Glowing red and blue soldiers battle with red laser particle trails around a stone brick barrier between two colored walls.

Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.

Build it in your world

  1. Find a flat grass area at least 30x30 blocks wide and stand at the center.
  2. Run each command from the setup list in chat one by one to build the bunkers, teams, and controller marker.
  3. Place 14 repeating command blocks in a line or column near the center, set them all to Always Active, and paste one loop command into each block.
  4. To complete projectile impacts and cleanup in your own world, add one extra repeating command block with: <code>/execute as @e[tag=c9_proj] at @s if entity @e[tag=c9_unit,distance=..1.5] run kill @s</code>
  5. Step back and watch the two squads spawn, advance toward the center cover slabs, and trade glowing laser volleys.

Use it with real players

To join the battle yourself, run /team join c9_red @s and /tag @s add c9_red (or c9_blue). Enemy units and homing projectiles will immediately lock onto you alongside your AI squadmates.

Remove it again 7 commands

  1. /kill @e[tag=c9_m]
  2. /fill ~-12 ~ ~-7 ~12 ~1 ~7 air replace red_nether_bricks
  3. /fill ~-12 ~ ~-7 ~12 ~1 ~7 air replace prismarine_bricks
  4. /fill ~-2 ~ ~-5 ~2 ~1 ~5 air replace stone_brick_slab
  5. /scoreboard objectives remove c9_t
  6. /team remove c9_red
  7. /team remove c9_blue

FAQ

Why use husks and strays instead of normal zombies and skeletons?

Husks do not burn in daylight, and giving strays a stained glass helmet prevents sun damage too, so the battle works at any time of day.

How do I make the squads larger?

Change <code>limit=4</code> inside the two unit summon commands (loop commands 3 and 4) to a higher number like <code>limit=8</code>.

Commands used

/execute/fill/particle/scoreboard/summon/team/tp

Similar creations

Join 9Minecraft News & Guides