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"

How to create a random outcome?

I am trying to create a system in Unreal Engine 4 where some things are provided randomly out of a large group of possibilities. For example, when the player presses a button to drink something I have variations of a drink sound that I want to play at random. I also have chests that I would like to have random loot in them. However, I can't seem to find a node that would allow me to do this. I had imagined something like a percentage of various outcomes that I could add on. Is there something like this in the blueprints? And if there isn't, is there a way I could do this? Any help would be appreciated!

Product Version: UE 4.14
more ▼

asked Jun 24 '18 at 02:25 AM in Blueprint Scripting

avatar image

Alec R
105 3 7 13

(comments are locked)
10|2000 characters needed characters left

1 answer: sort voted first

Switch on int + random int in range to select a random event.

alt text

To decide what the probability of something happening is just take a random float and see if it's less than you your probability converted to a 0-1 value.(75% chance is 0.75)

alt text

Hope this helps. If not let me know.

191.png (45.3 kB)
192.png (53.5 kB)
more ▼

answered Jun 24 '18 at 02:44 AM

avatar image

210 4 4 6

avatar image Alec R Jun 24 '18 at 02:46 AM

Thanks for the quick reply. I'll try it out tomorrow and let you know.

(comments are locked)
10|2000 characters needed characters left
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