x

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 in adding random float logic

I am taking coord of random created block and add to him one from 4 vectors [(1,0),(-1,0),(0,1),(0,-1)]. I create 2 logic but all of them doesn't work and it adds vector (1,1) or (1,-1) etc. Why does it happened?

Logic is not multiplayer ( No replications and server events )

Print string: red = input, blue = output

alt textalt text

Product Version: UE 4.20
Tags:
bug.jpg (92.0 kB)
bug2.jpg (93.3 kB)
more ▼

asked Oct 24 '18 at 07:26 AM in Blueprint Scripting

avatar image

chernoburk
31 5 9 14

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

1 answer: sort voted first

Not sure what you mean but the most common assumption is that the random returns the same value with subsequent calls. This is not true. In your GetNextCoord function it's used twice, giving you, potentially, 2 different values.

To prevent this, create a local int, store the random value first and then use it twice. This will ensure the same random is used for as long as the function is in scope.

more ▼

answered Oct 24 '18 at 11:57 AM

avatar image

Everynone
15.3k 77 26 64

avatar image chernoburk Oct 24 '18 at 07:39 PM

I already fixed it by returning one var vector, saving it, and adding it to my coords outside. But you are right, for two different variables it calls two times and it was my fault

(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