Making Self-Switches on the same map more dynamic?

dfGen21

Regular
Regular
Joined
Nov 16, 2020
Messages
32
Reaction score
2
First Language
English
Primarily Uses
RMMZ
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.
 

Schlangan

A madman with a computer
Regular
Joined
May 20, 2015
Messages
1,458
Reaction score
1,759
First Language
French
Primarily Uses
RMMV
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.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
10,990
Reaction score
8,875
First Language
English
Primarily Uses
RMMV
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.
 

dfGen21

Regular
Regular
Joined
Nov 16, 2020
Messages
32
Reaction score
2
First Language
English
Primarily Uses
RMMZ
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.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
10,990
Reaction score
8,875
First Language
English
Primarily Uses
RMMV
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 :stickytongue:
 

Trihan

Speedy Scripter
Regular
Joined
Apr 12, 2012
Messages
6,526
Reaction score
7,033
First Language
English
Primarily Uses
RMMZ
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.
 

ShadowDragon

Realist
Regular
Joined
Oct 8, 2018
Messages
7,740
Reaction score
3,161
First Language
Dutch
Primarily Uses
RMMV
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.
 

dfGen21

Regular
Regular
Joined
Nov 16, 2020
Messages
32
Reaction score
2
First Language
English
Primarily Uses
RMMZ
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.
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
10,990
Reaction score
8,875
First Language
English
Primarily Uses
RMMV
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.
 

Trihan

Speedy Scripter
Regular
Joined
Apr 12, 2012
Messages
6,526
Reaction score
7,033
First Language
English
Primarily Uses
RMMZ
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)
 

ATT_Turan

Forewarner of the Black Wind
Regular
Joined
Jul 2, 2014
Messages
10,990
Reaction score
8,875
First Language
English
Primarily Uses
RMMV
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.
 

dfGen21

Regular
Regular
Joined
Nov 16, 2020
Messages
32
Reaction score
2
First Language
English
Primarily Uses
RMMZ
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.
 

Latest Threads

Latest Posts

Latest Profile Posts

New trailer for the Doctor Who 60th anniversary specials has dropped. Doing good on making things look bombastic.
I guess I'm happy enough with it to post it. Welcome to Miriam's nightmares.:LZSjoy:
Spent some time giving my slimes some much needed personality xDSlimes.png
Second row is the originals*
Added a new face picture for Eliza to the game!

face-pics.png


before-vs-after.png

Old vs new face picture
Trying yet another hairstyle for Eliza and also been playing around with lights and shade

Forum statistics

Threads
134,749
Messages
1,250,277
Members
177,509
Latest member
Nozoomi
Top