Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

[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.

alt text

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:

alt text

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

But this is what I keep getting:

alt text

alt text

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.

Product Version: UE 4.11
more ▼

asked Jun 07 '16 at 10:52 AM in Using UE4

avatar image

3 2 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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.


more ▼

answered Jun 07 '16 at 10:56 AM

avatar image

701 28 8 51

avatar image Kupluk Jun 07 '16 at 11:22 AM

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]: /storage/temp/93708-screenshot_71.jpg

screenshot_71.jpg (62.2 kB)
avatar image Derzo Jun 07 '16 at 11:29 AM

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! :)

avatar image Kupluk Jun 07 '16 at 11:36 AM

Woooaaah, okay I get it now, that's something new for me :D 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.

avatar image Derzo Jun 07 '16 at 11:38 AM

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

Ty <3

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question