Event with timer problem

Hi !
I have a little timer problem. Note that it's my first game, so sorry if my problem sound stupid 😛

So I have this side quest in my game where the main character must explore a cave to find a kid before something happen to him.

When you enter the cave, the timer starts and you have 40 seconds to find the kid before he dies. Everything worked fine. The timer starts, find the kid in time he lives and if the timer countdown to zero the sprite of the kid change and the cutscene ''dead kid'' is activated.

The problem is, I decided to had some monsters to level up the difficulty a bit. They are ghost that chase after you and start a battle if they touch you. So to reach the kid in time you have to avoid them. But when the timer turns to zero while in battle, the battle is interrupt, then restart again and the switch that activate the ''death'' of the kid is not turned on by the parallel event in charge.

Any idea what to do so  the battle don't get interrupted when the timer reach zero and so the switch that ''kill'' the kid gets activated in, or at least after, the battle when the timer reach zero?
You'll need a script modification for this.


There are some scripts that might help and even scripts that give more timer options, but I don't have the links at the moment.


I've moved this thread to Script Request. Please be sure to post your threads in the correct forum next time. Thank you.
Thank you.Sorry for the wrong section, I thought it was doable without using scripting. I will do some research if I find one, I will put the link here to help others.
I found a script that works perfectly for what I wanted to do. Here is the link for those who may be interested:

http://galvs-scripts.com/galvs-variable-timer/
Zreine, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


Closing.

Original thread: https://forums.rpgmakerweb.com/threads/event-with-timer-problem.42858/