Timer for my Math Game

Hi , does anyone know how do I set countdown in the battle system? I'm using event by the way
Example , you have 5 seconds to answer this question. Once the countdown reaches 0 , the enemy will attack. The Timer will reset back and ask the question again
Untitled.png

I'm currently making a mathematic game
When I use Timer in the Event , the game ended instant. I already use conditional branch. Not working.
Save these two lines to a new .js file (doesn't matter what you call it) in your Plugins folder, and then add the plugin to your game:

Code:
Game_Timer.prototype.onExpire = function() {
};

That just stops it aborting a battle when the timer ends, so your conditional branch should be able to pick it up.
By default, if a timer runs down to 0 in battle, the combat ends. This is because Game_Timer's update function calls onExpire when its frames property becomes 0, which in turn calls BattleManager.abort. If you want to override this behaviour, you basically just need to remove the call to onExpire.

Edit: Ninja Shaz got in there before me.
I didn't remove the call to onExpire, but I just made that function do nothing 🙂
By default, if a timer runs down to 0 in battle, the combat ends. This is because Game_Timer's update function calls onExpire when its frames property becomes 0, which in turn calls BattleManager.abort. If you want to override this behaviour, you basically just need to remove the call to onExpire.

Edit: Ninja Shaz got in there before me.
Which .js file contain that line?
Save these two lines to a new .js file (doesn't matter what you call it) in your Plugins folder, and then add the plugin to your game:

Code:
Game_Timer.prototype.onExpire = function() {
};

That just stops it aborting a battle when the timer ends, so your conditional branch should be able to pick it up.
Thanks for reply
I create the plugin as you said but not working though
The game ended instantly lol
Untitled.png
Did you save it as a filename.js in the js/plugins folder? Did you add it in your plugin manager and turn it on? Please show a screenshot of your plugin manager.

That event is not going to work anyway. It's either going to start the timer for 3 seconds and then check straight away whether the timer is 0 (which it won't be, because you just set it to 3 seconds), the condition will be false and the command won't run, or if you've got it on a looping troop event page, it's going to continually reset the timer to 3 seconds so it will never reach 0.
Did you save it as a filename.js in the js/plugins folder? Did you add it in your plugin manager and turn it on? Please show a screenshot of your plugin manager.

That event is not going to work anyway. It's either going to start the timer for 3 seconds and then check straight away whether the timer is 0 (which it won't be, because you just set it to 3 seconds), the condition will be false and the command won't run, or if you've got it on a looping troop event page, it's going to continually reset the timer to 3 seconds so it will never reach 0.

Sorry for the late reply. Busy with college stuff
I named the plugin as TimerBattle
CTfq4zQZ.png


Do you have any example of Event that use timer? Something like when it reaches 0 , it will do what the conditional branch says
Well the timer reaches 0 and the game does not end , I guess the two lines you asked me to add as plugin works.
Now , the only thing don't work is the conditional branch. It
Then it might be something about your event commands. Can you post a screenshot of the troop event page, with the whole window visible? Also if there are conditions for the page, open up that window and grab a screenshot of it as well. It could be something simple like the span being incorrect.

Just - when you say the "game" does not end, do you mean the "battle" does not end?
Then it might be something about your event commands. Can you post a screenshot of the troop event page, with the whole window visible? Also if there are conditions for the page, open up that window and grab a screenshot of it as well. It could be something simple like the span being incorrect.

Just - when you say the "game" does not end, do you mean the "battle" does not end?
Yes , I meant the battle scene.
Also , I'm not using the actual Battle system(attack , using magic , etc). Its all event
I use Common event because its more neat to just call the event into Troop's and also makes my work more easier to put the event on other Troop's event page
HRzfq.png


My battle event
O89GLMY6.png

Last line is Break Loop. Sorry for the wrong crop
What I'm trying to do , when timer reaches 0 , the enemy will attack and ask again the question

That event page haven't put the timer yet. I'm still experimenting it.
I'm very sorry if I'm bad at explaning what I want. My english vocab is very bad lol
I can't see the images, unfortunately.
I can't see the images, unfortunately.
@Trihan Really? The image appear just fine here
http://www.nyanimg.com/i/O89GLMY6.png
http://www.nyanimg.com/i/HRzfq.png
Oh, it's because of my work network restrictions on mass storage sites.
I havent solve this yet.
Anyone willing to help me?
So , I found this.
http://himeworks.com/2016/05/timed-choice-selection/
A code line

$gameMessage.forceCancel();

Which force cancel the Choice Selection.
Is there any similar code to force cancel the Choice Input Number?

Original thread: https://forums.rpgmakerweb.com/threads/timer-for-my-math-game.75080/