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?
asked Mar 18 '15 at 08:26 PM in Blueprint Scripting
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.
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
answered Mar 18 '15 at 11:46 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here