Adaptive Arsenal Undead

Skeletons fire volleys of arrows at approaching enemies from afar before automatically drawing swords and shields for close-quarters combat.

Java EditionMobs & PetsEasy24 commandsTested on a real 26.2 & 26.3 server
Glowing gilded skeletons switch from bows to swords and shields while fighting iron golems at night. Download the GIF Video & GIF © www.9minecraft.net

Custom MobsMedievalDarkGoldWhiteBlackAdventure MapMini-gameMap MakingSummoned mobsSoundsGlowing outlines21+ commands

Standard skeletons in Minecraft keep trying to shoot arrows even when you are standing right in their face. With the Adaptive Arsenal Undead command setup, skeletons dynamically evaluate the distance to their enemies and switch weapons on the fly.

In this scene, a squad of gilded skeletons fires enchanted arrow volleys at advancing iron golems from across the battlefield. As soon as a golem closes the gap, the skeletons swap their bows for golden swords and shields with a burst of magical particles, charging into melee combat.

1. Setup - type these once 10 commands

  1. /scoreboard objectives add c9_timer dummy
  2. /team add c9_undead
  3. /team modify c9_undead color gold
  4. /team modify c9_undead friendlyFire false
  5. /summon marker ~ ~ ~ {Tags:["c9_ctrl"]}
  6. /summon skeleton ~-6 ~ ~-3 {Tags:["c9_skel","c9_ranged"],Glowing:1b,PersistenceRequired:1b,CustomName:'{"text":"Adaptive Vanguard","color":"gold"}',equipment:{mainhand:{id:"minecraft:bow",count:1,components:{"minecraft:enchantments":{power:3}}},head:{id:"minecraft:golden_helmet",count:1},chest:{id:"minecraft:chainmail_chestplate",count:1}},attributes:[{id:"minecraft:max_health",base:60.0},{id:"minecraft:movement_speed",base:0.28}],Health:60.0f}
  7. /summon skeleton ~-7 ~ ~ {Tags:["c9_skel","c9_ranged"],Glowing:1b,PersistenceRequired:1b,CustomName:'{"text":"Adaptive Vanguard","color":"gold"}',equipment:{mainhand:{id:"minecraft:bow",count:1,components:{"minecraft:enchantments":{power:3}}},head:{id:"minecraft:golden_helmet",count:1},chest:{id:"minecraft:golden_chestplate",count:1}},attributes:[{id:"minecraft:max_health",base:60.0},{id:"minecraft:movement_speed",base:0.28}],Health:60.0f}
  8. /summon skeleton ~-6 ~ ~3 {Tags:["c9_skel","c9_ranged"],Glowing:1b,PersistenceRequired:1b,CustomName:'{"text":"Adaptive Vanguard","color":"gold"}',equipment:{mainhand:{id:"minecraft:bow",count:1,components:{"minecraft:enchantments":{power:3}}},head:{id:"minecraft:golden_helmet",count:1},chest:{id:"minecraft:chainmail_chestplate",count:1}},attributes:[{id:"minecraft:max_health",base:60.0},{id:"minecraft:movement_speed",base:0.28}],Health:60.0f}
  9. /summon iron_golem ~7 ~ ~-2 {Tags:["c9_golem"],Glowing:1b,PersistenceRequired:1b,attributes:[{id:"minecraft:max_health",base:60.0},{id:"minecraft:movement_speed",base:0.26}],Health:60.0f}
  10. /summon iron_golem ~7 ~ ~2 {Tags:["c9_golem"],Glowing:1b,PersistenceRequired:1b,attributes:[{id:"minecraft:max_health",base:60.0},{id:"minecraft:movement_speed",base:0.26}],Health:60.0f}

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

  1. /team join c9_undead @e[tag=c9_skel]
  2. /scoreboard players add @e[tag=c9_ctrl] c9_timer 1
  3. /execute as @e[tag=c9_skel,tag=c9_ranged] at @s if entity @e[tag=c9_golem,distance=..5.5] run tag @s add c9_to_melee
  4. /execute as @e[tag=c9_skel,tag=c9_to_melee] at @s run item replace entity @s weapon.mainhand with golden_sword[enchantments={sharpness:4,knockback:1}]
  5. /execute as @e[tag=c9_skel,tag=c9_to_melee] at @s run item replace entity @s weapon.offhand with shield
  6. /execute as @e[tag=c9_skel,tag=c9_to_melee] at @s run particle sweep_attack ~ ~1.2 ~ 0.3 0.3 0.3 0 3 force
  7. /execute as @e[tag=c9_skel,tag=c9_to_melee] at @s run particle flame ~ ~1 ~ 0.3 0.5 0.3 0.05 15 force
  8. /execute as @e[tag=c9_skel,tag=c9_to_melee] at @s run playsound entity.item.break master @a ~ ~ ~ 1 1.5
  9. /execute as @e[tag=c9_skel,tag=c9_to_melee] run tag @s remove c9_ranged
  10. /execute as @e[tag=c9_skel,tag=c9_to_melee] run tag @s add c9_melee
  11. /execute as @e[tag=c9_skel,tag=c9_to_melee] run tag @s remove c9_to_melee
  12. /execute as @e[tag=c9_skel,tag=c9_melee] at @s unless entity @e[tag=c9_golem,distance=..6.5] run item replace entity @s weapon.mainhand with bow[enchantments={power:3}]
  13. /execute as @e[tag=c9_skel,tag=c9_melee] at @s unless entity @e[tag=c9_golem,distance=..6.5] run item replace entity @s weapon.offhand with air
  14. /execute as @e[tag=c9_skel,tag=c9_melee] at @s unless entity @e[tag=c9_golem,distance=..6.5] run particle enchant ~ ~1.5 ~ 0.4 0.4 0.4 0.5 20 force

