MZ Crude region-based "stealth" system is turning out to be more difficult than I thought and I need help.

I've been trying to make this "simple" (at least on paper) system work all day but I just don't understand it anymore. Please help me; I'm so tired with this that I can't even tell what I'm doing wrong anymore.

TLDR: A certain switch keeps getting switched on and I have no idea how or why.
My plugins are:
1764420525766.png


What I'm trying to do: I use regions to mark line of sight of guards. The guards turn in two directions every now and then. So two 'zones' for each guard. In the pic below, I got rid of zone 11 since it wasn't necessary for the testing. (Region 9 is supposed to be shadow where the player can't be detected. It's there for the shadows darken plugin mostly).

1764420085330.png



I made variables with names like zone 10, zone 11; zone 12,zone 13 (two to each guard, 4 in a room max), and in a guard's movement, when he turns towards a particular direction, I turn one of the variables on and the other off.
1764420175727.png

1764420188578.png
1764420200723.png

Thus rendering a zone virtually on or off.

There is another parallel common event fetching the player's region id every 60 frames (accurate enough for testing). The text is there for playtesting.
1764420252947.png


and my main parallel common event for this system takes the region id from the other event, and if the region id is, let's say, 10, then it checks if the zone17 is 0 or 1 and if it is 1, then it alerts the corresponding guard and switches off the switch required for the event.

I redid this part over and over and eventually resigned myself to doing it in a brute-force way out of frustration.

1764420411525.png

This goes on like this for a while. To cut it short:
1764420454625.png
1764420469750.png

The alert is a switch that which causes the stationary guards to switch to another event page where all they do is chase down the player and engage in combat. After the combat, the stealth system gets turned back on again and the alert is turned off. I've only done this for one of the guards (that's why there is only alert a).

So for the test, I'd walk into zone 10, and then 'alarm' the guard, get him to chase me and force a combat situation. Except... that's not happening.

The issue: alert A keeps getting triggered (right at the beginning) no matter what. In a previous iteration, it atleast took until the guard faced towards zone 1 for it to switch on against my will.

I have no idea what's causing this and I'm so tired I can't even conceive of what the issue might be. If you see something I don't, please tell me and if I'm a moron and I'm overthinking everything and if there is a plugin out there that can do this easily, please tell me that too.
Why don't make you the zone with the same region?
that simplify your conditional check, you mostly check player vs event
in that area?

checking one comment event for all is a bit overkill (you have your reasons here).

but if you are on region 9, it also jumps to alert.

I think its cleaner if you check guard basic for alert and selfSwitch instead.
so you can control them easier.

if you want a combat to happen, where is it set to battle the player on touch?
Have you configured all your plugins correctly?
A certain switch keeps getting switched on and I have no idea how or why.
One of the classic causes for this is that some scripts and plugins use switches and variables to interact with the engine. That is why you always have to check every plugin configuration when installing a plugin. Simply because the switch set by default might already be used for something else.
which is why when configuring, you always check if a switch is already in use and name it correctly for later reference.

the editor allows you to search for switches used in evenst and you can always use that to check if a switch is controlled by a forgotten event, but if a plugin controls the switch you can only manually look through each configuration.
Why don't make you the zone with the same region?
that simplify your conditional check, you mostly check player vs event
in that area?

checking one comment event for all is a bit overkill (you have your reasons here).

but if you are on region 9, it also jumps to alert.

I think its cleaner if you check guard basic for alert and selfSwitch instead.
so you can control them easier.

if you want a combat to happen, where is it set to battle the player on touch?

Tbh I might just configure each enemy individually at this point like you said. I did it in one common event for saving time in the future but I can't figure it out.

Combat happens when the 'alert' switch is turned on and the common event stops. The guard then approaches the player and upon enemy touch, it triggers the battle. I haven't got that far yet since I wanted to finish this as a base before building anything upon it.
a trick is to use a gameMessage on event/player touch "got you" to see
if its fired, from there, you know the event works, so you can initiate a battle.

so showing the switch alert is 1 way, but using 1 region for chasing and trigger
is easier for a common event if you use different regions, zone checks.
Have you configured all your plugins correctly?

One of the classic causes for this is that some scripts and plugins use switches and variables to interact with the engine. That is why you always have to check every plugin configuration when installing a plugin. Simply because the switch set by default might already be used for something else.
which is why when configuring, you always check if a switch is already in use and name it correctly for later reference.

the editor allows you to search for switches used in evenst and you can always use that to check if a switch is controlled by a forgotten event, but if a plugin controls the switch you can only manually look through each configuration.

Okey I resolved the issue.

I actually didnt configure the plugins for this particular project so that probably IS it.

I did search for the switch in the event searcher like you said but the only places this switch is mentioned is in this common event. I tried turning off every plugin (except for textpictures), and I got it running manually and it still wasn't working.

I tested it a bunch and it's switches 21 and 22 that are the problem. switches 23 and 24 work fine. I think I'll just use other switches instead. I never had this problem with the plugins before but I can't think of any other reason.
a trick is to use a gameMessage on event/player touch "got you" to see
if its fired, from there, you know the event works, so you can initiate a battle.

so showing the switch alert is 1 way, but using 1 region for chasing and trigger
is easier for a common event if you use different regions, zone checks.
Ok thanks, I'll keep that in mind.
I tested it a bunch and it's switches 21 and 22 that are the problem. switches 23 and 24 work fine. I think I'll just use other switches instead.
while that seem to look reasonable at first, it still has a lot of problems:

1) the switches are there for functions in the plugins - if you don't assign and use them, those functions of the plugins will remain unused.

2) what are you doing if two different plugins are configured to use the same default switches? Declare them incompatible instead of changing the switches in one plugin to different IDs?

both cases have happened before, for example a lot of plugins default to switch #1 or variable #1

If you want to use plugins, you have to learn how to configure them - that is easy as it doesn't require programming knowledge, just common sense and reading ability (at least for most plugins)
while that seem to look reasonable at first, it still has a lot of problems:

1) the switches are there for functions in the plugins - if you don't assign and use them, those functions of the plugins will remain unused.

2) what are you doing if two different plugins are configured to use the same default switches? Declare them incompatible instead of changing the switches in one plugin to different IDs?

both cases have happened before, for example a lot of plugins default to switch #1 or variable #1

If you want to use plugins, you have to learn how to configure them - that is easy as it doesn't require programming knowledge, just common sense and reading ability (at least for most plugins)
Alrighty, I'll try reading through them then.

Original thread: https://forums.rpgmakerweb.com/threads/crude-region-based-stealth-system-is-turning-out-to-be-more-difficult-than-i-thought-and-i-need-help.181227/