If you read my post last week, you’ll know I was rather excited about the fact that my NPCs were pretty much all working, and life was wonderful. Except as I’m...
Your answer here is : State Machine.
It's tricky and hard, (breaking teeth on this on my next game…) but it's a good way to start. There is a very good plugin for C3 called FSM for this.
Doc here : gameprogrammingpatterns.com/state.html