How to do a Gacha?

I've been trying to make a Gacha Machine in game, where you get an alternative outfit for the MC, i'm trying to make a total of 5 outfits you can get there, but the question is, can i make it random? Let's put an example:

Player uses Gacha Machine and Wins a random outfit, once that outfit is obtained, it can't be obtained again from the machine, can someone help me? I'm New to RPG Maker and i would love to make this Gacha Thingy!
This can be done pretty easily using the default event commands. I don't know how you're "getting" the outfits - if they're items, then you can use event commands to check for items.

If they're something else, you may need to make a switch to indicate whether that outfit has been gotten.

Then you'd just do something like
Loop
Control Variables -> random number 1-5
Conditional Branch -> variable == 1
- Conditional Branch -> hero doesn't already have the outfit
- - Give the outfit, Break Loop
etc. for the other numbers

There are also at least a handful of plugins already made to create gacha scenes.
Is something like this what your looking for? The code for setting Variable #2 is as follows, but replace the 1 inside the $gameVariables.value(1) with whatever id your outfit remaining variable is.

Code:
Math.randomInt($gameVariables.value(1)) + 1

EDIT: Oops, the "Control Variables: #0003 Index = 1" should be += 1
EDIT: Fixed from Turan's below post.
Is something like this what your looking for?
That code is incorrect, you need parentheses after the function call for Math.random()

And if you're going to use a script call, it makes more sense to use Math.randomInt() instead of multiplying and rounding.

The rest of the logic with the Index variable also just doesn't...work? I'm not sure what it's supposed to be doing. (the line that you say to change in your post happens twice but you don't say which line to change, or both 😉)

Once you start getting outfits, it will be impossible to get the rest. Say my first time I roll a 2 - so I get the suede coat or whatever is checked for Index = 2.

Then the outfit variable is reduced by 1, so my highest roll next time will be a 4. Even if you're not adding to the Index, I can never succeed in rolling the 5 that I need. If you do add to the Index, it will also never check whether I rolled the 1 that I need.

That's why I suggested tracking the acquisition of each outfit separately and using a loop to guarantee a viable result.
I have it only increase the index if that item can be obtained, so it essentially shifts the index of all the items down one. Also, I forgot the randomInt exists, so I edited the post.

So basically, say..


Item 1 (If Random is 1)
Item 2 (If Random is 2)
Item 3 (If Random is 3)
Item 4 (If Random is 4)
Item 5 (If Random is 5)

Then a player gets item 2, then...

Item 1 (If Random is 1)
Item 2 (Cannot Get)
Item 3 (If Random is 2)
Item 4 (If Random is 3)
Item 5 (If Random is 4)
I edited the post.
Okay, that makes more sense.
I did write an Gacha Event similar. But instead of adding 1 or subtracting 1 to the variable, I send it back to a Label from where it rotates the numbers between 1 and 5 at random. Of course IF you run into the What If case if the player has them all you better add another If check that checks if the player has acquired all of them or else you'll be stuck in the loop.

It would look like this:
Label
Item 1 (If Random is 1)
> Give item to player
If the player has the item already send it to label
Item 2 (If Random is 2)
> (same as Item 1)
Item 3 (If Random is 3)
> (same as Item 1)
Item 4 (If Random is 4)
> (same as Item 1)
Item 5 (If Random is 5)
> (same as Item 1)
If the player has all Items
> End Eventprocess

Item 1 (If Random is 1)
Item 2 (If Random is 2)
Item 3 (If Random is 3)
Item 4 (If Random is 4)
Item 5 (If Random is 5)

The first 5 checks are IF the player has the item, the second half is giving the rewards if the player has NOT acquired the item.

This is the way how I did implement a random option for a Puzzle I made within one of my games.
Or this plugin maybe? It's paid, though. Or this one.
a more complicated way is to learn how to use arrays, that requires some time to learn javascript

set Variables 1 = [1, 2, 3, 4....100]
randomize one of the number from Variable 1
remove / splice the randomized number from Variable 1,

lets say the random number is 3

your final value from Variable 1 would be
Variable 1 = [1, 2, 4, 5....100]

Original thread: https://forums.rpgmakerweb.com/threads/how-to-do-a-gacha.173440/