This post was requested by Patreonee David. He wanted to know about Decision Trees (aka Behaviour Trees). They are a way of programming learned behaviours into an NPC. The most famous case are those used in the Black and White characters.
The mathematics and programming behind them is quite complex and they are capable of generating interesting behaviours.
I will put these on the list to create a tutorial for Unity at some point. In the meantime I can offer you a section from “Programming Believable Characters for Computer Games” that I wrote many years ago.Decision Trees (PDF)