Hey, Im having a hard time Wrapping my head around communicating information from Instances of Enemies to Behavior trees. and im also having a hard time figuring out
an efficient system for making a bunch of different enemies.
At the end of the day i need to make a 30 or so creatures that can be friendly or Feral. and have a bunch of other either shared or specific variables to that character.
In searching around, classes came up and im pretty foggy on the subject, usually with casting i can get by okay but its a lot of fiddling because i dont 100% understand when to use what.
(PawnOwner, Player Controller, etc.)
Rescources i have found on Ai and enemies have only dealt with one character using its own simple behavior tree so Im curious of conventions i should implement in doing this over a bunch of characters.
and just to clarify im not set on using just one behavior tree for everything and everyone. just sharing one for the most basic of AI actions.
- Would the solution be having all of the NPCs in the same class and casting to that class in the AI Controller?
- From that cast how would I get particular variables from particular class members?
- Do i need to make a chain checking if the Instance of the creature is Vaild?
So as is the plan is ( All PC pawns -> Ai Controller -> Behavior tree )
NPC (Begin Play) Cast to AI_Controller -> Set Friendly?
AI_Controller (Begin Play) Run Behavior Tree -> (Blackboard) Set Value as Bool(Friendly?)
But Unreal got angry. it gave me an error because it wasnt reading it properly.
I was planning on keeping the information im trying to pass on as booleans representing states or sometimes behaviors ie. Is friendly? will attack on sight?
But i also have a RNG during idle roaming deciding whether to pick a new location or play an idle animation which are represented by
an integer value.
Im sorry if this is a little confusing - This question is the byproduct of mass confusion lol
*** EDIT ***
I tried setting blackboard values from the NPC and skipped the AI controller and it worked so thats where im at now