SimpleAI
 All Classes Namespaces Files Functions Variables Typedefs Macros Groups Pages
Files
Filter
Collaboration diagram for Filter:

Files

file  Filter.h
 
file  Complement.h
 
file  Difference.h
 
file  First.h
 
file  Intersection.h
 
file  Last.h
 
file  LUAFilter.h
 
file  Random.h
 
file  SelectAll.h
 
file  SelectEmpty.h
 
file  SelectGroupLeader.h
 
file  SelectGroupMembers.h
 
file  SelectHighestAggro.h
 
file  SelectZone.h
 
file  Union.h
 

Detailed Description

In combination with the Filter condition IFilter provides a quite flexible way to provide generic behaviour tree tasks. You can just create one ITask implementation that deals with e.g. attacking. The target is just picked from the selection. If you encapsulate this with a condition like (lua):

someNode:addNode("AttackTarget", "attack"):setCondition("Filter(SelectGroupLeader{1})")

You would only attack the group leader of group 1 if it was found. You can provide your own filters like: SelectAllInRange, SelectWithAttribute or whatever you like to filter selections and forward them to tasks.

There are some filters that accept subfilters - like Union, Intersection, Last, First, Difference, Complement and Random. Last, First and Random accept one sub filter as parameter, Union and Intersection accept at least two sub filters.

someNode:addNode("AttackTarget", "attack"):setCondition("Filter(First(SelectZone))")

Random also accepts a parameter for how many items should be randomly preserved:

someNode:addNode("AttackTarget", "attack"):setCondition("Filter(Random{1}(SelectZone))")