Just getting into learning the ropes of BD, and for the life of me cannot find a logic in it to check if a saved object is null.
And have a very janky and 1/2 working simple Tree that is suppose to do simply the following:
If you see an enemy, flee. If while you are fleeing you see a new enemy update who you are fleeing from. If nothing else wander around.
Basically to get a grasp of BD, attempting to have one AI in a maze do his best to avoid all enemy AI.
Only way I could work out after 2 hours of trying different options to get him to not randomly flee and throw an error of no target to flee from, was if you see an enemy interrupt wander, save the gameobject as a variable, then 'Get Speed" of that target and if target has speed, its not null and is a gameobject chasing you so turn on run and flee.
Which works sometimes..not sure why only sometimes. The "Draw line" draws lines from him to who is his target, and will have a line and he will not flee about 1/4 of the time even with 3-4 chasing him.
Also sometimes it will stop fleeing, the entire tree turns green and he slowly wanders around while being hit.
Any suggestions on how to clean this up and get ride of this buggy behavior? I'm sure its my novice grasp of BD and how particular conditionals work (or improper use of them).
And have a very janky and 1/2 working simple Tree that is suppose to do simply the following:
If you see an enemy, flee. If while you are fleeing you see a new enemy update who you are fleeing from. If nothing else wander around.
Basically to get a grasp of BD, attempting to have one AI in a maze do his best to avoid all enemy AI.
Only way I could work out after 2 hours of trying different options to get him to not randomly flee and throw an error of no target to flee from, was if you see an enemy interrupt wander, save the gameobject as a variable, then 'Get Speed" of that target and if target has speed, its not null and is a gameobject chasing you so turn on run and flee.
Which works sometimes..not sure why only sometimes. The "Draw line" draws lines from him to who is his target, and will have a line and he will not flee about 1/4 of the time even with 3-4 chasing him.
Also sometimes it will stop fleeing, the entire tree turns green and he slowly wanders around while being hit.
Any suggestions on how to clean this up and get ride of this buggy behavior? I'm sure its my novice grasp of BD and how particular conditionals work (or improper use of them).
Last edited: