Jump to content
Sign in to follow this  
tauceti

Jump to Label inside loop not working

Recommended Posts

I created an event that causes a day/night cycle, visible by the screen tinting and also helpful to certain parts of the game (e.g. needing to be at a certain place only at night, etc.)

 

The day/night cycle itself works perfectly. I'm also trying to make it so that if the player leaves the map, time "freezes" and when they return, the time of day will still be the same as when they left.

 

I don't know how to explain it without being confusing. But basically, my event is supposed to:

 

- run a conditional to check for "enter-x" switches (x being the time of day upon leaving the original map, so there's enter-day, enter-evening, and enter-night)

- jump to the labelled time of day inside the loop so it can start from that time

- turn off the "enter-x" switch so that it can be turned back on again later and so that only one is on at a time

- continue the day/night cycle.

 

However, it isn't working. It seems to skip the conditionals completely and doesn't jump to the time of day when I have the enter-x switch turned on.

 

It starts at the beginning of the day rather than when the switch turned on tells it to. The cycle itself isn't broken, as it goes through day/night as programmed, I just wish it would jump to the labels when I have the switch turned on...

 

This is my event:

 

dH9oRIT.png

 

The stuff below isn't important, I think, it's just a few "Wait 900 frames", turning on & off the "night" switch(used for other purposes), and then the loop's "Repeat Above", but let me know if you need to see it. This is the only event page, there's no conditionals checked on the sidebar, and the trigger is a Parallel Process. Nothing out of the ordinary.

 

Am I doing something wrong here?

Edited by tauceti

Share this post


Link to post
Share on other sites

I think you want to nest the conditionals.

 

In other words, test the condition of switch 44, if on jump to DAY

 

ELSE

 

test the condition of switch 45

 

...and so on.

 

ELSE instead of Branch End.

 

I could be wrong though. :)

 

To clarify, you'll still need Branch End. One each at the end (3 in total) to 'close out' each conditional branch, if you will.

Edited by Scrogdog

Share this post


Link to post
Share on other sites

Why not have the time/tint stuff within the conditional branch itself?

 

so

COND: Day

if

   -loop

    - [stuff goes here]

 

else

  COND: Evening

   if

    -loop

     -stuff goes here

 

else

        COND: Night

      if

       -loop

        -stuff goes here

else

 

end

end

end

 

That should remove the conditional branching and loop problems, as well as make your event tidier.

I think your events getting it's branches muddled due to you have labels in a straight even instead of their own "section (conditional branches).

  • Like 1

Share this post


Link to post
Share on other sites

I think you want to nest the conditionals.

 

I tried this and still got the same issue :(

 

Why not have the time/tint stuff within the conditional branch itself?

 

This sounds kind of confusing, and I don't know how it would work. How would it switch between the times of day, wouldn't that just make it loop "Day" over and over again? Plus it worked perfectly fine the way I have it, I just don't understand why the "jump to label" function isn't working.

Share this post


Link to post
Share on other sites

Hmmm. Well perhaps your Branch Ends were not properly nested, that is, not in proper position to close out each conditional branch. Did you event this or write it out?

 

I'll see if I can write up a simple test tonight that will test three switches, and then if one of them is on will jump to a label outside of the nested branches and then display a show text that says that particular switch is on. See if I can figure this thing out.

 

Now that I look at it again though, I think Takeo was right, you are not properly compartmentalized. I hate not having my tools available at work, but look at the loop once again. After DAY executes, what prevents EVENING from executing unless you use another label to jump outside of the loop? In other words, a label doesn't stop anything, it's just a marker.

 

Maybe I'm not thinking about this correctly. :)

Edited by Scrogdog

Share this post


Link to post
Share on other sites

Ah, I think I might have been confusing when explaining my event. :s It's not meant to stop after Day or before Evening, it's meant to let them flow through each other. It begins at day, waits a minute and a half, then fades into evening for 30 seconds, which then fades into night, and waits for 1 minute before fading into day again. Kinda like a usual day. I'm concerned that putting everything into their own little conditional branches would MAKE them pause in between the transitions, which is what I want to avoid. The label is specifically for when exiting the map and coming back, so that it will be the same time of day upon returning. The conditionals check if the switch is on, and then jump to the according time of day so that it continues the cycle again.

 

Think Ocarina of Time; you know how when you're out in the field, time passes really fast, you can see it go through day and night? But then when you go into town or through a dungeon, time "pauses" and doesn't change until you return to the field, where time keeps passing again. The labels in this event are meant for the part where it "unpauses" time and lets time continue cycling when returning to the 'field'. My problem is that when I return to the 'field', it starts over from the beginning of the day instead of wherever I left off.

 

or maybe I completely misunderstood what you were saying and this is redundant, lmao. Sorry. I'm still a little confused by the grouping it into conditionals thing too...

Share this post


Link to post
Share on other sites

No, I see what you are saying.

 

Well, alrighty then. We go one step of the time. :) I have confirmed that, structurally, the idea that I had earlier seems to work. Might be more misunderstanding here, so let's just take a look at a test event I made.

 

 

