Imagine I have a command X. When I issue it, I want a certain entity (villager) walk to a certain location.
Not teleport, but walk, i. e. move to the location in the time it normally takes him in Minecraft. It’s important for me to make this walking more or less natural because I need this for a certain simulation and it’s convenient to see what that villager is doing at the moment.
How can I make a villager walk from location X to location Y?
@Socratic_Phoenix I don’t need any AI because the target location is right in front of the villager, nothing complicated. I’m asking about what code I need to write in order for the villager to start moving so that I can see it.
What I want is this:
Villager X stands at location Y (Y is some distance away from X but he just needs to go straight to it, no turns).
I issue some command.
Thereafter X makes several steps forward, such that I can see it (I can see, how he walks to the target destination and this happens with the same speed, as if a human would control him).
You do need the AI, because it’s the AI that tells the villager to walk.
You could make a villager with no AI, and run a task every tick that teleports him forward a bit… You’d have to do vector math and stuff if you want it to work in every case.
To nagivate from point A to point B, you will need some form of pathfinding.
However, to player the actual walking animation, you can simply teleport the entity a small distance in the proper direction. This causes the client to render the walking animation.