My Events are replacing themselves?!? ... Help??

In my 'Common Events' tab, I've got an 'Event' deleting itself, and replacing with a random one.
...ok, so, here's a bit of the code, its located in the first "Common Event" tab:
@>Control Variables: [0041:En1 X actual] = [EVT En1]'s Map X
@>Control Variables: [0042:En1 Y actual] = [EVT En1]'s Map Y

@>Control Variables: [0051:En2 X actual] = [EVT En2]'s Map X
@>Control Variables: [0052:En2 Y actual] = [EVT En2]'s Map Y

alright, everything works good so far... basically this is simply assigning an Event's coordinates.
(Make Variable: "En1" coordinates the same as Event "En1", and then do the same for "En2" )

I then made a 2nd map, and put both "En" Events in the 2nd map as well as in the first...
The "En1" seems to behave normally, but the "En2" Event is acting strange...

When I open the "Common Events" tab, while in the 2nd map, RPG Maker appears to have swapped out the two "EVT En2" events, with a random other Event from the map like so:
@>Control Variables: [0041:En1 X actual] = [EVT En1]'s Map X
@>Control Variables: [0042:En1 Y actual] = [EVT En1]'s Map Y

@>Control Variables: [0051:En2 X actual] = [EVT TRACKER ALPHA 2]'s Map X
@>Control Variables: [0052:En2 Y actual] = [EVT TRACKER ALPHA 2]'s Map Y

Notice it didn't affect the first two lines, and that part of code works good in BOTH maps,
HOWEVER, every time I view the "Common Events" tab in the other map, it swaps my
"EVT En2" 'Event' with another Random 'Event' ; "EVT TRACKER ALPHA 2"

(*confusing naming conventions, I know! )

I'm not understanding why... It leaves the first one alone, and swaps the second.
also, I do not even need to launch the game to observe it swap on me, all i do is open 'Common Events' tab ; I CORRECT the Swap in Map1, then pull up Map2 ; and there its swapped back again, and Vice Versa...... so.... anybody who could enlighten me on this matter would be appreciated. It just isn't making any sense to me at all.
Thanks.
Based on how you worded it, it seems that you misunderstood how events work: events are instantiated in the map where they reside. The engine references them using their ID and if that said ID is different between your two maps, the engine will reference a different event in the map where the ID is not the expected one.

That said, this is just my wild guess, because in your screenshot we can only see how you used your variables, but no other information regarding your maps nor the logic used to make the swap is actually shown.

To be able to give you a better answer, more and more specific details have to be provided.
🙂 Ok, so Both maps i had made Identical.
I copied every Event over from Map 1 to Map 2.
Now, what im noticing is, it doesnt seem like the Event ID matches at all when i copy, and paste the new one

the 2 First lines of code above... Its essentially the same code,
The "Event ID" it is referencing ALSO does not match the ID from MAP 1, however that line of code seems to function Good, though that may be coincidence i suppose.


now, IF i correct the reference "En2" in MAP 2, and if i DONT go look at the code in MAP 1, then MAP 2 works perfectly, and then its MAP 1 that has similar problems.
so it seems just the act of Looking at the code (pulling up the Common Event tab)
causes it to swap code.


I would have imagined
it would just Crash. Instead, its Tearing out my Code, and replacing it with jiberish.

is this normal for it to do this?
so i guess my question...
1. Is it Expected that if i, say plugin the wrong reference, or, one that
doesnt exist at all.... SHOULD the program still pick one at 'random'?

2. Should/or Can copied Events share the same "ID"?


-Sorry, I know this is alot, of the same, I will try to post the logic flow better
tomorrow, (its pretty simple).



Thanks alot 🙂
When you add events to a map, their ID is assigned automatically and it keeps increasing. When you remove them from your map, however, you might have holes in your IDs sequence. This might be the cause of your IDs not matching in the pasted map (I cannot be 100% sure though since I have never done anything like that though).

The part concerning your code acting weird instead of crashing depends on how the code works. If you were to pick an event whose ID is out of bounds for that map, then you might get an error telling you that moveto is undefined for nil class. However, if the ID you use exists, the code acts weird, but it works. The engine has no means to check whether or not the event whose ID matches the one you used is the one you want to move or not, as long as it is an event you can reference it.

To give the same ID to copy/pasted events you should create dummy events to increase the ID of the event accordingly and then remove them if they are not required. That is the only way that comes to my mind without using a script command to do it.
Hey thanks man, i was just looking over it all, and what you say is making alot of sense now.
As of now, this project has gotten somewhat worse, but now im understanding some things that werent clear before, thank you.
Mainly i just make experiment projects, to learn so not a big loss.
^^ this one was a system like "Shining Force",
I think the biggest mistake this time round was renaming my Events....STUPID! 🙂

I remember coming across something similar in the "show Picture" functions.... something about knowing what number goes to what picture... i cant remember exactly

anyways, that Event ID management advise and "Dummy" approach is such a lifesaver for me
thank you so much!!
I am glad I have been able to help you. Just in case you need it: renaming an event is not wrong, even after renaming it you can still check the event ID in the title bar of the event window. I hope this tip helps you as well.

Original thread: https://forums.rpgmakerweb.com/threads/my-events-are-replacing-themselves-help.126413/