Event askes for something random?

Hey guys, basically I'm doing an event that can happen at random but I'm having a brain fog; I think I can do this with normal eventing and no need for script, can you help? Thank you!


it goes like this: 


player has 2 flowers, 3 chickens, and a mango. 


What should I do if I want someone to ask the player to give them a (random number) of (item) the player has? 


Surely i would first do a conditional branch where it checks if the player has the item first but how can I get them to ask for one of the random items, and the amount of the item as well? What could I do to event it so they come and ask randomly?


Too bad there's not like a dice roll or something that would randomise it.


it is a reoccurring event, so I'd like them to come at the player with different wants each time. 


Thanks for for any help 


I'm not great at explaining so I appreciate it if anyone can point me in a direction!
You probably need to use a variable to check for and store the number of required items.


E.g. run a "control variable" event that sets a variable called "requiredMangos" to a random number between 1 and X. Do this for all 3 items.


From there, you can print the number of required mangos in a message box (I required \v[x] mangos), and you can also use conditional branches to see if the player has a quantity of mangos that equals the value stored in the variable.


Edit: to check how many items your player possesses, you'll also need to run a Control Variable event.


Select Control Variable, select the Set radio button, select the Game Data radio button under the Operand panel, and then select the Item (Possession Count) radio button. That will allow you to check how many mangos your player has, and you can then compare the two variables using a conditional branch.


This is probably a very basic example of what you'll want to look into doing:


http://imgur.com/KdUZRaK
You probably need to use a variable to check for and store the number of required items.


E.g. run a "control variable" event that sets a variable called "requiredMangos" to a random number between 1 and X. Do this for all 3 items.


From there, you can print the number of required mangos in a message box (I required \v[x] mangos), and you can also use conditional branches to see if the player has a quantity of mangos that equals the value stored in the variable.


Edit: to check how many items your player possesses, you'll also need to run a Control Variable event.


Select Control Variable, select the Set radio button, select the Game Data radio button under the Operand panel, and then select the Item (Possession Count) radio button. That will allow you to check how many mangos your player has, and you can then compare the two variables using a conditional branch.

Very well said, but this can truly be done with pure variables and switches.


Let me simulate it for a bit to have a definitive solution ^_^
You think so? ^


if you have a better option I'd love to see it! Thanks so much for your help too, Kenen; that's so descriptive! 


So I would have-- (please if this is correct?) for each item


a check for the item amount in inventory, then


a check for how many would be wanted?


if I wanted to trade for it,


would I just put another conditional in after it? 


like, if requiredmangos = 1 then trade 10g, if = 2 then 20g, etc? 


Sorry im trying to visualise this all in my head ?


If anyone can help me I'd love it, this is a simple but huge part of the economy in my game! If I can just get one right, they can all follow suit!
Still looking around if anyone can help out! <3
Still looking around if anyone can help out! <3



Is this any use to you..?

Spoiler
When triggered, this Event decides, randomly, which of the three Items to give, then, according to the Number available, gives out a random quantity between one and the maximum (inclusive...)...


gusSjf1.png



Just for testing purposes, I fill in the Item quantities here, but they would, of course, normally be handled by the Game...


79hhYNO.png



Hope this helps.

Original thread: https://forums.rpgmakerweb.com/threads/event-askes-for-something-random.65453/