Solved : very little plugin about switches

Hello everyone !

Some time ago I posted a new thread in the questions' forum about my time system.
I've achieved to make the events disappear when the game is at a certain time (20 o' clock for example),
creating a common event in a parallel process checking if the gametime is at certain hours.

I've just a little problem with that.

In fact, when the hour when the events disappear comes, the events disappear (that's good but...) right on the map !
Right in front of the player !
That makes it a bit brutal, and it's not good for coherence.

So I've thought that maybe someone out there could help me with that.

My common event calls a certain switch on or off as the time is beetween 20 hour and 8 hour or not.

I would like a plugin that makes the game, when a certain switch is on (or just the 104th one if that's easier, it's the one I use), to
make the screen "in dark" before the switch is done on and after, the screen reappear, but that just one time.
Because if I do it with events, the game will repeat the process of "in dark" and reappearing.

Is that possible ?
Probably you can reach your objective without the creation of plugin, using a little "trick". You can insert in your event, before the activation of the switch a "fake transfer" for the player. This means that:

EVENT PAGE:
STORE IN VAR MAP ID
STORE IN VAR PLAYER X
STORE IN VAR PLAYER Y
Perform transfer to: STORED MAP ID, STORED X, STORED Y. Preserve your direction and the transition effect should be set to "Black"
SWITCH ON/OFF

This way, you can obtain the same effect without the disappearing in front of the player.
Thank you Gamefall Team, but that's not the problem : if I do that, the game will repeat the process again and again because the common event is set on parallel process.

The problem is not to make the screen dark until the events disappear, but to make it just once :/
Why not just run a parallel process the first time you enter the map to check the time, and if it is past a certain time, then it turns the switch ON, then erases itself (via erase event). This way it only runs when you enter the map, and will not run again until you reenter the map.
If go out of the map and return, the effect of dark screen (in order to not seen the npcs disappearing) shows again, for no apparent reason : I mean, I know why because I know there is erase event and parallel process and all, but the player will not know that... and it looks strange.
Oh, I see, I didn't noticed the real problem. 😅
Another way would be probably to check the switch ON/OFF not in a range of hours, but at specific time. But this depends essentially on the accuracy of the day-cycle system you using. Are you using an evented day-cycle system?
Actually, it shouldn't. Parallel processes run before the map becomes visible, so if you did what I suggested and only had it run initially then do an erase event, the NPC's will not show on the map when you return, but they will be there until you leave.
I am using the plugin from daimonious tails, because when I used an evented system I didn't find how to make the lighting null in a house.
It's called "gametime".
I can paste here the plugin and script commands, if you want. 🙂
Actually, it shouldn't. Parallel processes run before the map becomes visible, so if you did what I suggested and only had it run initially then do an erase event, the NPC's will not show on the map when you return, but they will be there until you leave.

In fact, I am talking of the screen fading in dark and fading in "light" (?).. It makes it again everytime i return on the map :/
That's a fault with something else then, as I do fade in dark via the method I told you (parallel process/erase event) and it doesn't have issues that the player can see.

Also, careful there, you did accidentally double post. That's a quirk with the quoting phrases as it defaults to putting it in the new post box instead of the edited post (I know as I did it once a long time ago by accident before I was a moderator). to avoid that we do recommend using @ to denote who you are talking to instead of quoting the post.
Okay thank you for the advice @bgillisp , I will try to remember that 🙂

When i create the parallel process, I make it check the time, then fade the screen dark, switch on (or off) and fade light.
Isn't that this way it has to be ?
I give a rapid check at the plugin you mentioned, and you can create probably accurate checking this way:
For example, if you want to make the Switch ON/OFF specifically at 21:00:00, you can try something like this:

EVENT PAGE:
CONDITIONAL BRANCH Script: $gameTime.getTime("hour") == 21
CONDITIONAL BRANCH Script: $gameTime.getTime("minute") == 0
CONDITIONAL BRANCH Script: $gameTime.getTime("second") == 0
Set Location etc..
Switch On/Off

This way, the switch and the location change will be performed only one time, because the checking condition is very accurate.
I have tried what you proposed @Gamefall Team and I have been confronted to an issue : the player teleports several times (like 4, 5 or 6) and then everything is okay.
I think you have the solution but this problem is maybe with the plugin itself :/


I have just found the solution --> the plugin is a bit bugged and considers that it's 21h a couple of seconds, so it's enough time to make the parallel process remake it's functions.
But I have added some waiting (300 frames) after the switch on and that solves the problem !



THANK YOU @Gamefall Team and @bgillisp for your help and for taking so much time for me ! Thank you a lot !
@Nantas I'm glad that you have found the solution. I have thought your same thing about frames, but I had not the chance to test it immediately, but It's good to see that this way work. Good luck with your development 😂

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/solved-very-little-plugin-about-switches.78951/