Controlling mobs


#1

I’m trying to write a simple ai for a mob (for now just make it move from A to B). I think I saw an easy way to implement this a few months back, but now I can’t seem find it anymore.
Can somebody give me a general direction (maybe a link to some code, etc.) where to look? Or is this still not supported?

I apologize if I missed something obvious…

Thanks in advance!


#2

Pathfinding is still not 100% supported. You are able to manipulate the AI by putting some basic ai onto a entity such as “Run around like crazy” but moving a entity to a select location is not supported yet.

If you must have it now you could compare the Vectors of the entities location and the location you want to place them as a vector and then use that vector as velocity for the mob, however that will not account for holes in the ground or height


#3

So there is also no way to implement this on my own?

I’m willing to implement the pathfinding on my own, I’m basically just looking for a way to “attach” some custom code to the entity, which is executed continuously. I think I saw something like that once, but I might have confused that with bukkit/spigot or just made something up.


#4

No no. You can implement it yourself. If you set the velocity of the entity, it will move the entity in the direction. You just need to account for anything getting in the way


#5

Yeah, I saw that, but is there a convenient way to give the logic to the entity, so that it works autonomously (create it, give it some sort of ai object, spawn it, forget about it), or do I have to do something else? (like passing a reference to a thread and let that handle the ai)


#6

You maybe able to use Abstract TaskBuilder


#7

That was exactly what I was looking for! Somehow I missed that when looking through the files.

Thank you!