Trouble making a "behind cover" section

Hello! New here and all that. I've been trying for hours to get a sort of "red light green light" thing going but am having so much trouble.
It's supposed to be a section where a turret is firing at you while turning up and down. I have an ID script that tells the game when you're behind cover (region ID 1) or out of cover (region ID 2)

I've got a lot of it going, but for some reason, I can't figure out how to make it so that when you're out of cover and it starts firing, running INTO cover STOPS the "firing" event and turns into the "taking fire while in cover" event. (and vice versa) If there's a video or something that deals with a similar event, I'd love to see it!
We can't really answer you without seeing how you have set up the event.
Please share a screen shot of all relevant events that make up this system.

Off the top of my head, it seems you are already getting player location to check the region ID.
I'd just put in the same event where that is being checked "if player is in [cover region] turn off switch. Else turn on switch."
Then have that switch control your turret.
We can't really answer you without seeing how you have set up the event.
Please share a screen shot of all relevant events that make up this system.

Off the top of my head, it seems you are already getting player location to check the region ID.
I'd just put in the same event where that is being checked "if player is in [cover region] turn off switch. Else turn on switch."
Then have that switch control your turret.


Are massive images like this allowed? Anyway yeah, the top right is supposed to be the idle animation until a random variable causes the turret to turn and shoot for a couple seconds and then go back to idle animation. I got all that set, I just can't make it so that when you run back into cover or out in the open, it stops the shotting animation or turns it back on. You're supposed to have a few seconds when in the open to make it back to cover.

Looking at it like this tho, it's so convoluted that it might be asking too much lol
turret event.png
Are massive images like this allowed?
It would probably be easier to post individual screenshots of singular, commented event pages.

One of the likely problems is that you have so many events. I have a hard time seeing because the pages are all so small, they don't have names, and they have so many pages. But if your original description is correct, that you have a singular turret, I really don't know why you'd have all these events with all these pages.

The other possible cause of failure is that I see multiple parallel events with no Wait, which you almost never want. Parallel and autorun events, by default, try to execute every frame - so 60 times a second. If what you're doing can't change conditions that quickly, you should have Wait commands at the bottom to slow it down. That's the primary cause of lag in RPG Maker games.

I would have one event that is the turret. It checks whether the player is in a region ID indicated to be cover; if yes, set a In Cover variable to, say, 4.

If no
- check whether In Cover is greater than 0. If yes, subtract one from it then stop.
- if that's no, then do the images and sound effect for the turret fire.

Then Wait 30.

The wait 30 means the event gets executed twice a second; worst case scenario, the turret is firing twice a second, which appears to be what you have now; and if you were in cover, you have two seconds (4 subtracted from twice a second) to get to the next cover.

All one event.

Original thread: https://forums.rpgmakerweb.com/threads/trouble-making-a-behind-cover-section.169664/