The RPG Maker Resource Kit

RMRK RPG Maker Creation => Requests => Script Request => Topic started by: fredcowgill on April 18, 2010, 07:16:58 PM

Title: Random Spawn Items
Post by: fredcowgill on April 18, 2010, 07:16:58 PM
Ok I'm sorry if this has been asked before but I'm new to this forum. Anyway I was looking for a script or just a method for random, or rather levelled lists, of spawning items. What I am attempting is to make a Growbag, which will grow items randomly, or per number of steps. Not important items really, more of a novelty. I am attempting to make a Dark Tower game, which for those of you that don't know, is a series of books written by Stephen King. Its an epic journey of a sort of knight. Anyway there are plenty of magical things including a pouch that produces things like tobacco and small gems randomly. I'm using modern algebra's Grid Inventory System v.1.0b if it matters.
Title: Re: Random Spawn Items
Post by: Grafikal on April 18, 2010, 07:34:48 PM
I would agree that you might need a script for this. You could do this with events by having a common event set on a random timer using variables that will give the player random items at different times, however, it gets really tricky the deeper and more items you want to have given. Not to mention that it seems like you'd probably need an event per item and a way to turn it all off or on. Complicated to dance with events like this.
Title: Re: Random Spawn Items
Post by: modern algebra on April 18, 2010, 07:41:24 PM
Well, you could do a combination of what grafikal is suggesting with my Item Drop Ranks (http://rmrk.net/index.php/topic,34611.0.html) script. You could have the common event set a variable to steps and check how many steps are taken, and then give a dummy item which randomly distributes any item of the same rank, meaning that you can increase the rank as you go along as well. I am actually not positive it works with Grid Inventory, but try putting it below the Grid Inventory in the editor and see if it works. I *think* it should
Title: Re: Random Spawn Items
Post by: fredcowgill on April 21, 2010, 08:28:30 PM
This may be a dumb question... But how do I make events happen without any activated button or anything. Meaning something that happens while just walking?  Like for my growbag to have items when it is checked after a while?
Title: Re: Random Spawn Items
Post by: Mr_Wiggles on April 21, 2010, 08:38:09 PM
if your doing it in a script or common event you could make it turn a switch on, that would make an event that is on the map (like in the corner) that would transfer to the players location.  Then a conditional branch that uses a number in a variable that would be the random item they obtained, this can all be done with a common event.

I made a demo.

If you want it to be an item that you have to use to check, have the item non consumable, and then run a common event that contains the same stuff that is in the event that i created on the map, excluding the self switch, just make a condition for the "time for item" switch if on run random variable, if off say its empty.
Title: Re: Random Spawn Items
Post by: fredcowgill on April 21, 2010, 09:04:13 PM
I don't quite understand the first part... You make an event transfer to the player so it sets itself off? And will this event continue counting steps throughout the game?

I mean all I really need is an event that counts steps and automatically adds items to an inventory throughout the game. If it can do that automatically, then thanks to modern algebra, the item drops will be no problem.
Title: Re: Random Spawn Items
Post by: modern algebra on April 21, 2010, 09:08:26 PM
I haven't looked at Mr_Wiggle's event, but:

Quote from: fredcowgill on April 21, 2010, 08:28:30 PMhow do I make events happen without any activated button or anything. Meaning something that happens while just walking?  Like for my growbag to have items when it is checked after a while?

All you need to do is set the event to trigger on parallel process instead of Action Button.
Title: Re: Random Spawn Items
Post by: Mr_Wiggles on April 21, 2010, 09:21:06 PM
Well turn its self off, was because the event would continue to transfer its self to the players location.  Sorry if that was confusing.  Also if you just want it to add directly into the inventory look over what i did and combine every thing into one common that will just add an item to the inventory.  Like in the event on the map where it will use a random number through the inventory, just make that in the event.  Sorry, it's easier for me to just make demos then it is to tell how to do something. I'm throwing another demo together.

set up a common event like this:
(https://rmrk.net/proxy.php?request=http%3A%2F%2Fscreensnapr.com%2Fu%2Falr7v6.png&hash=016624b05f57206a9bfa205e7bcec851fa0f80f7)
   (https://rmrk.net/proxy.php?request=http%3A%2F%2Fscreensnapr.com%2Fu%2Fm6r629.png&hash=7af8bf32d63a682800dc58727a61c19e8b68129e)
Title: Re: Random Spawn Items
Post by: fredcowgill on April 21, 2010, 09:33:06 PM
Ok I tried to do it on a parallel process, but when I set off the switch, it just dumped a bunch of items into the inventory. I tried to set it to drop an item after 10 steps and restart that variable, but I messed up somewhere.
Title: Re: Random Spawn Items
Post by: Mr_Wiggles on April 21, 2010, 09:35:16 PM
The set up that i created in the common in the pictures in my post ^ should work just fine. you can change stuff of course and add more items into the mix.
Title: Re: Random Spawn Items
Post by: fredcowgill on April 21, 2010, 09:41:38 PM
Excellent Mr_Wiggles. I appreciate your effort, it seems to work just fine. I'll just tweak the steps and items. Thank you modern algebra and grafikal.
Title: Re: Random Spawn Items
Post by: fredcowgill on April 21, 2010, 09:57:27 PM
Sorry. One more thing. I seem to be an idiot when it comes to scripting. Or anything really. But the grid inventory script... I want the item to appear in the container. The item being 0023: dumb and I need quantity one to appear in container one. Can you help a sorry idiot out?