So, the documentation on the wiki for SNPC’s is pretty terrible. There is only one real example, with none of it explained, and a note that basically says don’t touch any of this.
After reading through some code, and Garry’s blog post, I’ve got a pretty good understanding of how the AI scheduling works. However, I’m unsure how to use it for my specific case.
I’ve got an npc that has an entity as a property. Call it MyTarget. MyTarget will move around the map, and I’d like the npc to follow MyTarget around. I thought about using TASK_SET_GOAL and then TASK_GET_PATH_TO_GOAL, but I’m not sure about how to pass MyTarget as the goal.
If anyone would like to point me in the right direction, here is the basic AI I am trying to implement.
Idle: Follow MyTarget around, staying within a certain distance of it.
Aggro: When an enemy moves into range, attack it. If the enemy moves outside of the range, or pursuing the enemy would cause the npc to move too far away from MyTarget, then switch back to Idle
Again, I’ve tried looking through the wiki, but the docs are terribad.