I want to make npc’s walk into a museum, look around at some art and items, then leave. How would i make them find the art and walk to it, since the art is placed by players, and how do i detect if the npc’s path is blocked?
It depends entirely on how much freedom you’re giving to the users. If art can only be placed in pre-determined locations then the problem becomes much easier to solve. If using pre-determined locations you can compute a path from where the NPCs will come from to each location and reuse it.
You can use pathfinding service.
The concept is similar to restaurant simulator 2, players can place tables and seats anywhere they want, but the npc’s walk in and find the table themselves.
But i assume that they will just walk straight to the art, i want them to walk in paths
You can create paths using pathfinding service.
In this case the same logic still applies but you need to recompute a path if it becomes blocked. You should be able to use the Path.Blocked
event for that. Roaming isn’t really as straight forward but you could use some randomness to determine if they go straight to the art or towards another point of interest first.
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.