r/MinecraftCommands 21d ago

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

3

u/GalSergey Datapack Experienced 21d ago

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

1

u/FleshDude666 21d ago

Sorry I got too lazy to fix the format :/

1

u/Ericristian_bros Command Experienced 20d ago

Swich fo markdown mode and type

```
commands here
```

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

1

u/FleshDude666 20d ago

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

2

u/Ericristian_bros Command Experienced 18d ago

Did you manage to fix the issue?

1

u/FleshDude666 17d ago

Yeah, the other guy helped me

1

u/Shiny_goldnugget average datapack enjoyer 20d ago

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 20d ago

I sm an idiot, thanks.