Completely Random event

GO TO ADMIN PANEL > ADD-ONS AND INSTALL ABSTRACT SIDEBAR TO SEE FORUMS AND SIDEBAR

Xyphien

Owner
Staff member
Administrator
Resource Team
Joined
Oct 2, 2015
Messages
1,985
Points
686
Age
25
Website
www.Xyphien.com
I'm about to make a simulator game, and need it so random people will enter the room and talk to you. For example:
8313

The guy in the suit is a salesman, he comes at random, walks in, and talks to you. How would you go about making it so random people come in and talk to you at random times. Not just the sales man, but if a plumber comes in, fireman, waitress, etc.
 

UngraguGaming

Villager
Joined
Mar 14, 2017
Messages
49
Points
38
Age
18
David Foxfire said:
  1. Create Common Event, this will be your overall event checker.
  2. Parallel Process it on each map to do the following:
  • Set timer to countdown starting at random time
  • After countdown, select random variable between 0 - X; X being the maximum number of possible events you can have happen on a certain map, in your case, 3
  • After it has chosen a number between 0 - 3, set that as your Global Event Variable.
3. Create all your events on that map and position them as you would. Have them set and activated by checking to see if the Global Event Variable is a certain value.

If it is 0 then loop the parallel process again and it will countdown at a different time and pick a different number. If it has selected 1 - 3, then the event will trigger. From here you could be doing this many ways. If you wish to continue random events even when one is currently running then you will need to check to see if your Global Event Variable has a value. If it does, then loop the random countdown once more but this time assign the value to a second Global Event Variable. This can continue forever. If you wish not to run another event when one is running then check the 1st Global Event Variable and if it contains a value, temporarily loop itself back again after a random countdown once more and continually check to see if the Global Event Variable has a value, when it no longer doesnt then replace it's value with a random one like you were from the very beginning.

This is the easiest and most flexible way to do it.
He mentioned this in a thread on here, if I recall. You could make it so the common event also deals with changing the sprite, and then just have it play in a parallel blank sprite or something.
 
Top