How it works

Frames from the test run

Adaptive Arsenal Undead - frame 1Adaptive Arsenal Undead - frame 2Adaptive Arsenal Undead - frame 3

Recorded on our own test server: 58 frames at about 9.7 fps. Our image check saw: Three glowing golden-armored skeletons fight two iron golems at night, switching from bows to swords and shields as the golems get close.

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. Run each of the 10 setup commands in chat while standing at the center of a flat area.
  2. Place a line of 14 repeating command blocks set to Always Active.
  3. Paste one loop command into each repeating command block in order.
  4. Watch the iron golems charge toward the skeleton squad while taking arrow fire.
  5. Observe the skeletons draw their swords and shields with a burst of flame and sweep particles as the golems enter close range.

Use it with real players

To make the skeletons adapt to real survival players instead of only iron golems, replace tag=c9_golem inside loop commands 3, 12, 13, and 14 with type=player,gamemode=!spectator,gamemode=!creative. You will also need to finish the state transition back to ranged by adding two chain command blocks that remove c9_melee and add c9_ranged when no players are within 6.5 blocks.

Remove it again 7 commands

  1. /kill @e[tag=c9_skel]
  2. /kill @e[tag=c9_golem]
  3. /kill @e[tag=c9_ctrl]
  4. /kill @e[type=arrow]
  5. /kill @e[type=item]
  6. /team remove c9_undead
  7. /scoreboard objectives remove c9_timer

FAQ

Why do the skeletons change how they move when given a sword?

In vanilla Minecraft, a skeleton's combat AI depends directly on the item in its main hand. Holding a bow activates ranged strafing AI, while holding any other item activates melee charging AI.

Why are there two different distance checks (5.5 and 6.5 blocks)?

Having a slightly wider distance to switch back to the bow prevents the skeleton from rapidly flickering between sword and bow when an enemy stands right on the boundary.

Commands used

/execute/item/particle/playsound/scoreboard/summon/tag/team

Similar creations

Join 9Minecraft News & Guides