Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Carrying Events Over Maps

Status
Not open for further replies.

Arythorn

Towns Guard
Xy$
0.00
So, in the game I am creating, I have a Time system. I was wondering is there was ANY way to get this time system to carry over across my entire game... Yes, I will break my rule and use pluginsif necessary... (Cause for those of you who don't know, I did originally say I would no use any!). As we all probably know, Timers carry over maps... so why can't Events?

Thanks in Advance,

BeeTree

Stay Strong! :D

P.S - The event is a Common Event :)
 
Last edited:

Dad3353

Praised Adventurer
Common Events are exactly that: Common. They can be accessed from any Map, and will continue running even if the current Map is changed.
Timers don't exactly 'carry over'; there is only one Timer function for the whole Game, again, accessible from any Map (or Common Event...).
What precisely are you thinking of..? The description above is a little vague...
 

Arythorn

Towns Guard
Xy$
0.00
Since my Screenshots and other Media won't upload... (Not sure why...) I have copied my Full Code...

◆Loop
◆Control Switches:#0007 Night = OFF
◆Control Switches:#0008 Day = ON
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Control Switches:#0008 Day = OFF
◆Control Switches:#0007 Night = ON
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames
◆Wait:600 frames

:Repeat Above

The Event Turns Switch DAY, On, And Switch NIGHT, off, waits 5 Minutes then reverses it, Turning DAY off and NIGHT on, then waiting another 5 minutes, then looping. So I need this event to carry on in the background on all maps, so If I enter a new area, the Event does not reset, thus messing up the Time system. It is set as a Parallel event with the Trigger of a TIME switch set to ON at the very beginning of the game. All this time system is mainly for visual purposes (Tinting screen, adding overlays to mak rays of light and shadows, etc) but may also do things such as affect quest's appearing or enemy spawn rates. So it will probably be a rather important feature, one that I would like to get working before I progress too far.

Thanks in Advance :)
 

Dad3353

Praised Adventurer
There are many ways of achieving this, more or less elegant, more or less sophisticated, depending on exactly what the needs are. You're at the beginning of a journey here. Here's a starting tip...
A 'Wait (60)' time (1 second...) can be put inside a loop; looping 10 times will result in a 'Wait' of 10 seconds. Having this loop in an outer loop 10 times gives a 'Wait' of 100 seconds. Another outer loop of, say, 6 gives a 'Wait' of 600 seconds, or 10 minutes.

◆Control Variables:#0001 Loop_1 = 0
◆Control Variables:#0002 Loop_2 = 0
◆Control Variables:#0003 Loop_3 = 0
◆Loop
◆Wait:60 frames
◆Loop
◆Wait:60 frames
◆Loop
◆Wait:60 frames
◆Control Variables:#0003 Loop_3 += 1
◆If:Loop_3 ≥ 10
◆Break Loop

:End

:Repeat Above
◆Control Variables:#0002 Loop_2 += 1
◆If:Loop_2 ≥ 10
◆Break Loop

:End

:Repeat Above
◆Control Variables:#0001 Loop_1 += 1
◆If:Loop_1 ≥ 6
◆Break Loop

:End

:Repeat Above


Any combination of loops of the sort can be envisaged to create 'Waits' of pretty well any length required. In the example above, simply changing the initial 'Wait (60)' to 'Wait (90)', for instance, would give a 'Wait' of 15 minutes.
In passing, I'd ask why two Switches are used for a fundamentally binary state: it's either Day or Night, so Day On implies Night Off. There could be other reasons, but written 'as is', I'd suggest that one of the Switches is redundant.
Just sayin', hope this helps. Need any more..?
 
Last edited:

LTN Games

