[BUG] Float comparison broken? Or the variable setting?

I tried to make a custom event to get an integer based on a simple two float (one random and one fixed) comparison.

I assign a variable called “Dec” as the decision of the comparison where 2 means TRUE and 1 means FALSE, as simple as that.

This is how i call that custom event:

Please ignore the “Dummy” array since I use it in other purposes.

But this is what I keep getting:

93703-screenshot_67.jpg

93704-screenshot_70.jpg

As you can see, there are some wrong Dec value, some should be 1 but it’s 2, vice versa.
Please help, have been debugging this all day.

Hey kupluk!

I know exactly why this happens.
The thing is, EVERY time you get a random float, it generates a new random float. So the debug string float might be 43, while the comparisation float 17.

Cheers!

Greetings Derzo!

Thank you for your quick reply. I see, is that because I use event tick to call the custom event? Because I’ve tried with “receive execute” function by using button press function (screenshot is attached).

And the result is as bad as always.
[1]:

Let me explain. Everything is fine outside the custom event.

When you print the debug string, inside custom event, it takes a random float value in. So it randomizes a float. Let’s say the randomized float would be 46. Then it prints out the append node, etc. After that, a branch takes a random float value in AGAIN. So it randomizes a float AGAIN. And remember, every time, it will generate a new float. So now it could be 8 for example. Get it now?

So the debug string prints out the wrong value. It’s useless. If you remove the debug string, it will work just fine! :slight_smile:

Woooaaah, okay I get it now, that’s something new for me :smiley:
Many thanks Derzo! Thanks for sharing your knowledge, I feel stupid now hahaha but it’s fun to learn new things. Again, thanks a lot Derzo.

Np! Accept the answer then and optionally add some karma, trying to get the badge this week :smiley:

Ty <3