MV YEP SelfSwitchVar / Enemy Respawn Event

So, I made a previous post HERE regarding an issue I was trying to work out with enemy re-spawning after a death event.

The advice I was given worked perfectly. I'm using Yanfly's SelfSwitch plugin so I can utilize more self switches per event. To keep it easy, I assign one SelfSwitch to each enemy. Page 1 = Nothing / Page 2 = Combat Event and upon death, it takes you back to the player's hub where the respawn happens. Here's a picture of my respawn event back at the hub:

Spoiler: Event w/ Multiple Plugins (doesn't work)
1631476241991.png

Now, after several tests and playthroughs, I've determined my enemies aren't respawning when I use multiple Plugin Commands for the various maps and autorun events. When I test this event and have only one of the plugin commands and delete the other 4, the respawn does happen. So the below screenshot, with just one of the plugin commands (everything else is the same), DOES cause the enemy of that map to respawn at that point:

Spoiler: Event w/ 1 Plugin (works)
1631476757714.png

Is there something that's causing them to conflict when I try running them together? Because the problem I'm facing... is that I need all enemies, on all maps, to respawn. Just to give a bit more detail on my other events (if this helps further):

All enemy events, upon death, take you to the same hub and this auto run event runs right away. The Plugin Command is activating a switch on each map that has an enemy that needs to respawn. So, map 11, and then an auto run event (16), and Switch 178 is turned on. Now to the autorun event on a map with an enemy (pictured below):

Spoiler: Map's Respawn Event
1631476491216.png

This auto event then has a plugin command that directs the enemies 177 Switch to turn off so it takes that event back to the page where the enemy moves around the map and can attack the player again.

Hope this was enough info. If you need anymore details... let me know.

Thanks in advance! 🙂
So, to be clear, when you have the multiple in a row, 0 of them happen?
Correct. When I have multiple setup... not even the top one triggers. It only triggers when I have it by itself.

And thanks... you happen to be the person that helped me previously LOL You're the best 🙂
If you hit F8 and go to the console tab, are there any error messages?
3 errors... but appears to be an issue with the lighting system I'm using. If there's a different screenshot/tab that could help... let me know. I can retest and get that sent, too.

1631488364737.png
If you hit F8 and go to the console tab...
not the Elements tab 😉
Well, don't I feel stupid? You even said F8 CONSOLE tab LOL Sorry. All I'm seeing is something with my lighting system, but that's due to it not transferring over to battle right now. Unless you see something I don't, which is likely, since most of this looks like a foreign language to me 🙂

1631500841799.png
Sorry...I have no clue. If you're sure the event as a whole is running, and that plugin command itself works on its own, I can't think of any reason why doing multiple of them would make them all fail.

You can do stuff like put some Show Text commands before the first plugin command and between each one to see if the event is failing for some reason, but I don't see a reason for it to.
OK, this is SO weird. I'm not sure why it's only reading one plugin command. However; I did some additional moving around... and one plugin WILL work, even if they're grouped together. It appears that the LAST plugin command to run activates. It's like each one does activate, but the new one cancels out the previous... leaving the last one to run as the only one that works. I tried the below workarounds:

1) Put a text box between each plugin command. The text box appears, but only the final plugin works. The first four get ignored/cancelled.

2) Tried putting each plugin in a separate event that I triggered myself. No matter which order I click the events... only the last event I click activates that plugin command.


Question, and I know this is for another channel, and I'm OK posting it in the appropriate channel. Do you think a respawn plugin is something that could be made? I could always post that in the Plugin Request page. I'll leave this open just to see if my above scenario brings any light to this situation. If not... and I can't figure this out... I'll close this post and try requesting a plugin. I'm even OK paying for it. I'll look into that after I close the post.

Thanks again for your help, Turan. You're always super helpful! 🙂
You don't need another plugin for this, just yank out the plugin commands and use the direct script calls. It sounds like these specific commands are going into some kind of buffer and overwriting each other.

The JavaScript provided in the documentation is:
"this.setSelfSwitchValue(mapId, eventId, switchId, false)
- Replace mapId with the map ID the event exists on. Replace eventId with
the ID of the event. And replace the switchId with the ID of the switch.
This will set that self switch to true or false."

So it's the same format as your plugin command, just in a function. So do an event command, and on the last tab hit Script. In that text box, paste the function call for each map, then delete the plugin commands.
OMG! Yes, that worked. I'm slowly learning, and in the past, I tended to ignore "Lunatic Mode" because I figured I wouldn't understand it anyway LOL Thank you so much for pointing that out. I'll have to look in that section more often. Though, doubt I would have found it had you not helped. Thanks again!!!

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/yep-selfswitchvar-enemy-respawn-event.140394/