How animate a living entity with mcfunction files ?

Started by amogytp on

Topic category: Advanced modding

Joined Feb 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How animate a living entity with mcfunction files ?

Hello,

I'm French, so I don't speak naturally English. I use MCreator for create an AI mod, but I have a big problem: my entities doesn't move(not move right, left, forward, back...). I used an mcfunction file, but it is the same result. There is the content(I don't know the system of mcfunction, so I asking ChatGPT):

# 1.
execute as @e[type=ia_v3:null_gpt] at @s run tp @s ^ ^ ^0.5 facing entity @p
execute as @e[type=ia_v3:null_gpt] at @s if block ~ ~1 ~ air run tp @s ^ ^1 ^

# 2.
execute as @e[type=ia_v3:null_gpt] at @s run execute if block ~ ~-1 ~ minecraft:dirt run setblock ~ ~ ~ minecraft:planks
execute as @e[type=ia_v3:null_gpt] at @s run execute if block ~ ~1 ~ minecraft:log run setblock ~ ~1 ~ air

# 3.
execute as @e[type=ia_v3:null_gpt] at @s run execute if entity @e[type=item,nbt={Item:{id:"minecraft:apple"}},distance=..2] run effect give @s saturation 1 1
execute as @e[type=ia_v3:null_gpt] at @s run execute if entity @e[type=item,nbt={Item:{id:"minecraft:torch"}},distance=..2] run setblock ~ ~ ~ minecraft:torch

# 4.
execute as @e[type=ia_v3:null_gpt] at @s run execute if entity @e[type=zombie,distance=..3] run damage @e[type=zombie,distance=..3] 4
execute as @e[type=ia_v3:null_gpt] at @s run execute if entity @e[type=zombie,distance=..3] run say Je t’attaque, zombie !

# 5.
execute as @e[type=ia_v3:null_gpt] at @s store result score @s HealthData run data get entity @s Health
execute as @e[type=ia_v3:null_gpt] at @s if score @s HealthData matches ..10 run effect give @s regeneration 5 1
execute as @e[type=ia_v3:null_gpt] at @s run execute if score @s HealthData matches ..10 run say J’ai faim...

# 6.
execute as @e[type=ia_v3:null_gpt] at @s run tp @s ~ ~ ~ ~[random(360)] ~[random(30)]

# 7.
execute as @e[type=ia_v3:null_gpt] at @s run execute if entity @p[distance=..3] run say Coucou, je suis un joueur IA !
execute as @e[type=ia_v3:null_gpt] at @s run execute if entity @e[type=creeper,distance=..5] run say Aaaah, un creeper !!

Thank you very much,

An user of MCreator