Graph Logic Help

NodeCanvas Forums General Discussion Graph Logic Help

Tagged: , ,

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15287
    johnny star
    Participant

    Hello! Hope everyone is doing fine and healthy!

    I’m trying to build an AI and I have attached a graph of the general idea (incomplete).
    If you read the comments on the nodes, you’ll get what I’m trying to do.

    But the question is how do I go about linking an Action node that repeatedly updates the closest target every half a second and if the closest target is different from the ‘MOVE TO TARGET’ / ‘ATTACK TARGET’ branch, the whole Selector branch restarts so that the Bot is now targeting the newest closest target?

    Attachments:
    You must be logged in to view attached files.
    #15300
    Gavalakis
    Keymaster

    Hello Johny,

    I am not 100% I understand the question, but the part where you say “repeatedly updates the closest target every half a second”, can potentially be done with an Action List set to run in Parallel, where one action is a wait 0.5 seconds and the other action is some custom action that “updates the closest target”. Here is an example of what I mean with a debug placeholder instead.
    ParallelActionList

    Do notice that the actions are set to “Run In Parallel”. That basically makes all actions (2 in this example) run simultaneously and the whole node is “finished” only when all actions in the list finish. You may probably want to add a “repeater” decorator above such a node to repeat the actions, which can in turn also be a child to a Parallel composite node if you want this to run simultaneously with some other branch as well.

    Please let me know if that helps, or if I can help you in any further ways 🙂
    Thanks!

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

    Attachments:
    You must be logged in to view attached files.
    #15306
    johnny star
    Participant

    Hi @Gavalakis! Thanks for getting back to me. I hope everything is good over at your side.

    Shouldn’t the actions be running in Sequence instead? Wait for 0.5s > Then find the closest target?

    But in your example, both waiting 0.5s and finding of the closest target are running simultaneously. So doesn’t that mean each action runs independently from the other?

    Sorry, this is confusing. I’m trying to wrap my head around it.

    Stay safe and healthy!

    #15310
    johnny star
    Participant

    Hi @Gavalakis! I have another question.

    I have attached a screenshot. I’m not sure if Filter node’s cooldown works as a short delay for projectile shooting. But I’d like the delay to be a little random. Doing what I’ve done in the screenshot only fires 1 projectile and it gets stuck on the Wait node. The cooled timer is referencing “FireInput” float.

    How do I go about doing this?

    Thank you!

    Attachments:
    You must be logged in to view attached files.
    #15316
    Gavalakis
    Keymaster

    Hello again Johny,

    With 2 actions as in this example, both Sequence and Parallel will have the same effect. However with more actions, parallel would achieve something closer to what you are after I think. In any case though, you are right; sequencer in this case may be better choice. Sorry for the confusion.

    Regarding your second question, one way to do this, is to add an action node just before the cooldown node which will set a float variable to a random value using the “Set Float Random” action task and then have the cooldown value set to read from that variable (instead of directly inputting a value). Let me know if that works for what you are after.

    Thanks!

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

Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.