Dynamic Eventing Problems.

Hey guys I started eventing recently in JS and everything went smooth for a while and then I reached this problem while trying to
create an event via Plugin.
Code:
function create_event(ID,NAME,X,Y) {
var e=(a jason like u find in the map files)
$dataMap.events[ID] = e;
$gameMap._events[ID] = new Game_Event($gameMap._mapId, ID);
/*
}

so everything is fine until here...
the event creates but it is invisible
now i looked up this thread here https://rpgmakermv.co/threads/how-to-add-an-event-using-js-dynamically.3578/
and it gave me some insight

I could not make the event show up with the first method(it shows up only briefly like a ghost and then vanishes)
But the second one blew my mind away.
Why is it that when i call something like:
console.log(SceneManager._scene.children) (it presents me with an array containing what i need and what I would like to use)
but then if i call console.log(SceneManager._scene.children[0])//element which EXISTS(i get something undefined)

Why is this happening and how can I make my event visible?
AFAIK the way objects are displayed has evolved since 2016, which would explain why the event gets displayewd only as a ghost. However, it shouldn't be far from the current version. I'm not going to explore it, but maybe you'd like to take a look at Galv's event spawner for example to see how newly added events are displayed there.
As for your second question, a screenshot of it would be much more descriptive. Because it looks like you've made a typo in the console.
AFAIK the way objects are displayed has evolved since 2016, which would explain why the event gets displayewd only as a ghost. However, it shouldn't be far from the current version. I'm not going to explore it, but maybe you'd like to take a look at Galv's event spawner for example to see how newly added events are displayed there.
As for your second question, a screenshot of it would be much more descriptive. Because it looks like you've made a typo in the console.
I see so it appears that my old version could be at fault here, I will upgrade it and see if the problem still persists,as for my second question here is a screenshot. It could be that this happens beacause i try to do this directly from the plugin as I see that this works well if i place them in the script command inside an event.Even so how do I get arround this?

Anyway thank you and I will look into the tutorials that you have given me.
I wasn't talking about you having an old version of MV. I was talking about the fact that the post was written in 2016 and since then MV has evolved, so it will probably be handled a bit differently now.

As for your screenshot, I guess I'm not sure what it is. Maybe old version of nw.js.
Screenshot_545.png

Mine works completely fine.
take a look to

Spriteset_Map.prototype.createLowerLayer
Spriteset_Map.prototype.createTilemap
Spriteset_Map.prototype.createCharacters

add some console.log to those to try find where and why your children.lenght reset !
And plz fix your code with
Code:
code Button
, its hard to read for my eyes
Woah! I will look into it it in a few days I hope this will yield better results. Thanks!
I think I found the problem but I still have no way to solve it, Indeed,if I type something like SceneManager._scene.children[0]. in the console it will work but if i call that from my script it will not, I even tryed Galv's spawning script and I got the same result, if I do it from in game it will work but if call a function of his in my script it will not work, it will give me similar undefined errors.
Well I guess is near impossible to make them work, atleast can someone tell me how to manipulate spawned events like you can the normal ones?

Original thread: https://forums.rpgmakerweb.com/threads/dynamic-eventing-problems.93995/