Summon a tactical skeleton boss that switches between an enchanted bow and a diamond sword in real time while fighting iron golems inside a custom arena.
Custom MobsDarkMedievalFireRedCyanBlackBoss FightAdventure MapMap MakingText displaysSummoned mobsBlock building (fill/setblock/clone)Sounds21+ commands
Normal skeletons keep trying to shoot their bow even when an enemy is right in their face. This command creation spawns the Tactical Duelist, a custom boss that measures the distance to its target and switches weapons automatically. When an Iron Golem is far away, the boss fires flaming arrows from a glowing cyan stance. As soon as a golem steps within four blocks, the skeleton equips a diamond sword, dashes forward in a red burst of particles, and fights in close quarters.
A floating status hologram follows the boss around the dark stone arena, showing whether it is currently in Ranged Stance or Melee Blade Stance while a custom health bar tracks the fight.
/scoreboard objectives add c9_duel dummy/team add c9_ranged/team modify c9_ranged color aqua/team add c9_melee/team modify c9_melee color red/fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 polished_blackstone_bricks/fill ~-9 ~ ~-9 ~9 ~ ~9 blackstone_wall replace air/fill ~-8 ~ ~-8 ~8 ~ ~8 air/summon skeleton ~-4 ~ ~ {Tags:["c9_entity","c9_duelist"],CustomName:{"text":"Tactical Duelist","color":"gold","bold":true},CustomNameVisible:1b,Glowing:1b,PersistenceRequired:1b,Health:180f,equipment:{mainhand:{id:"minecraft:bow",count:1,components:{"minecraft:enchantments":{power:4,flame:1}}},head:{id:"minecraft:netherite_helmet",count:1},chest:{id:"minecraft:chainmail_chestplate",count:1,components:{"minecraft:enchantments":{protection:4}}},legs:{id:"minecraft:chainmail_leggings",count:1},feet:{id:"minecraft:netherite_boots",count:1}},attributes:[{id:"minecraft:max_health",base:180.0},{id:"minecraft:movement_speed",base:0.34},{id:"minecraft:knockback_resistance",base:0.8},{id:"minecraft:attack_damage",base:10.0}]}/summon text_display ~-4 ~2.6 ~ {Tags:["c9_entity","c9_hud"],billboard:"center",text:{"text":"[ RANGED STANCE ]","color":"aqua","bold":true},background:1073741824}/execute unless entity @e[tag=c9_golem] if entity @e[tag=c9_duelist] run summon iron_golem ~4 ~ ~ {Tags:["c9_entity","c9_golem"],CustomName:{"text":"Arena Challenger","color":"aqua"},Health:45f}/execute as @e[tag=c9_duelist] at @s run tp @e[tag=c9_hud] ~ ~2.5 ~/execute as @e[tag=c9_duelist] at @s if entity @e[tag=c9_golem,distance=..4.5] unless entity @s[tag=c9_in_melee] run tag @s add c9_to_melee/execute as @e[tag=c9_duelist,tag=c9_to_melee] at @s run item replace entity @s weapon.mainhand with diamond_sword[enchantments={sharpness:5,fire_aspect:2}]/execute as @e[tag=c9_duelist,tag=c9_to_melee] at @s run data merge entity @e[tag=c9_hud,limit=1] {text:{"text":"[ MELEE BLADE ]","color":"red","bold":true}}/execute as @e[tag=c9_duelist,tag=c9_to_melee] at @s run particle sweep_attack ~ ~1.2 ~ 0.6 0.4 0.6 0 6 force/execute as @e[tag=c9_duelist,tag=c9_to_melee] at @s run playsound entity.item.break master @a ~ ~ ~ 1 1.4/execute as @e[tag=c9_duelist,tag=c9_to_melee] run team join c9_melee @s/execute as @e[tag=c9_duelist,tag=c9_to_melee] run tag @s add c9_in_melee/tag @e[tag=c9_duelist,tag=c9_to_melee] remove c9_to_melee/execute as @e[tag=c9_duelist,tag=c9_in_melee] at @s unless entity @e[tag=c9_golem,distance=..5.2] run item replace entity @s weapon.mainhand with bow[enchantments={power:4,flame:1,punch:2}]/execute as @e[tag=c9_duelist,tag=c9_in_melee] at @s unless entity @e[tag=c9_golem,distance=..5.2] run data merge entity @e[tag=c9_hud,limit=1] {text:{"text":"[ RANGED STANCE ]","color":"aqua","bold":true}}/execute as @e[tag=c9_duelist,tag=c9_in_melee] at @s unless entity @e[tag=c9_golem,distance=..5.2] run team join c9_ranged @s/execute as @e[tag=c9_duelist,tag=c9_in_melee] at @s unless entity @e[tag=c9_golem,distance=..5.2] run tag @s remove c9_in_meleesetup #9 Summons the Tactical Duelist skeleton with 180 health, high knockback resistance, faster movement speed, and netherite-trimmed chainmail armor using the <code>equipment</code> NBT compound.loop #3 Checks if an Iron Golem is within 4.5 blocks of the skeleton. If the skeleton is not already in melee mode, it adds a temporary transition tag <code>c9_to_melee</code> so the weapon swap and sound effects only trigger once.loop #4 Uses <code>/item replace</code> to swap the skeleton's mainhand weapon to a Sharpness V, Fire Aspect II diamond sword. Vanilla skeletons automatically switch from bow AI to melee attack AI when given a sword.loop #11 Monitors when no target is within 5.2 blocks (either pushed back by knockback or defeated) and swaps the skeleton's mainhand back to a Power IV, Punch II bow.


