Input number to choose how many?

I'm sorry, but I don't know how else to help you - if you can't describe what you want to happen, then neither you nor anyone else can make it happen for you.

I typed out example instructions for you at the bottom of post #33. Why can't you make a list like that? What part of it don't you understand?
I'm sorry, but I don't know how else to help you - if you can't describe what you want to happen, then neither you nor anyone else can make it happen for you.

I typed out example instructions for you at the bottom of post #33. Why can't you make a list like that? What part of it don't you understand?


I keep showing you the list?

  1. I give an npc a number of White Wonderfuls.
  2. 25% they will get a Crystal
  3. 10% they will get a Diamond (Super Rare item)
  4. The rest they'll get is glass, 65%. I want glass to be the last item but the majority of what is received. (Glass being common)


Edit: I went back to look at post 33

I'm now revising my post


When someone gives me a white wonderful, they're guaranteed to get at least 45% of that number, but not more than 70%, as glass
Then they'll get 50%-100% of the rest as Crystals
Then, if there's anything left, they'll get a random amount of diamonds.
Then, if there's anything left, they'll get a random amount of Opals.
Edit: I went back to look at post 33

I'm now revising my post
Alright! We can finally use this. You will have to read these instructions and replace variable1, variable2, etc. with the numbers of the variables you're using.
When someone gives me a white wonderful,
Input Number to variable1
they're guaranteed to get at least 45% of that number, but not more than 70%, as glass
Script: $gameVariables.setValue(variable2, Math.floor(Math.random() * ($gameVariables.value(variable1)*.7 - $gameVariables.value(variable1)*.45 + 1) + $gameVariables.value(variable1)*.45));

Change Items, glass, variable2

Send the info in a message window

Control Variables, variable1, Sub variable2
Then they'll get 50%-100% of the rest as Crystals
Script: $gameVariables.setValue(variable2, Math.floor(Math.random() * ($gameVariables.value(variable1) - $gameVariables.value(variable1)*.5 + 1) + $gameVariables.value(variable1)*.5));

Change Items, crystals, variable2

Send the info in a message window

Control Variables, variable1, Sub variable2
Then, if there's anything left,
Conditional Branch, variable1 > 0
they'll get a random amount of diamonds.
Script: $gameVariables.setValue(variable2, Math.randomInt($gameVariables.value(variable1)) + 1);

Change Items, diamonds, variable2

Send the info in a message window

Control Variables, variable1, Sub variable2
Then, if there's anything left,
Conditional Branch, variable1 > 0
they'll get a random amount of Opals.
Script: $gameVariables.setValue(variable2, Math.randomInt($gameVariables.value(variable1)) + 1);

Change Items, opals, variable2

Send the info in a message window
And if I wanted to add more items, it would be done like this still correct?

Script: $gameVariables.setValue(variable2, Math.randomInt($gameVariables.value(variable1)) + 1);

Change Items, extraitems, variable2

Send the info in a message window
And if I wanted to add more items, it would be done like this still correct?

Script: $gameVariables.setValue(variable2, Math.randomInt($gameVariables.value(variable1)) + 1);

Change Items, extraitems, variable2

Send the info in a message window
Inside a Conditional Branch, yes. You always want to make sure you actually have items left before using them.
Sometimes when I input a lower number, such as 11, I only get back 10. Not always though. What would cause that? Do lower numbers inputted have this problem?
Sometimes when I input a lower number, such as 11, I only get back 10. Not always though. What would cause that? Do lower numbers inputted have this problem?
It will be very hard to troubleshoot just by that. You need to take note of the exact combination of items you're receiving to see which line is doing the math wrong.

Original thread: https://forums.rpgmakerweb.com/threads/input-number-to-choose-how-many.133024/