Problem with time progression event

Discussion in 'RPG Maker VX Ace' started by Llov11, Sep 22, 2019.

  1. Llov11

    Llov11 Villager Member

    Messages:
    12
    Likes Received:
    1
    Location:
    Buenos Aires, Argentina
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    Hi! Sorry to bother with this question, but I'm having trouble with a common event I've been working with, so any help is welcome.

    First of all, I know there are scripts that achieves this very easily but I really love eventing.

    Having said that, this is my time progression system:

    First common event takes care of advancing time 10 minutes every 12,5 seconds. This way an ingame day would take half a real hour. (Changed it to 30 or 60 frames when testing)
    CommonEventTime_Progression.png

    Second common event is the one that makes the hours go by. Every 6 iterations of the first common event an hour is added in the variable "hours" and the variable "minutes" is set to 0. Also when the variable "hours" reaches 24, it's set to 0.
    CommonEventClock.png

    The third event is the one that divides the time in ranges, which allows events to behave differently in different moments of the day.
    CommonEventDaylight_stages1.png

    Now the problem I'm experimenting is really weird, because It's kind of random. Time goes by smoothly most of the time but at some point, which I can't seem to reproduce, when the variable minutes reaches 6, instead of turning automatically to 0 (second Common Event) it keeps going up.

    I would really apreciate your help with this one because I feel I'm really close to getting it to work consistently.

    Thank you!

    PS: Sorry for all the spanish, but I guess it's still understandable. Besides, it's never too late to learn some ESPAƑOL.
     
    #1
  2. Andar

    Andar Veteran Veteran

    Messages:
    28,644
    Likes Received:
    6,584
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    One problem with the way you're doing it is that any map change resets all common events.
    The result is that the wait(750) is restarted when that happens.
    The solution is to use smaller waits and count a variable up for the time - the maximum frames lost by a reset will be the number in the wait, and 750 is a bit much in my opinion, better would be to use a wait(75) and count up a variable for ten of them.


    The second problem is that you split your time control over different parallel processes. That is known to createtiming problems.
    you should combine them into a single common event, checking the values each time after the counter goes up with the waits.


    Third problem is that your counter conditions are a bit convoluted. Your direct problem will probably go away as soon as all three parts are in a single common event, but you should streamline the conditions as well. For example you don't need to check both limits (upper and lower) if you order them correctly - if everything is ordered correctly you only need to check for the upper limit.
     
    #2
    Llov11 likes this.
  3. Llov11

    Llov11 Villager Member

    Messages:
    12
    Likes Received:
    1
    Location:
    Buenos Aires, Argentina
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    Thank you so much for your answer!

    Yes, the time progress loss when changing map is something that I was planning on improving.

    Do you think that by the way it's written, just cutting and pasting the content of the second common event after the last line of the first one should do the trick? I was worried that the larger the event, the longer it would take to run, thus messing up the timer functioning. But I guess it's still fractions of seconds for a machine.

    And for the counter conditions, as I get the fact that they unnecessarily check both limits, I also guess it shouldn't make any difference as long as they are not contradictory, right? I'll try to optimize that bit.

    Again, thank you so much for your help!
     
    #3
  4. Andar

    Andar Veteran Veteran

    Messages:
    28,644
    Likes Received:
    6,584
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMMV
    yes, more commands inside an event will take more processing there - but the more different events you have on parallel, the more complex the work on the main game loop becomes. And that is much worse, you should always aim for the lowest number of parallel processes where possible.

    copy&paste might work, but it would result in a rather convoluted event. Especially the conditions of the second and third event can cause problems if their order goes wrong, so it's better to combine the logic instead of only appending it.
     
    #4
    Llov11 likes this.
  5. Llov11

    Llov11 Villager Member

    Messages:
    12
    Likes Received:
    1
    Location:
    Buenos Aires, Argentina
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    Allright, I did what you sugested and worked like a charm.

    The final event looks like this:
    TimeProgression.png

    I didn't improve the time progress loss when changing maps yet, but it's working perfectly asi it is so thank you very very much for your help!

    If you see something that could be improved (besides the before mentioned) I would be very glad to hear it!
     
    #5
  6. Llov11

    Llov11 Villager Member

    Messages:
    12
    Likes Received:
    1
    Location:
    Buenos Aires, Argentina
    First Language:
    Spanish
    Primarily Uses:
    RMVXA
    And this is how I improved Time progression loss.. Maybe there is a better way to do so

    Replaced the first two lines with this:

    TimeProgressionSave.png
     
    #6

Share This Page