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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Random Switch on enum

Hello guys,

i want to include a random character. I have a enum for each parameter created , which is to be set for the character. But how can I generate a random parameter of a enum now?alt text

Product Version: UE 4.10
Tags:
more ▼

asked Feb 24 '16 at 04:08 PM in Blueprint Scripting

avatar image

Mathrim
7 6 8 6

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

3 answers: sort voted first

alt text

Sentura is correct. To expand on that answer, take a look at this screenshot. You need to get a random int, convert that int to a byte (because enums are bytes in UE4), then convert that byte to the enum type you're using (firstnames, lastnames, genders etc), then set your variable.

randomenum.jpg (33.5 kB)
more ▼

answered Feb 25 '16 at 01:13 AM

avatar image

Baeldan
186 4 7 13

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

Enums are just integers, so you can just use random int to get random enums. If you want less clutter, you can use the Select node and hook it up to an enumerator.

You can see the select node in action on this image: https://answers.unrealengine.com/storage/temp/46177-solus.png (the select node takes int, bool and enumerators as index values)

more ▼

answered Feb 25 '16 at 12:59 AM

avatar image

Sentura
415 32 9 27

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

I have found a solution

but these appear very uncomfortable to me

is there a better one?

more ▼

answered Feb 24 '16 at 04:25 PM

avatar image

Mathrim
7 6 8 6

(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