Test%20Event.png

 

 

There are only two lines of code below that. 

 

Label: END

Erase Event

 

This was done in a new project where the only thing that exists is this event, so you can re-create if you like. Then just run a play test.

 

When ENTER-DAY is on, it jumps to the proper label and does a show text "It is DAY".

 

Then I just go back in to the event and changed which switch is on. All three worked perfectly.

 

So, maybe we conclude that whatever is happening to make you think that the labels don't work is, in fact, something else. Or, perhaps as I suggested earlier your conditionals were not properly nested. See how each Branch End above closes out the conditional on its same level.

 

Or maybe the next step is to put the labels in the test event inside a loop of some kind like you have it to see how it affects things. I wouldn't think that would affect labels, but...

Edited by Scrogdog

Share this post


Link to post
Share on other sites

If you set up your event like so, you don't need any loops or conditional branches.

It keeps it tidier and is much easier to transition between tints/times.

 

 

 

day_by_takeo212-da4syxj.png

evening_by_takeo212-da4syxf.png

 

night_by_takeo212-da4syxc.png

 

 

 

 

Having each even on it's own page makes it easier to manage and each page is activated by it's own switch/

 

Using conditional branches and loops is a little tricky sometimes. Conditional branches have to set up in an exact manner to make sure all branches are being read.

What ScrogDog said is true, so you have to have each branch come of each each other.

 

Is it Day?

Yes

No

-Yes (continue day branch)

-No (move onto next branch

 

   Is it Evening?

   Yes

   No

   -Yes (continue evening branch)

   -No (move to next branch

 

      Is it Night?

      Yes

      No

      -Yes 9cotinue Night branch)

      -No (welp, no more branches. Event jumps to the end of the conditional branch and doesn't do anything)

 

You have it set up to read everything so some details are being skipped/replaced.

 

Loops are kinda annoying.

They sometimes don't work well in bigger events and leaving/returning to maps can sometimes glitch out a loop - especially if you don't have a "break loop" within the event.

 

Having seperate pages will make your transitions smoother (I tested it on an empty map and waited for all the wait commands/tint timers. I had no issue with the event I set up).

That should prevent any mistakes within an event and remove conditions and loops all together.

And since the events are a parallel process, they'll loop automatically anyway (but the switches change pages so they event wouldn't loop itself, just the entire day cycle itself)

  • Like 1

Share this post


Link to post
Share on other sites

I've done something like this myself.  You guys are making this WAY more complicated than it needs to be.  I just used a pair of variables for the Hour and Minute, and had a Parallel Process event that would change the screen tint whenever the hour reached certain values.

 

My recommendation:  Make a Parallel Process Event wherever you want time to advance, and create a loop.  At the start of the loop, make your Conditionals for checking what time of day it is and setting the tint.  This way, if you emerge from a lit map (like inside a building or something) into the night time, the first thing that happens is the tinting is changed.  Instead of having switches saying what time it is, make a variable that stores the current time, in hours.

 

Every 600 frames, advance the hour by one (I say 600 since it appears from the snippet of eventing you've shown us that one hour equals about ten seconds).  Have your conditionals check to see if the Hour equals certain values and set the screen tint accordingly.  If anything I've explained is unclear or doesn't work, let me know and I'll look into it.

 

EDIT:  Oh yeah, don't forget to reset Hour to 0 every time it hits 24!

Edited by TaranAlvein

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
Top ArrowTop Arrow Highlighted