Reply To: Events outside out graph

NodeCanvas Forums General Discussion Events outside out graph Reply To: Events outside out graph

#9376
Gavalakis
Keymaster

Of course you are making sense and actualy this is a nice way to use nodecanvas, meaning that you have all your implementation in your scripts and then using Script Control tasks. At least that’s what I understood.

So for your problem I would suggest these alternatives:

Create a boolean method in your component like CanSeeEnemy. Maybe you already have that.
Use the CheckFunction condition to call and check it.

Now the problem will remain how to set the object or list of gameobjects that is able to see. There are 2 solutions I can come up with right now:

1. Directly write to the blackboard from within your CanSeeEnemy method if it actually can see an enemy. Just get a reference to the blackboard component the BT is using and call SetDataValue.

2. Save the objects that can be seen in a field or property within your script when calling CanSeeEnemy, and use GetField or GetProperty to save that data in the blackboard. But that could be longer way around than the above.

Let me know if this is a valid solution for you 🙂

Join us on Discord: https://discord.gg/97q2Rjh