[SOLVED] Battle Timer?

I am trying to set up a battle in MZ on a timer. You will have 10 seconds to answer a question, and if you run out of time you get a failure message and the battle aborts. Don't know how to order this event. I know I need to make a loop of some sort to check the timer but not sure how exactly:

1628217531504.png


What happens currently is the timer will reach 0 but the choice window will still be open, and it waits for you to choose an answer and then aborts the battle with no comment.
You will need a plugin for this.
By default, in battle, when the timer reaches 0, the battle is aborted. Also, by default, choices in MZ takes as much time as the player wants.

Tsukihime had a plugin but for MV, I don't think there is an MZ version though.

EDIT
There is a plugin by Galv, MZ Message Timer, probably that should work for you.
You will need a plugin for this.
By default, in battle, when the timer reaches 0, the battle is aborted. Also, by default, choices in MZ takes as much time as the player wants.

Tsukihime had a plugin but for MV, I don't think there is an MZ version though.
Aww, alright. I figured I would have to find a way to break the choices scene somehow. Thanks for reply! There are a few out there like https://galvs-scripts.com/2020/10/11/mz-message-timer/ but I was having trouble getting it to work in battle. Maybe I'll try again.
Here's something that sort of does what you want. It uses a $gameTimer.pause() script call to keep the timer from counting down while the choice menu is displayed and penalizes the player by wasting 2 seconds when they choose a wrong answer (in this case "no" or "maybe"). It triggers the "Time's Up!" text at 1 second in order to get around the battle automatically ending at 0.

It doesn't have the time pressure during the actual choice, which is too bad, but it does have ticking clock mechanic and doesn't require any plugins.

The way it's written right now, the player can't take any battle actions until making the right choice.

Note: this is really not elegant code but it shouldn't light anything on fire. But no warranties etc.

Spoiler
Code:
◆Text:None, None, Window, Bottom
:    :Hurry up and choose!
◆Control Timer:Start, 0 min 10 sec
◆Label:CCC
◆Script:$gameTimer.resume()
◆Wait:120 frames
◆If:Timer ≥ 0 min 3 sec
  ◆Script:$gameTimer.pause()
  ◆Show Choices:Yes, No, Maybe (Window, Right, #1, -)
  :When Yes
    ◆Control Timer:Stop
    ◆Jump to Label:BBB
    ◆
  :When No
    ◆Text:None, None, Window, Bottom
    :    :WRONG!
    ◆Jump to Label:CCC
    ◆
  :When Maybe
    ◆Text:None, None, Window, Bottom
    :    :WRONG!
    ◆Jump to Label:CCC
    ◆
  :End
  ◆
:End
◆Label:AAA
◆Wait:6 frames
◆If:Timer ≤ 0 min 1 sec
  ◆Script:$gameTimer.pause()
  ◆Text:None, None, Window, Bottom
  :    :Time's up!
  ◆Script:$gameTimer.resume()
  ◆
:Else
  ◆Jump to Label:AAA
  ◆
:End
◆Label:BBB

Here's what it looks like in action:

Here's something that sort of does what you want. It uses a $gameTimer.pause() script call to keep the timer from counting down while the choice menu is displayed and penalizes the player by wasting 2 seconds when they choose a wrong answer (in this case "no" or "maybe"). It triggers the "Time's Up!" text at 1 second in order to get around the battle automatically ending at 0.

It doesn't have the time pressure during the actual choice, which is too bad, but it does have ticking clock mechanic and doesn't require any plugins.

The way it's written right now, the player can't take any battle actions until making the right choice.

Note: this is really not elegant code but it shouldn't light anything on fire. But no warranties etc.

Spoiler
Code:
◆Text:None, None, Window, Bottom
:    :Hurry up and choose!
◆Control Timer:Start, 0 min 10 sec
◆Label:CCC
◆Script:$gameTimer.resume()
◆Wait:120 frames
◆If:Timer ≥ 0 min 3 sec
  ◆Script:$gameTimer.pause()
  ◆Show Choices:Yes, No, Maybe (Window, Right, #1, -)
  :When Yes
    ◆Control Timer:Stop
    ◆Jump to Label:BBB
    ◆
  :When No
    ◆Text:None, None, Window, Bottom
    :    :WRONG!
    ◆Jump to Label:CCC
    ◆
  :When Maybe
    ◆Text:None, None, Window, Bottom
    :    :WRONG!
    ◆Jump to Label:CCC
    ◆
  :End
  ◆
:End
◆Label:AAA
◆Wait:6 frames
◆If:Timer ≤ 0 min 1 sec
  ◆Script:$gameTimer.pause()
  ◆Text:None, None, Window, Bottom
  :    :Time's up!
  ◆Script:$gameTimer.resume()
  ◆
:Else
  ◆Jump to Label:AAA
  ◆
:End
◆Label:BBB

Here's what it looks like in action:


Huh, interesting! I will try this out and see if it works for my situation. Thanks!
I managed to get Galv's message timers working for this to my satisfaction. Just put MT[10] in the text for the first choice. Also I have learned that a lot of plugins do not work in troop test. You can lock this thread.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-battle-timer.139299/