No announcement yet.

Flow Control problem.

  • Filter
  • Time
  • Show
Clear All
new posts

    Flow Control problem.

    I'm trying to do a simple check for for a variable (stamina). If the player has stamina, I want the function to return true. If the player does not have stamina, I need to to return false. Simple as that eh?

    Click image for larger version

Name:	PdsZ8vL.png
Views:	1
Size:	64.9 KB
ID:	1144338

    My problem here is that I need something like, a reverse branch?? Maybe I am just going about this wrong. I can set the return node to return the value "HasStamina" if it is greater than 0, but since I can only have one return node, how do I allow it to also set the same variable to false if the player has less than or equal to 0 stamina? Or is there a way to create a function-like variable like you can in C# or Java.

    I need a node with the code equivalent of:

    if (stamina > 0)
        return true
        return false
    Last edited by Winfree; 02-16-2015, 12:24 AM.

    Connect HasStamina to a float > float node, with the other value being 0.

    Connect the output of this pin to the Return node.

    Completely eliminate the Compare macro.

    Easy peasy.


      Yep, that about does it, thanks!


        In general, use a local variable. Set it on multiple exec points so you have e.g.:

        Branch true -> set tmp true
        Branch false -> set tmp false

        tmp -> ReturnNode

        It can quickly get cumbersome to wire everything up, even when you've not used 10 nodes. So for more complex scenarios, I'd go the C++ route.