Game Development Reference
In-Depth Information
The flee behavior
Fleeing is another important behavior that extends the agent's lifespan. As fleeing is less
important than death, the flee action has a lower priority in the behavior tree than the death
behavior:
SoldierLogic.lua :
function SoldierLogic_BehaviorTree(userData)
...
-- flee action
node = node:GetParent();
node = node:GetParent();
child = CreateSequence();
node:AddChild(child);
node = child;
child = CreateCondition(
"has critical health",
SoldierEvaluators_HasCriticalHealth);
node:AddChild(child);
node = child;
node = node:GetParent();
child = CreateAction("flee", FleeAction(userData));
node:AddChild(child);
node = child;
return tree;
end
Search WWH ::




Custom Search