How would I make a task system for npc's?

I’m trying to wrap my head around how I would create a task system (Something like in rimword) where I have a list of tasks that need to be done, (harvest trees, build something, etc, etc)… Does anyone know about any tutorials that would show the layout of something like this? I’m not having much luck googling… Thanks!

Script tasks in actor components, spawn them on the actor, keep them in an array for easy indexing and ordering. The components tell pawns what to do, can be queued up or removed if things go south:

  • no tables → mental breakdown → clear component task array → spawn a new task component telling the pawn to find the nearest chemfuel storage and stab it :boom:

tl;dr:

rimword

You could incorporate more components into the mix to make systems more modular. A Hunger component can be given to any entity and would become responsible for tracking everything that has to do with sustenance. Inheritance is supported so you script what eating means inside the base component, then extend as necessary.

  • cows get the animal_Hunger child component (grass goes in, milk comes out)
  • player pawns get a humanoid_Hunger child component that gives you food poisoning if you eat uncooked rice
1 Like

Thanks! I never thought of using Actor components like this – Going to google some of the things you said to get a better understanding, but was totally different from anything I was thinking (and makes more sense)… For some reason I was under the impression not to add many actor components to my characters… I’m Reconsidering now and looking into more videos on it… Thank you!

StateTrees are a new system that might be good for this too

1 Like