Boolean checks not working in functions? (pictured)

Hello,
I’m having trouble understanding something and know I’m wondering if my whole blueprint is even working as intended or not in the end.

Here is my basic movement logic.

I have a CanMove boolean that is not working at all if I put it inside my Check basic mov states function, like this. I can still move and stuff.

BUT when I do get it out of the function it works properly as intended and blocks all my movement inputs when false. Like this

Can you explain to me why is that possible?

I’m pretty lost because some things seem to work in functions like the enum sequence BUT not the boolean, I really really don’t get it.
Thanks a lot

1 Like

With a function, you need to catch all possibilities

So every false conditions or at any time it’s supposed to ‘go out’ of the function I need to bring the return node?

Is that what I need to do or is there another way to do it?

Thx for the response btw!

1 Like

Yes, every exist needs a return node of some sort, otherwise the function doesn’t return ( or returns with nothing ).

You can have multiple exit nodes, btw.

I did put my return nodes where I had to but in the end it will just resume its path when leaving the function node. I may have not understood what you meant.

I would like the code to just stop if something is not valid.

Do I have to put a different return node?
I don’t get it.

1 Like

You can return a bool as well as the updated movement enum. You can set the bool to show that movement is not valid, and then the code one level up, can stop the movement. It really depends how you want to do it…

Okay.
What I’m struggling with is that I was basically using functions to also organize my code and not have a billion things in the level above.

I don’t really know what to avoid doing inside these functions and what could go inside without problems. Maybe this is not the way it should be done, I’d really want to keep it tidy and clean.

1 Like

Functions are exactly the same as custom events, except you get a return value.

You can use both to tidy up, but it really is up to you how you do that.

Was the code working before you put stuff in a function?

Yes, all my little problems here and there get solved once I get some of the code out ot the functions.

1 Like