Book Image

Learning Game AI Programming with Lua

By : David Young
Book Image

Learning Game AI Programming with Lua

By: David Young

Overview of this book

Table of Contents (16 chapters)
Learning Game AI Programming with Lua
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with AI Sandbox
Index

Conditions


Conditions are similar to actions and are also leaves in a behavior tree. Condition nodes will execute the evaluator assigned to them and return the result to the caller to determine how they should be processed.

SoldierLogic.lua:

local function CreateCondition(name, evaluator)
    local condition = BehaviorTreeNode.new(
        name, BehaviorTreeNode.Type.CONDITION);
    condition:SetEvaluator(evaluator);
    return condition;
end