Is it possible to make simple AI?

Nothing too huge. I would like to make a small town. With villagers and all that.
All i want the villagers to do is walk around. Occasionally sit on a bench. And attack me if I hit them first.
My experience in coding isnt huge. Some college courses on c++, java, and linux. But nothing on lua.
Is it possible to have an npc do any of these things?

I know that it’s possible to have them walk around and attack you if you hit them first, but there might not be animations in the model for sitting down, so that might not work.

I guess I can live without the sitting. But how do you have them walk around?

Look around for an A* algorithm for movement.


There’s probably an easier way though.

There is an A* module on the wiki, iirc.
You should just be able to do this with a SNPC - just have them always wander around randomly, I believe the capabilities are there in the NPC library.
Getting SNPC’s to work correctly can be a huge pain in the dick though. I have yet to make an effective one.

As for sitting, I believe the citizens have sitting animations, they should at least since in the beginning of HL2 there are a few sitting on benches. The trouble with that is having them find said prop, then sitting on it at the correct angle.

Could be done I would think, but might be a huge PITA.

I think you could use the normal AI and just create your own schedules and tasks, that way you don’t have to code your own pathfinding system.