Unwrapping a packet of cards

How can I manage to create it? I mean, each card has its rarity: a legendary card is hard to find, so you have a low chance to open a pack with it. How can I simulate these percentages? Example: common cards 60% of chance to find (give item) this card.
Rare card 20% etc...
basically a lot of control variable and conditional branches.

control variable can give you a random number, for example between 1 and 100
then check the result with the conditional branch, from 1-5 you give legendary card, from 6-20 you give rare card, from 21 to 40 you give uncommon card, from 41 to 100 you give common card.

you should read into weight mathematics (example: https://ovate.github.io/andar-tips/weight-calc.html) and make a complete card table before you even start to program the event however, because that will be an extreme and tedious list of all cards and you'll mess it up without carefull planning.
Like Andar said, it can all be done with random numbers, conditional branches, and clever use of Show Picture. I would set up the eventing by first choosing a rarity (e.g. if number is between 1 and 5 give legendary, 6 to 15 rare, 16 to 30 uncommon, 31 to 100 common), and then within each rarity you could have a second, evenly distributed random number to choose which card of that rarity to award.

In the long run - especially if you're planning to do more complex stuff like allowing re-rolls or filling out a collection of all cards that have been obtained - you will want to move onto JavaScript programming to do this. It will save you a lot of time and make it easier to scale when you start adding in more features.
Like Andar said, it can all be done with random numbers, conditional branches, and clever use of Show Picture. I would set up the eventing by first choosing a rarity (e.g. if number is between 1 and 5 give legendary, 6 to 15 rare, 16 to 30 uncommon, 31 to 100 common), and then within each rarity you could have a second, evenly distributed random number to choose which card of that rarity to award.

In the long run - especially if you're planning to do more complex stuff like allowing re-rolls or filling out a collection of all cards that have been obtained - you will want to move onto JavaScript programming to do this. It will save you a lot of time and make it easier to scale when you start adding in more features.
How can I make "if number is between" in a simple way? Should I use 2 conditional branches? (ex: if var(x) is >1 ---> if var(x) is < 5 then card(x) appears).
How can I make "if number is between" in a simple way? Should I use 2 conditional branches? (ex: if var(x) is >1 ---> if var(x) is < 5 then card(x) appears).
Basically yes. You could set it up in nested branches like this:
Control Variables: Set Variable #1 to number between 1 and 100
Conditional Branch: If Variable #1 is less than or equal to 5
..Do processing for legendary card
Else
..Conditional Branch: If Var #1 is less than or equal to 15
....Do processing for rare card
..Else
....Cond Branch: If Var #1 is <= 30
......Do processing for uncommon card
....Else
......Do processing for common card
....End Branch
..End Branch
End Branch
How can I make "if number is between" in a simple way?
no need for that if you sort your conditional branches correctly.
if x< 5 go label 1
if x< 20 go label 2
if x < 40 go label 3

the x=4 will never go to label 2 even if it theoretically fulfills the condition, because it was send away to label 1 before that condition was even checked.

Original thread: https://forums.rpgmakerweb.com/threads/unwrapping-a-packet-of-cards.139140/