Notice: fwrite(): Write of 44 bytes failed with errno=28 No space left on device in /home/rmrk/domains/rmrk.net/public_html/Sources/Cache/APIs/FileBased.php on line 96
Print Page - Random prices for select items

The RPG Maker Resource Kit

Other Game Creation => Program Troubleshooting => Topic started by: thechromeninja on September 04, 2009, 01:26:46 PM

Title: Random prices for select items
Post by: thechromeninja on September 04, 2009, 01:26:46 PM
I'm new to the scene so any help is appreciated...
Is there some way to set up an event that will randomly change the price of select 'items for sale' every time you bring up a shop menu. Even better would be a way to keep the randomization within specific parameters for each item (i.e. 'silver nuggets' between 35 and 55 at one shop and between 115 and 145 at another). I haven't played with the events a whole lot so i may end up figuring this out but, any help would be sick...Thank you...
Title: Re: Random prices for select items
Post by: Grafikal on September 04, 2009, 05:07:27 PM
There's no event that just does that. You could still do it, but it'd be kind of barbaric. You would have to set up the database with like 2-3 times as many items. Basically, you'd make all your items you'll need (that you would sell) then copy/paste them however many times you want (2-3 times or more if you want). How many times is how random you can make your shops. Then when you go to make a shop keeper, instead of just placing a Shop Processing event, you'd start the event with a Variable. Variable:Name[000x]==random[0-2]. Just after the variable, you'd make a conditional branch checking if the variable you just created is equal to 0. If not (in the else section) you would make another conditional branch checking if the variable you created is equal to 1, if not (again in the else section here) you would make another conditional branch checking if the variable you created is equal to 2. Keep doing this for however many times you copied your database items. Now in each of the true statements of the conditional branches you just made, go through and place a Shop Processing event and set the items for each one as a different version of the same items. (That's why you copy/paste the items you would sell in the database. When you paste the item, make sure you change the price in the database).

What I just told you would work, but the problems with it are A: You lose a lot of database space, and B: It's not true random. If you want something less barbaric (which I would suggest) then look for a script and not an event. :)

And welcome to RMRK.
Title: Re: Random prices for select items
Post by: thechromeninja on September 15, 2009, 03:00:33 PM
thank you sir