Help with creating a Unique Battle Event

Hello I am trying to creature a unique battle event in my rpg.

I want it to work as follows.

If a player stand on a specific tile on the world map they will receive a warning message.

Ever 5 seconds the player stands on the tile without moving off the message will become more severe.

If the player stands on the tile for 20 seconds a battle initiates.

If the player moves off the tile any time before the battle initiates the timer is reset.  

Moving back on that tile would begin the first warning message and the entire process over again.

If the player wins the battle the event is permanently cleared

If the player dies its game over

Help is appreciated
Just a question... 

When you say a timer, do you mean you want a visual timer? or a timer in the background that can't be seen?

Also do you mean this as a unique event, or are you going to be doing this in many many different places on the world map?
Hello a timer that can't be seen.  This is the part of the event I'm having the most trouble with.  I don't know how to set a condition that if a player stands idle on a specific tile for a set amount of time it starts a new switch.  I want the player to be able to leave the tile and have the timer reset to 0 and if he comes back the event starts over.
Ok, i got your solution, GIve me a moment to write it up.

Ok, what you'll need to do this, are 4 variables, 1 switch, and 2 common events.

Variables:

I have them as 

BtriggerswX, BtriggerswXb, BtriggerswY, BtriggerswYb

One switch:

I have it as "battlecontroltile"

First, make your event, on the first page, make it look like this:

evepg1.jpg


on the second page, this:

evepg2.jpg


and 3rd page 

evepg3.jpg


On the fourth page, it's just a simple condtion switch of B with nothing else on it. 

As for your common events, These two "xycoords", and "battletilemonitor"

Ofcourse you don't have to have those names... Ignore the other events, those are my own XD

comevent2.jpg


comevent3.jpg


When you step on the tile, you are not interrupted of commands. you can move freely, and the actions on the second page begin. 

The first page, i set the variables of the location of where the player is (That being ontop of the tile), and it stores those variables in the BX/Y variables.

The first page activates a switch, which turns on the common event "xycoords". That common event runs a continuous process, updating the location of where the player is on the map. As soon as they move, that will update the variable to their position.

Now, the key is, The other common event page is a continuous check to make sure the coords set by the event, always match the players current position. If the player moves, the coords change, and when it doesn't match up, it turns off the "battlecontroltile" switch, turns off everything, and reverts the event to the first page.

If you stay on the tile the entire time, then at the end of the actions on page 2, the battle will start. At the end, switch A turns on page 3, which turns off battlecontroltile, disabling the checks for the variables, then activates page 4 to permanently disable the event! Yay!

It should be simple enough to use to manipulate and change how you see fit.. 

Hope this helps!

-

ALso, this is set up in a way via common events, so you can use this anywhere you want, whenever you want, as many times as you want! Just by setting up the event only. 
Wow that's so nice of you to make that for me.  I hope other people will use it too.  Thanks!
You're welcome! 
If you have any questions about it, pm me.

Original thread: https://forums.rpgmakerweb.com/threads/help-with-creating-a-unique-battle-event.24374/