Someone suggested I look into co-routines and decision trees when I had posted for some feedback on doing AI. The behavioral system is rather simple. New behaviors can be added very easily. It all goes back to TRUE and FALSE.
Using this basic layout, what would be some key features you think to making a behavior system seem almost realistic (using this same format below):
--DECISION TREE EXPLORATION
--States
normal = true
happy = false
sad = false
worried = false
afraid = false
--Conditions
got_some_money = false
bump_your_head = false
loose_wallet = false
walk_into_dark_room = false
--Control
function GetEmotional(emotion)
emotion = true
end
--What if we want an animation to play if they are happy:
--TRIGGERS
if got_some_money then
GetEmotional(happy)
end
--REACTIONS
function JumpForJoy()
if happy then
playAnimation(object,animationID)
end
end
function Frown()
if sad then
playAnimation(object,animationID)
end
end
function BeAfraid()
if walk_into_dark_room then
playAnimation(object,animationID)
end
end
--Multiple conditions?
if bump_your_head and walk_into_dark_room then
GetEmotional(sad)
GetEmotional(afraid)
end