Recorded on our own test server: 59 frames at about 9.7 fps. Our image check saw: A red-glowing skeleton labeled 'Tactical Duelist' in 'MELEE BLADE' mode fights burning Iron Golems at close range with a diamond sword on a dark stone arena.
Commands, video and screenshots: tested and recorded by www.9minecraft.net © 9Minecraft. Sharing a video or screenshot? Please credit www.9minecraft.net.
To fight the boss yourself in survival mode, skip the first loop command that spawns Iron Golems and replace @e[tag=c9_golem,distance=..4.5] and @e[tag=c9_golem,distance=..5.2] in the loop commands with @a[gamemode=!spectator,distance=..4.5] and @a[gamemode=!spectator,distance=..5.2]. The skeleton will then detect players rushing in and pull out its diamond sword to defend itself.
/tp @e[tag=c9_entity] ~ ~-200 ~/kill @e[tag=c9_entity]/team remove c9_ranged/team remove c9_melee/scoreboard objectives remove c9_duel/fill ~-9 ~ ~-9 ~9 ~ ~9 air/fill ~-9 ~-1 ~-9 ~9 ~-1 ~9 grass_blockIn Minecraft Java Edition, a skeleton's AI checks what item it is holding in its main hand. When it holds a bow, it uses ranged strafing AI, and the moment its main hand is replaced with a sword, it immediately switches to melee pathfinding.
Using 4.5 blocks to enter melee mode and 5.2 blocks to return to ranged mode creates a small buffer zone so the boss does not rapidly flicker back and forth when an enemy stands right on the boundary.
/data/execute/fill/item/particle/playsound/scoreboard/summon/tag/team/tp
▶Choreographed Blade Master CombosCustom MobsHard24 cmds
▶Apocalypse Riders vs. Sky Raiders Automated BattleCustom MobsHard24 cmds
▶Stealth Assassins vs Armored Champions ArenaCustom MobsMedium24 cmds
▶Arrow Storm Boss AttackCustom MobsMedium18 cmds
▶Awakened Mimic Chest MobCustom MobsMedium24 cmds
▶Explosive Bat SwarmCustom MobsEasy24 cmds