The RPG Maker Resource Kit

RMRK RPG Maker Creation => RPG Maker General => General Tutorials and Eventing => Topic started by: Deta on August 27, 2008, 08:38:34 PM

Title: Tutorial: Simple Random Item Placement
Post by: Deta on August 27, 2008, 08:38:34 PM
I thought this up while building the interior to a restraunt.  I tried it and it works.

All that's needed is:
1 Variable
An Event on the screen that you are doing this to

Okay, on the door that leads to the area, you need it to set a variable.  Like:
Control Variable:  [Restraunt Randomizer] = Random No. [1...3] (This can be 1 to however many random combinations you want)

Now, the people and objects INSIDE.

Create an event.  Place it on the right side of a table.  Trigger should be Variable Restraunt Randomizer = to 1.
The sprite is an Old Lady.  She says "I really hate Tomato Soup..."
Add a page to this event.  This page also has a Trigger.  Restraunt Randomizer = to 3.
This time the Sprite is a Little Boy.  He says "The food here is WAY better than at home!"
Add pages until you get all your Restraunt Randomizer numbers.

Create ANOTHER event.  This time it's in the LEFT side of the table.  Trigger should be Variable Restraunt Randomizer = to 1.
The sprite is an Old Man.  He says "Tomatoes are good for the Heart.  I don't see why my wife hates them so."
Add a page to this event.  This page also has a Trigger.  Restraunt Randomizer = to 2.
This sprite is a Young Man.  He says "I'll just drink my worries away...
Add ANOTHER page.  You guessed it.  Trigger is Restraunt Randomizer = to 3.
This time the Sprite is a Young Woman.  She says "My son has no appreciation for the time I spend cooking."
Add pages until you get all your Restraunt Randomizer numbers.

Create yet ANOTHER event.  It should be ON the Table this time.  Trigger should be Variable Restraunt Randomizer = to 1.
The sprite is a Pot. 
Add a page to this event.  This page also has a Trigger.  Restraunt Randomizer = to 2.
This sprite is a Salad.
Add ANOTHER page.  You guessed it.  Trigger is Restraunt Randomizer = to 3.
This time the Sprite is a Bottle of Wine.
Add pages until you get all your Restraunt Randomizer numbers.

So, the result:

Upon entry of the map, say it sets it to 1.  There's an Old Lady near a table, at the other side of the table is an Old Man.  On top of the table is a pot.
Upon entry of the map next time, it sets it to 3.  There's a Little Boy near a table, a Young Woman on the other side, and a salad on the table.
Upon entry of the map next time, it sets it to 2.  There's No one at one side of the table, and a Young Man at the other.  There's a bottle of Wine on the table.

I'm sure you can find many ways to use this.  The best thing is, this Variable is reusable!  You can use the same variable on MANY maps.  Now some of your places won't look the same EVERYTIME!  Just a simple way to add a little variety to your game!

I hope this helps you all!  ^^
Title: Re: Tutorial: Simple Random Item Placement
Post by: drakenkanon on August 28, 2008, 06:27:54 AM
nice, but in your example their is one wrong thing: the kid drinks wine :P
Title: Re: Tutorial: Simple Random Item Placement
Post by: Blulightning on September 03, 2008, 01:29:00 PM
No, the kid isn't drinking, it's the young man.
Title: Re: Tutorial: Simple Random Item Placement
Post by: drakenkanon on September 03, 2008, 02:12:19 PM
o...
Title: Re: Tutorial: Simple Random Item Placement
Post by: Blulightning on September 03, 2008, 03:07:47 PM
lol sok, for me it's super early in the morning, I just can't sleep, and when I read it through I thought the kid hated tomato vodka.
Title: Re: Tutorial: Simple Random Item Placement
Post by: Revo on September 03, 2008, 04:43:10 PM
Nice tutorial. I think I'll use this some. It's something I wouldn't have thought of. ;)

Oh and you did make the kid be a drinker. You set the kid and the mother to 3 and the bottle of wine to 3 as well. The young man will be drinking a salad. ;)

Still, a nice tutorial.
Title: Re: Tutorial: Simple Random Item Placement
Post by: zzzdude on September 05, 2008, 06:08:21 AM
I must say, the idea to have random events in a place is very unique, I haven't seen something similar posted anywhere.
I have an addition you might like:
Set the events X and Y coords randomly as well, however this might cause some unwanted occurrences like spawning the event inside a table...
But still possible.
I'll bet I could come up with an algorithm to fix it though.
Detect the events terrain tag or something...
Then +1 everytime it lands on that tag.
And when it reaches the max X, then change it to 0, and continue detecting.
Repeat with Y.
I think I shall go see if I can do this...