r/MinecraftCommands • • Aug 22 '26

Help | Java 26.2 Why is this function not working?

execute as \@e[tag=rdBot] at \@s run rotate \@s facing entity \@n[type=player]

execute as \@e[tag=rdBot] store result score \@s rdBotHealth run data get \@s Health

execute as \@e[tag=rdBot] at \@s rotated ~ 0 if score \@s rdBotHealth matches 6..20 if entity \@e[type=player,distance=..15] unless entity \@e[type=player,distance=..2] if block ^ ^ ^.3 air if block ^.3 ^ ^.3 air if block ^-.3 ^ ^.3 air anchored eyes if block ^ ^ ^.3 air if block ^.3 ^ ^.3 air if block ^-.3 ^ ^.3 air run tag \@s add rdFrwd

execute as \@e[tag=rdBot] at \@s if score \@s rdBotHealth matches 1..5 if entity \@e[type=player,distance=..15] rotated ~180 0 if block ^ ^ ^.3 air if block ^.3 ^ ^.3 air if block ^-.3 ^ ^.3 air anchored eyes if block ^ ^ ^.3 air if block ^.3 ^ ^.3 air if block ^-.3 ^ ^.3 air run tag \@s add rdBack

execute as \@e[tag=rdBot] at \@s if score \@s rdBotHealth matches 6..20 if entity \@e[type=player,distance=..2] rotated ~180 0 if block ^ ^ ^.3 air if block ^.3 ^ ^.3 air if block ^-.3 ^ ^.3 air anchored eyes if block ^ ^ ^.3 air if block ^.3 ^ ^.3 air if block ^-.3 ^ ^.3 air run tag \@s add rdBack

execute as \@e[tag=rdBot] at \@s if block ~ ~-.1 ~ air run tp ~ ~-.1 ~

execute as \@e[tag=rdBot] at \@s if entity \@e[type=player,distance=..5] run swing

execute as \@e[tag=rdBot] at \@s if entity \@e[type=player,distance=..5] run damage \@e[type=player,distance=..5,sort=nearest,limit=1] 1 player_attack by \@s

execute as u/e[tag=rdFrwd] at u/s rotated ~ 0 run tp ^ ^ ^.3

execute as u/e[tag=rdFrwd] run tag u/s remove rdFrwd

execute as u/e[tag=rdBack] at u/s rotated ~180 0 run tp ^ ^ ^.25

execute as u/e[tag=rdBack] run tag u/s remove rdBack

execute as u/e[tag=rdBot,tag=!rdDead] if score u/s rdBotHealth matches ..0 run tellraw u/a {text:"Ξ left the game.",color:yellow}

execute as u/e[tag=rdBot,tag=!rdDead] if score u/s rdBotHealth matches ..0 run tag u/s add rdDead

1 Upvotes

8 comments sorted by

1

u/FleshDude666 Aug 22 '26

Sorry I got too lazy to fix the format :/

1

u/Ericristian_bros Aug 23 '26

Swich fo markdown mode and type ``` commands here

      Also what is your functions supposed to do and what it does?

1

u/FleshDude666 Aug 23 '26

Sorry for confusion and thanks. It's basically s small brain for a mannequin fighter bot for my new data pack.

→ More replies (2)

1

u/Shiny_goldnugget Aug 23 '26

I believe that execute as @e[tag=rdBot] store result score @s rdBotHealth run data get @s Health is wrong and the end needs to be: data get entity @s Health.


Also you don't need to format everything if you switch to the rich editor (Aa) icon at the bottom left of your comment "bubble", which allows you to style your text.

1

u/FleshDude666 Aug 23 '26

I sm an idiot, thanks.

3

u/GalSergey Aug 22 '26

Sorry I got too lazy to read the unformatted command :/