Making Self-Switches on the same map more dynamic?

Hi.

Are there any scripts, plugins etc. to make Self-Switches on the same map more dynamic?

Problem: I wanna copy and paste an event to a new map. My current solution is using this._mapId, this._eventId in the script call instead of constants.

By grouping Events in a specific order, I can +/- this._eventId. This only makes sense if you have everything planned ahead and don't change anything afterwards. It's not even possible to change Event IDs. At least I don't know how beside of copy and rearange events on new map. Thought about doing it manually inside the Map.json but I don't know if this is safe and is more workaround.

Was also thinking about something like this: A script searches through all events on the map and if one event has one specific notetag, then this._eventId = the one with the correct notetag. Maybe using something like this._dynamicEventId.meta.fire for the Event ID.

Does anyone know a solution for this? Would be really helpful.
What's wrong with using this._mapId and this._eventId in the script call?
Why do you need a specific event id for that self switch? Could you describe exactly what you want to do? There might be a work around.
It would help if you described more specifically what you're trying to achieve.

You certainly can use JavaScript to look at notetags, but it's basically impossible to give you advice on what to do without any idea of what you'd like to accomplish.
Example:

Event 1 changes Self-Switch A of Event 2. Script Call would look like this:

JavaScript:
$gameSelfSwitches.setValue([this._mapId, this._eventId+1, 'A'], true);

But if the target Event isn't 2 anymore cause you made an event later then you would have to change the script call again.

Maybe I'm overlooking/overthinking it.
I think you're just overthinking it.

What you have will work perfectly if you take a bit of care to create the events sequentially in the editor.

If you don't, then you didn't need that functionality dynamically, right? You're adding it in after the fact.

You could do something like
Code:
$gameMap.events().find(event => event.event().meta.toggle).eventId()
to find the first event on the map with the notetag <toggle>

But that seems like super overkill for just creating them in order or, failing that, typing a freaking number 😛
What kind of system is this actually creating? It's hard for us to opine on how well the approach works when we don't know what the end result is meant to be.
unless you want to toggle all events with the notetag <fire>? like 3-6 on the same map?
because if you only have 1, why not just use a global switch instead of a selfswitch?

easy fix on that part, but like the other said, to low information about the exact
mechanic you want to build for a better solution, we cannot simply guess though.
Code:
$gameMap.events().find(event => event.event().meta.toggle).eventId()
How does this work? Replacing this._eventId with that and having an event with <toggle> notetag? I tried this but it didn't work.

What kind of system is this actually creating? It's hard for us to opine on how well the approach works when we don't know what the end result is meant to be.
I just want to make Events easier to be copied in general without having to change much if at all. Like Prefabs. For example if you add something to a puzzle like an extra switch that is controlled by a Manager that uses itself or other Event as starting ID. Of course, if it's just a single change then no problem to change manually but I think having a system that prevent this would be neat.
With dynamic I mean that it automatically finds the correct event no matter what its ID is.

It's not really for a specific system. Just try to avoid checking and changing lots of event pages manually.

I must be playing 5D chess with myself. Thought it was a common problem.
It's not really for a specific system. Just try to avoid checking and changing lots of event pages manually...Thought it was a common problem.
I dunno, I still can't really picture your use scenario. The description of an extra switch in a puzzle with a manager doesn't explain anything that seems very universal.

I can't really see wanting to populate my games with puzzles that are so functionally identical that I could freely substitute any number of events between them.
Yeah, in that case I'd use meta tags for that (and in fact have, for my kitten detector key item in one of my event games)
How does this work? Replacing this._eventId with that and having an event with <toggle> notetag? I tried this but it didn't work.
I dunno what to say, works as expected for me.
I dunno what to say, works as expected for me.
Hmmm. Now it also works for me. Could it be that MZ has conditional glitches sometimes if you don't refresh/restart? Not directly related to here but I noticed something similar recently. The game detected an event with no image as facing up. Maybe cause the event has pages with Direction Fix on facing up but the game starts with no image page. Think changing the image from something back to none fixed it.

Original thread: https://forums.rpgmakerweb.com/threads/making-self-switches-on-the-same-map-more-dynamic.161299/