Automated Tower Defense Wave

Hordes of miniature zombies march along a winding path while four elemental turrets automatically track, target, and blast them with colorful particle beams.

Java EditionMobs & PetsHard24 commandsTested on a real 26.2 & 26.3 server
An overhead view of a miniature tower defense path with glowing enemies and four elemental turrets. Download the GIF Video & GIF © www.9minecraft.net

Mob ParadesMysticMedievalGreenBlackRainbowMini-gameMap MakingDecorationBlock displaysArmor standsRiding & passengersSummoned mobsBlock building (fill/setblock/clone)Rotation math21+ commands

This command creation builds a working tower defense diorama right on your stage. A continuous wave of miniature, glowing zombies marches out of a dark portal and follows an S-shaped path toward the nexus beacon at the end of the track.

Four elemental turrets—Fire, Ice, Arcane, and Void—stand on obsidian pedestals along the curves. Using entity targeting and raycast steps, each turret rotates its crystal head toward the nearest monster and fires colorful particle beams that chip away at the wave before it can reach the goal.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_t dummy
  2. /scoreboard objectives add c9_hp dummy
  3. /fill ~-9 ~-1 ~-5 ~-3 ~-1 ~-3 deepslate_tile_slab[type=bottom]
  4. /fill ~-5 ~-1 ~-3 ~-3 ~-1 ~3 deepslate_tile_slab[type=bottom]
  5. /fill ~-3 ~-1 ~1 ~3 ~-1 ~3 deepslate_tile_slab[type=bottom]
  6. /fill ~3 ~-1 ~-3 ~5 ~-1 ~3 deepslate_tile_slab[type=bottom]
  7. /fill ~5 ~-1 ~-3 ~9 ~-1 ~-1 deepslate_tile_slab[type=bottom]
  8. /summon armor_stand ~-6 ~0.5 ~1 {NoGravity:1b,Invisible:1b,Marker:1b,Tags:["c9_td","c9_tur","c9_fire"],Passengers:[{id:"minecraft:block_display",Tags:["c9_td"],block_state:{Name:"minecraft:polished_blackstone_wall"},transformation:{scale:[0.8f,1.4f,0.8f],translation:[-0.4f,-0.9f,-0.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_td","c9_head"],Glowing:1b,glow_color_override:16733525,block_state:{Name:"minecraft:magma_block"},transformation:{scale:[0.7f,0.7f,0.7f],translation:[-0.35f,0.3f,-0.35f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}]}
  9. /summon armor_stand ~-1 ~0.5 ~-2 {NoGravity:1b,Invisible:1b,Marker:1b,Tags:["c9_td","c9_tur","c9_ice"],Passengers:[{id:"minecraft:block_display",Tags:["c9_td"],block_state:{Name:"minecraft:polished_blackstone_wall"},transformation:{scale:[0.8f,1.4f,0.8f],translation:[-0.4f,-0.9f,-0.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_td","c9_head"],Glowing:1b,glow_color_override:5636095,block_state:{Name:"minecraft:blue_ice"},transformation:{scale:[0.7f,0.7f,0.7f],translation:[-0.35f,0.3f,-0.35f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}]}
  10. /summon armor_stand ~1 ~0.5 ~5 {NoGravity:1b,Invisible:1b,Marker:1b,Tags:["c9_td","c9_tur","c9_arc"],Passengers:[{id:"minecraft:block_display",Tags:["c9_td"],block_state:{Name:"minecraft:polished_blackstone_wall"},transformation:{scale:[0.8f,1.4f,0.8f],translation:[-0.4f,-0.9f,-0.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_td","c9_head"],Glowing:1b,glow_color_override:16755200,block_state:{Name:"minecraft:amethyst_block"},transformation:{scale:[0.7f,0.7f,0.7f],translation:[-0.35f,0.3f,-0.35f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}]}

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

  1. /execute unless entity @e[tag=c9_void] run summon armor_stand ~6 ~0.5 ~1 {NoGravity:1b,Invisible:1b,Marker:1b,Tags:["c9_td","c9_tur","c9_void"],Passengers:[{id:"minecraft:block_display",Tags:["c9_td"],block_state:{Name:"minecraft:polished_blackstone_wall"},transformation:{scale:[0.8f,1.4f,0.8f],translation:[-0.4f,-0.9f,-0.4f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}},{id:"minecraft:block_display",Tags:["c9_td","c9_head"],Glowing:1b,glow_color_override:5592575,block_state:{Name:"minecraft:crying_obsidian"},transformation:{scale:[0.7f,0.7f,0.7f],translation:[-0.35f,0.3f,-0.35f],left_rotation:[0f,0f,0f,1f],right_rotation:[0f,0f,0f,1f]}}]}
  2. /scoreboard players add #tick c9_t 1
  3. /execute if score #tick c9_t matches 18.. run scoreboard players set #tick c9_t 0
  4. /execute if score #tick c9_t matches 0 run summon zombie ~-8 ~-0.5 ~-4 {Silent:1b,NoAI:1b,IsBaby:1b,Glowing:1b,Tags:["c9_td","c9_mob"],armor_items:[{},{},{},{id:"minecraft:NETHERITE_HELMET",count:1}],attributes:[{id:"minecraft:scale",base:0.75d}]}
  5. /execute as @e[tag=c9_mob] unless score @s c9_hp matches -100..500 run scoreboard players set @s c9_hp 24
  6. /execute as @e[tag=c9_mob] run scoreboard players add @s c9_t 1
  7. /execute as @e[tag=c9_mob,scores={c9_t=1..40}] at @s run tp @s ~0.1 ~ ~ ~-90 0
  8. /execute as @e[tag=c9_mob,scores={c9_t=41..100}] at @s run tp @s ~ ~ ~0.1 ~ 0
  9. /execute as @e[tag=c9_mob,scores={c9_t=101..180}] at @s run tp @s ~0.1 ~ ~ ~-90 0
  10. /execute as @e[tag=c9_mob,scores={c9_t=181..220}] at @s run tp @s ~ ~ ~-0.1 ~180 0
  11. /execute as @e[tag=c9_mob,scores={c9_t=221..265}] at @s run tp @s ~0.1 ~ ~ ~-90 0
  12. /execute as @e[tag=c9_tur] at @s facing entity @e[tag=c9_mob,distance=..6,sort=nearest,limit=1] feet run tp @s ~ ~ ~ ~ ~
  13. /execute if score #tick c9_t matches 5 as @e[tag=c9_tur] at @s if entity @e[tag=c9_mob,distance=..6] facing entity @e[tag=c9_mob,distance=..6,sort=nearest,limit=1] eyes positioned ~ ~0.65 ~ run particle dust{color:[1.0,0.3,0.0],scale:1.2} ^ ^ ^1 0.05 0.05 0.05 0 3 force
  14. /execute if score #tick c9_t matches 5 as @e[tag=c9_tur] at @s facing entity @e[tag=c9_mob,distance=..6,sort=nearest,limit=1] eyes positioned ~ ~0.65 ~ positioned ^ ^ ^2.2 run particle flame ~ ~ ~ 0.1 0.1 0.1 0.02 6 force

How it works

Frames from the test run

Automated Tower Defense Wave - frame 1Automated Tower Defense Wave - frame 2Automated Tower Defense Wave - frame 3

Recorded on our own test server: 41 frames at about 6.8 fps. Our image check saw: Miniature glowing entities march along a dark S-shaped path on a grassy platform while four colored turrets rotate beside the track.

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. Create a flat grass area at least 25x25 blocks wide.
  2. Stand in the center of your area and run each command from the Setup list in chat to carve the sunken path and place the turrets.
  3. Place a repeating command block below the center of the stage and set it to Always Active.
  4. Chain 13 conditional/unconditional Chain Command Blocks (Always Active) onto the repeating block and paste the 14 Loop commands in order.
  5. Add one extra repeating command block with: /execute as @e[tag=c9_tur] at @s if score #tick c9_t matches 5 run scoreboard players remove @e[tag=c9_mob,distance=..6,sort=nearest,limit=1] c9_hp 7 — and another with: /kill @e[tag=c9_mob,scores={c9_t=265..}] and /kill @e[tag=c9_mob,scores={c9_hp=..0}] if you want monsters to vanish without a full command block chain.

Use it with real players

To let players place turrets dynamically, give yourself a spawn egg with a custom tag and summon the turret structure wherever that entity lands. You can also replace the fixed zombie path with standard AI zombies pathfinding toward a villager at the end of the track.

Remove it again 5 commands

  1. /tp @e[tag=c9_td] ~ ~-100 ~
  2. /kill @e[tag=c9_td]
  3. /fill ~-9 ~-1 ~-5 ~9 ~-1 ~5 grass_block
  4. /scoreboard objectives remove c9_t
  5. /scoreboard objectives remove c9_hp

FAQ

Why do the zombies walk smoothly along the corners without getting stuck?

They have NoAI enabled and are moved by a tick counter on the c9_t scoreboard. At exact tick milestones (40, 100, 180, 220), they switch direction by 90 degrees.

Can I change the range of the elemental turrets?

Yes! Change distance=..6 in the last three loop commands to any radius you want, such as distance=..10 for long-range sniper towers.

Commands used

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

Similar creations

Join 9Minecraft News & Guides