How to make an event play randomly

Hi...


How do I make an event play randomly (or every, say 10 steps) because I can't find anywhere that says how to accomplish this... (I want to have the screen flash dark for a second or two)


Thanks!


(also is there anything important that I should know here... because I have no idea how this site works...)
I just did this in my game for random bursts of thunder in a stormy area. The way I did it was this:


Event: Parallel process -> action button, put it in some place the player can't reach though (I use 0,0 on the map).


Inside the event:


Control variable: (pick a variable here, but don't forget which one it is) = a random number between 0 - 4.


Conditional branch: If that variable is 0:


wait 60 frames (or whatever the smallest  you want the wait to be is)


Do your stuff


conditional branch: If that variable is 1:


wait 120 frames


Do your stuff.


Keep that up for all 5 cases (0, 1, 2, 3, and 4), with varying wait times. Just adjust the wait times to fit what you need, as 60 frames is 1 second.


If you do it this way it will be every x seconds, with the seconds being random. Now if you really need steps (which for what you propose seconds is more realistic than steps, and easier to implement), it's going to be much harder and I'm honestly not sure of the details there. Might require some getting cute with switches so you know when to update your variable and such, due to how parallel processes work.
I got it to work,


thanks!

Original thread: https://forums.rpgmakerweb.com/threads/how-to-make-an-event-play-randomly.67543/