Input number to choose how many?

I was wondering if there was a way for items or events that uses input number or something similar? Like if Trash if found while fishing and if I make a recycling bin, how do I event the option to allow the user to choose how much trash he wants to recycle? Having to recycle 1 at a time is tedious. I've done things like offer 50 or 99.

I'm not sure if Input is the way to go?
Yeah Input Number is probably the way to go.

You can just store the number input by the player in a variable, then (very important) check if the player has that many "trash" items in their inventory or else return an error message. If the player does have enough trash to recycle, just remove as many items as the variable tells.
I've set up player input passwords before. Is this way similar? How do I store numbers 1-99 the player inputs?

This may be the only part I'm not sure how to set up. I mean, the player could input 22 or 68. How do I remove any number from 1-99?
I've set up player input passwords before. Is this way similar? How do I store numbers 1-99 the player inputs?

This may be the only part I'm not sure how to set up. I mean, the player could input 22 or 68. How do I remove any number from 1-99?
When you use the "Change Item" command you have an option to decrease a certain item by a variable. Just put the same variable you used for the Input Number.
Okay, I figured out the Input part. And I've set up a check for the #of Trash. But it's not working the way I thought I'm derping hard here.

I set it to #ofTrash is less than Recycle Input Number. And I've tried reversing it.

I know I'm suppose to be using a Condition Branch, the variable that keeps track of Trash and the Variable for what the player inputted.
The event should be something like:

Spoiler: Event
Amount of trash = Variable Y
Input Number = Variable X

If Variable X < Variable Y
// Continue trash recycling.
Else
// Bzzt! You don't have that much trash.
◆Show Choices:Recyle, Don't recycle (Window, Right, #1, #2)
:When Recycle
◆Input Number:Recycle Input, 2 digits
◆If Recycle Input < # of trash
◆Change Items:Trash - {Recycle Input}
◆Text:None, Window, Bottom
: :Recycled \v[250] Trash.
◆
:Else
◆Text:None, Window, Bottom
: :You do not have that much trash!
◆Exit Event Processing
◆
:End
◆
:When Don't recycle
◆
:End


This isn't working. I'm not sure what I am doing wrong? :?
◆Show Choices:Recyle, Don't recycle (Window, Right, #1, #2)
:When Recycle
◆Input Number:Recycle Input, 2 digits
◆If Recycle Input < # of trash
◆Change Items:Trash - {Recycle Input}
◆Text:None, Window, Bottom
: :Recycled \v[250] Trash.
◆
:Else
◆Text:None, Window, Bottom
: :You do not have that much trash!
◆Exit Event Processing
◆
:End
◆
:When Don't recycle
◆
:End


This isn't working. I'm not sure what I am doing wrong? :?
What part of it isn't working? The change items one? Or the trash amount check?

You don't have to use "exit event processing" by the way. It's redundant.
Trash amount check.
Are you using 'Control Variables > Game Data > Item "X" on inventory' to keep track of the trash item?

Can I have a screenshot of your event so I can take a look on full detail?
Edit: It's working now. I stated the variable at the top. ^^; Thanks so much! This is amazing. I know it's simple but wow. I didn't know this could even be evented. I'm so happy! 😀

Does the variable need to be stated in the event or something?


Edit2: Removed picture

I wanted to try this a step further. What about Gem approval? In one of the Harvest Moon Games, what you gave to appraise you received the same total back but with random items that were appraised. I'm dabbling with this now to see if I can make something like this work

Ex: 45 Red Wonderfuls turns into 35 trash, 5 Garnets and 5 Rubies
Ex2: 20 Gold Ore turns into 10 trash and 10 Gold bars

This is really fun! I'm trying to test out such an event. Can it even be done?

Edit3: Just got it set up to take an amount and then give back another item in same amount. Still trying to figure out how to make it random and more than 1 type of items given back.
You can set any variable to a random number between 0 and X. It's one of the options in the Control Variable command.

From there, you can have different branches, for example:

* Set variable X to a random number between 0 and 1

*If variable X = 0 do ----
end

*If variable X = 1 do ----
end
You can set any variable to a random number between 0 and X. It's one of the options in the Control Variable command.

From there, you can have different branches, for example:

* Set variable X to a random number between 0 and 1

*If variable X = 0 do ----
end

*If variable X = 1 do ----
end

I just woke up and this is the first thing I wanna do. lol I've know about the random number because I've used it for random messages. But didn't know of any other way to use it.

So it is possible to randomly divide up one item in your inventory and get back two or more different items instead?

Because I want to see if an event can take item 1 (being ore in this example) and the player gives all 99 of their ore and for the event to give back 2 or more items found in the ore. I'm just not sure how to get the event to divide it up AND give back more than 1 items?

Edit1: I did really just wake up, I'm going to test this out and either edit my comment again or reply if someone else makes a post ^^;

