MZ Animation on region tag with random wait time

Hey there everyone!

It's a little hard to explain in the title, but what I'm looking for is something to be able to set a region tag to the walkable area and have it play an animation on one of these region tags at random and with a random wait time before the next one.

So if that is too confusing, here is what I'm trying to do.. I'm making a lightning themed dungeon and I want random lightning strikes throughout the dungeon. I don't want it to be predictable, so I can't just place an event with a play animation and wait time. Also if it is possible, I would love it to be able to deal damage to the player, the whole party.

It is possible that I might use this for other fun stuff in my game, so I would like it to have an option to change the animation, wait times, how much damage it can deal to the party, and the region id.
http://www.yanfly.moe/wiki/Events_and_Movement_Core_VisuStella_MZ#Region_Rulings

Trigger common events based on region ID.
Have a variable randomise number. If a specific number is picked, event animation and damage, etc.
Trying to set this up with that method, I can either get every space with the region tag to show the animation or none at all.. I'm not sure if I'm just not setting it up right.
Could you show me how you would set it up, I'm also not that great at using variables really..
There are many ways to do this, I will provide one small example for you to get a better understanding.

1. Create the Common Event to use. lets name it "Lightning".
2. Create three Variables for this Common Event.
Spoiler: Variables
Variables.png
3. Control Variables "RNG"
-Set random 0 ~ 3
Spoiler: RNG
RNG.png

You can change the range to affect the percentage chance:
0 ~ 1 = 50%
0 ~ 2 = 33%
0 ~ 3 = 25%
etc....
At 25% it's 50% no strike, 50% strike, but only 25% to strike you.

4. Conditional Branch : Variable "RNG" Constant 0
Conditional Branch : Variable "RNG" Constant 1
*This leaves Variable 2 and 3 with no action(Lightning Strike).
>Within branch 0 : Show animation on player (add whatever effects you want to show player has been struck), Change HP : Entire Party -1(or whatever amount)
>Within branch 1 : Control Variables "Lightning X"
Spoiler: Screen X
ScreenX.png
-Set random 0 ~ 1280 (or whatever range of the screen you want to include).
>Within branch 1 : Control Variables "Lightning Y"
Spoiler: Screen Y
ScreenY.png
-Set random 0 ~ 720 (or whatever range of the screen you want to include).
5. Use Plugin Command(Event page 3, last choice)
Spoiler: Plugin Command
PluginCommand.png
Under Plugin Name, choose VisuMZ_0_CoreEngine
Spoiler: Plugin Name
PluginName.png

CorePlugin.png
*It should automatically set the Command Name to Animation: Play at Coordinate; if not, select this.
Spoiler: Command Name
CommandName.png
>Double-Click X Coordinates to set, paste this in:
Code:
$gameVariables.value(41)
*Adjust the number to reflect the number of the Variable you set to Lightning X in step 2.
>Double-Click Y Coordinates to set, paste this in:
Code:
$gameVariables.value(42)
*Adjust the number to reflect the number of the Variable you set to Lightning Y in step 2.

You should now end up with something like this:
Spoiler: RESULT
CommonEvent.png

6. Plugin Manager > VisuMZ_1_EventsMoveCore > Common Event on Touch
Spoiler: Common Event on Touch
CEonTouch.png
>Set which region will call the Common Event you just created.
Spoiler: Region Setting
RegionSettings.png

CELink.png

CESet.png

7. Setup Map Regions however you like
Spoiler: Map Regions
MapRegions.png
*The areas you've marked will call the common event.
*You can also copy the Common Event and adjust the Lightning Strike rate or even have it not strike the player, then link that to a different region, etc.

I hope this provides enough guidance and inspiration to help you understand as well as inspire your own creativity.
ENJOY~!!

Wow, this was amazing, thank you very much for going through that much effort!

Very easy to follow and I learned something.
Welcome, Friend!

Original thread: https://forums.rpgmakerweb.com/threads/animation-on-region-tag-with-random-wait-time.142017/