Timer makes me crazy

Senfl

Warper
Member
Joined
Oct 9, 2020
Messages
1
Reaction score
0
First Language
Deutsch
Primarily Uses
RMMZ
Hello, I had a bit special idea for a game. My "hero" is a man with an alcoholic problem. If he is not drunk anymore, the game would finish. So I have a timer over the game. It starts at 40 minutes. So the plan is to let it go down, and if he drink beer increase to 40 minutes again. But always if i change the map, like walking into a house, the timer start again to 40 minutes.

I did it into an common event. The event is as a file online. By the way the code is german, but think that should not be the problem ;)


The Version is MZ.
Thanks in advance
 

Attachments

estriole

Veteran
Veteran
Joined
Jun 27, 2012
Messages
1,316
Reaction score
537
First Language
indonesian
Try using this Visual Timer Plugin
i try changing map and the timer did not reset.

hope this help.
 

Beregon

Veteran
Veteran
Joined
Aug 25, 2020
Messages
100
Reaction score
61
First Language
Czech
Primarily Uses
RMMZ
The timer does not change by default when you change maps or even if you enter battles, so there has to be something wrong with your Common Event.

By the way the code is german, but think that should not be the problem ;)
Eh, sorry, but following anyone elses thought process behind eventing is hard enough as-is, it becomes even worse when it's in a language you don't know very well. I think that there's a bunch of switches and a loop there, if I understand it well enough? What's the event trigger? I guess it's a Parallel event? Well, can't really see anything there that would reset the timer to default, if it happens on transfer, then check the transfer events or any Parallel events you might have on the map.

By the way, I will leave this here, might be useful to you if you need to overhaul the system:

This script call will store the remaining time in the Timer to a variable with ID 3 (in frames ofc):

$gameVariables.setValue(3, $gameTimer._frames);

Then later you can start the timer again with this script call:

$gameTimer.start($gameVariables.value(3));

It will start the timer again right where it left off (change the ID of the variable to whatever variable you will end up using of course).
 

caethyril

^_^
Veteran
Joined
Feb 21, 2018
Messages
2,117
Reaction score
1,525
First Language
EN
Primarily Uses
RMMZ
While it's fairly obvious in this case that you're using a Parallel event, in future I'd recommend including the event trigger (and, for map events, conditions/pages) in your screenshots. :)

Some notes on how the engine handles Parallel events:
  • All events (including active common events) are cleared when the map changes. Autorun/Parallel common events then get reactivated if appropriate for the new map. Note that an event is also cleared when it changes page (or, for Autorun/Parallel common events, when its switch changes value).

  • Parallel events each have their own interpreter, so when they get cleared, their interpreter is removed and they stop immediately. Other event triggers run through a persistent interpreter (map or battle), thus do not get interrupted on map change.

  • Parallel (and Autorun) events trigger every frame they are not already running, making them ideal for looped processes, e.g. checking every X frames to see if the protagonist is sober yet.
I'm guessing what you're seeing is a Parallel event restarting when you change maps. :kaoslp:

You have an event to turn on this common event's switch, right? I'd suggest starting the timer in that event instead, e.g.
Code:
◆Comment:Initialise timer
◆Control Timer:Start, 4 min 0 sec
◆Comment:Start the common event
◆Control Switches:#0001 drunk = ON
Code:
◆Comment:Check timer
◆If:Timer ≤ 0 min 0 sec
  ◆Comment:Time up!
  ◆
:Else
  ◆If:Timer ≤ 2 min 0 sec
    ◆Comment:0~2 mins left!
    ◆
  :Else
    ◆Comment:2~4 mins left!
    ◆
  :End
  ◆
:End
◆Comment:Wait a bit before checking again
◆Wait:60 frames
:kaopride:
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.
Can someone recommend some fun story-heavy RPGs to me? Coming up with good gameplay is a nightmare! I was thinking of making some gameplay platforming-based, but that doesn't work well in RPG form*. I also was thinking of removing battles, but that would be too much like OneShot. I don't even know how to make good puzzles!
one bad plugin combo later and one of my followers is moonwalking off the screen on his own... I didn't even more yet on the new map lol.

Forum statistics

Threads
106,035
Messages
1,018,450
Members
137,820
Latest member
georg09byron
Top