Edit2: I have not been able to figure out how to divide up one item and give back more than 1 items equal to how many the player gave. My example here is giving 99 White Wonderful and then receiving a combination of items that add up to 99. (What the player inputted) And get something random in return like 41 glass, 33 crystal and 25 diamonds. (Is this even possible, splitting up 1 items and getting 2 more different ones in return?
My example here is giving 99 White Wonderful and then receiving a combination of items that add up to 99. (What the player inputted) And get something random in return like 41 glass, 33 crystal and 25 diamonds. (Is this even possible, splitting up 1 items and getting 2 more different ones in return?
Well this is only possible with mathematics. Specifically proportions and probability.

But before trying to do formulas and stuff like that, can you please elaborate a little bit more? Do you plan on having different probabilities for each item or do you want to use fixed proportions?
I haven't really decided. I was thinking like the Harvest Moon. Where a White Wonderful would give lots of Crystals but not many Diamonds. (Diamonds being rare)

Right now I'm not sure if what I am asking is even possible?

I'm having trouble explaining at the moment. I guess when it comes down to it I just want an equal amount in return for what is given; with what is given being multiple random items.
I feel like your thinking is too locked into the concept of items and Crystals and Diamonds and Wonderful and dividing them and stuff like that - forget that, items don't exist, they're just words in your computer program. Figure out the math - "is what I'm asking possible?" has nothing to do with it. You're changing one number into other numbers, so of course that's possible, you just need to figure out how to express the equation.

What can be very helpful in programming is to write out what you want to do in step by step instructions. So, for example:

- I got 99 things handed to me, so I need to keep track of that number.

- I'm going to give back a random number of this other item. I need to randomly decide how many...I say 41! But now I have to take that out of the 99 so I'm keeping track of how many things to give back.

- Do I still have more stuff to give back? Yes! So I'll give back a random number of this other item...I say 33! Now I have to take that out of the 58 (which was 99 at the beginning), so I'm keeping track of how many things to give back.

- Do I still have more stuff to give back? Yes! So I'll give back a random number of this other item...I say 25! Now I have to take that out of the 25 (which was 99 at the beginning), so I'm keeping track of how many things to give back.

- Do I still have more stuff to give back? Nope, I'm done!

Then, once you have that, which we call pseudo-code, you figure out how to perform those instructions in your programming language. And you can do stuff like you want this material to be more rare than this other material and all that stuff, you just have to figure out how to explain your thought process.
The Crystals and Diamonds are just examples.

As I previously said "I guess when it comes down to it I just want an equal amount in return for what is given; with what is given being multiple random items."

I know anything is possible with math. I'm having a hard time however in trying to imagine Rpg Maker having the option to take 99 and divide up into 2 or more numbers. It's as I asked, giving 1 item (the number the player inputs for appraisal, and then turning whatever they put into 2 or more different items. I don't know how to do that at the moment.

I'm not sure if I am explaining clearly and that is partially my fault. The player could give 15 of one item and get 2 new items, 10 and 5. It doesn't have to be those numbers and it doesn't matter what it's called. I just want to know if this action, not the math, can be done in Rpg Maker Events.

How can I event Rpg Maker to recognize the amount the player inputted and then give the player new items, more than 1 items even? Or split up what they give randomly? The idea is they lose one item and receive as much back with what they inputted but with completely new items.
Perhaps you typed this while I was writing it out for you, but I just gave you an example of exactly how it would work.
That still doesn't help me. I have to know how to set up the branches and variables to make it work. The order and stuff. I'm not scripting. I'm using Rpg Maker itself.

Edit: I have kinda an idea but not sure to set this up with the variables, change items. The order this is done with the Event Command Window.

Edit2: I also wanted a way for the event to choose the random number, not myself. And I'm not sure how to keep track of a number I can't see generated unless in test play. And the player can input any number from 1-99 so it won't always be 99. I'm not sure how to set up Item Change in the Event Command window to recognize one kind of item taken away and give back the same amount in different items.
That still doesn't help me. I have to know how to set up the branches and variables to make it work. The order and stuff. I'm not scripting. I'm using Rpg Maker itself.
RPG Maker's event system is a form of scripting, which is a form of programming. It's different levels of complexity, but all the same process. The "order and stuff" is the pseudo-code, that's the point.
- I got 99 things handed to me, so I need to keep track of that number.
Input Number into variable 1.
- I'm going to give back a random number of this other item. I need to randomly decide how many...I say 41! But now I have to take that out of the 99 so I'm keeping track of how many things to give back.
Script: $gameVariables.setValue(2, Math.randomInt($gameVariables.value(1)) + 1;
Change Items glass, variable 2
Control Variables variable 1 sub variable 2
- Do I still have more stuff to give back? Yes!
Conditional Branch variable 1 > 0

So I'll give back a random number of this other item...I say 33! Now I have to take that out of the 58 (which was 99 at the beginning), so I'm keeping track of how many things to give back.
Script: $gameVariables.setValue(2, Math.randomInt($gameVariables.value(1)) + 1;
Change Items crystal, variable 2
Control Variables variable 1 sub variable 2
- Do I still have more stuff to give back? Yes!
Conditional Branch variable 1 > 0
So I'll give back a random number of this other item...I say 25! Now I have to take that out of the 25 (which was 99 at the beginning), so I'm keeping track of how many things to give back.
Script: $gameVariables.setValue(2, Math.randomInt($gameVariables.value(1)) + 1;
Change Items diamond, variable 2
Control Variables variable 1 sub variable 2
- Do I still have more stuff to give back? Nope, I'm done!
Conditional Branch variable 1 > 0

Then you get into how you want your system to work. If you always want to give those three items, then you'd get rid of the last two conditionals and just dump the remainder of variable 1 into diamonds.

If you want to have 1-3 (or however many) items, you might put it into a loop instead of using a bunch of conditionals.

If you want items weighted, you'd change that in the random functions, so you set the minimum number of glass to be one third of the items you were originally given, or whatever you want.

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