Master Mind
Resource Team
Xy$
0.01
Just to add a bit to what @Dad3353 is saying. To get the common event working on all maps set the common event to a parallel event with a switch, and add an event to each map and call that common event. Make sure the switch is turned on when starting a new game.
As your time system stands now you could probably improve it, using variables and conditional statements, that is, if you want it to be a more advanced system. Basically, you would setup a few variables, one for an hour, one for a minute and one for a second, one for milliseconds and one more for speed. Then you would add +1 to milliseconds and then setup a conditional statement inside your parallel common event stating that if the milliseconds is less the speed variable(which you can set to anything, the lower the faster the time) then add +1 to the seconds variable. Then you would do another conditional stating if seconds variable is greater than 60, set the minute variable to +1 and reset seconds back to zero. You would continue this process for the minutes and hours variables.
I hope this helps a bit without being confusing, either way you can easily have a common event run on each map by setting it to a parallel with a switch and calling that common event on each map. Cheers.
 

Arythorn

Towns Guard
Xy$
0.00
Ok. I see what you are getting st about the switches... But I'm still confused here... So if I activate this common event once in a map, if I move to another map, the Common Event still runs in the background? Even if there is no even on the new map for the common event?
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
So if I activate this common event once in a map, if I move to another map, the Common Event still runs in the background? Even if there is no even on the new map for the common event?
You will need an event for each map which calls that common event in order for it work properly.
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
But would that not also reset the event to the start though? Because that is what I am trying to avoid...
Yea, it will reset the common event, which is where variables and conditional statements come in handy, I quickly explained how to achieve a time system using a common event in my previous post. If you would like I could write a common event up for you and show you but you will need to give me a bit of time as I'm a bit busy right now.
 

Arythorn

Towns Guard
Xy$
0.00
Yea, it will reset the common event, which is where variables and conditional statements come in handy, I quickly explained how to achieve a time system using a common event in my previous post. If you would like I could write a common event up for you and show you but you will need to give me a bit of time as I'm a bit busy right now.
Only if you wish, but I do not mean to hinder your work. So feel free to put it on hold. Don't let it get in the way if you are busy. I can wait. Thank you for offering to do this by the way.
 

Dad3353

Praised Adventurer
A Common Event will continue to run, even if you change Map. My Farm system has Carrots growing whilst I'm away; it can be made to work.
The best recommendation I can make is to create a mini-Project, as a test-bed for this. Write out on paper, first, a few Switches and Variables that you'll be using, and write out (still on paper...) a 'pseudo code' that makes sense to you. Then (and only then...) create the Switches and Variables in the database, get it up and running, even modestly, on your Map, then create a second Map and go to it, see what happens. There's nothing to beat experience in issues of this sort. We can help you with detail points and suggestions, but in the end, you have to master it (progressively...) yourself if you're to manipulate it, even more so if the whole Game turns on such an axis.
Do the first steps, and see where (if..?) you get stuck; we'll guide you on from there.
As I said above there are many ways to do this (including taking on a 'ready-made' plug-in..!), but beating your own sword is always satisfying.
Do you need to display the time, for instance, or simply have Tints reacting to the passage of time..?
Get a simple counter running first, before diving in to all the potential complications.
 
Last edited:

Arythorn

Towns Guard
Xy$
0.00
A Common Event will continue to run, even if you change Map. My Farm system has Carrots growing whilst I'm away; it can be made to work.
The best recommendation I can make is to create a mini-Project, as a test-bed for this. Write out on paper, first, a few Switches and Variables that you'll be using, and write out (still on paper...) a 'pseudo code' that makes sense to you. Then (and only then...) create the Switches and Variables in the database, get it up and running, even modestly, on your Map, then create a second Map and go to it, see what happens. There's nothing to beat experience in issues of this sort. We can help you with detail points and suggestions, but in the end, you have to master it (progressively...) yourself if you're to manipulate it, even more so if the whole Game turns on such an axis.
Do the first steps, and see where (if..?) you get stuck; we'll guide you on from there.
As I said above there are many ways to do this (including taking on a 'ready-made' plug-in..!), but beating your own sword is always satisfying.
Thanks! Will get this done later on... And keep you both updated if I need anything. Will see what I can do!
[doublepost=1471996195,1471995037][/doublepost]Currently I just have the screen tints to show the passing of time but perhaps having a clock could be used for making things such as "Oh! I have to go and have tea with Bob at 2:30!" So I could get some story development/character development... So both but as you said, I will start small them work my way up!
 
Status
Not open for further replies.
Top