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. 

Randomize Cards?

Im trying to do an game like CardAgainstHumanity in the UE4 but I dont know what is the best was to make the cards and how I shout randomize them. Do you have some tips how I can do that the most efficient way?

Product Version: Not Selected
more ▼

asked Mar 18 '15 at 08:26 PM in Blueprint Scripting

avatar image

1 1 3 4

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

2 answers: sort voted first

Well you can create an actor called card and just create a full deck, put that in an array, shuffle it and use it from the beginning to the end to hand out cards.

Edit: Shuffle is a function for arrays which randomizes the order of it's values.

more ▼

answered Mar 18 '15 at 11:32 PM

avatar image

5.9k 291 86 293

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

There's a "Random in Range" function within Math which will give you a random integer within a range. If you have a deck of 52 cards and they're all stored in an array (order doesn't matter), you can do something like this pseudo code:

RandomCard_Index = RandomInRange(0, CardDeck.Num());

MyRandomCard = MyCardDeck[RandomCard_Index];

//Remove the card from the deck and give it to a player

more ▼

answered Mar 18 '15 at 11:46 PM

avatar image

819 50 29 73

(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