I'm trying to use a script to make a copy of an existing event in-game, and while the event os created successfully and I can interact with it as expected, it's never being drawn on the actual map. Here is my code (it runs when the action button is pressed, and puts a copy of event ID 3 directly in front of the player):
var direction = $gamePlayer.direction();var x1 = $gamePlayer.x;var y1 = $gamePlayer.y;var x2 = $gameMap.roundXWithDirection(x1, direction);var y2 = $gameMap.roundYWithDirection(y1, direction);var e = new Game_Event($gameMap._mapId, 3);e.setPosition(x2, y2);$gameMap._events.push(e); $gameMap.requestRefresh();console.log($gameMap._events);Note: I tried $gameMap.requestRefresh() just for kicks -- it doesn't seem to help. I also tried explicitly setting the event to visible, but that didn't do anything either (the event I'm copying is visible anyway).
I'm guessing I need to add the event to some kind of draw queue somewhere, but I've been digging through the code, and so far I'm kind of at a loss as to where the event's corresponding sprite is located in the code (as far as I can tell, it doesn't seem to be referenced from inside the Game_Event object). If I can make this work, I'd like to release a simple eveny copying plugin so other people can make use of it too. Any help would be appreciated,
var direction = $gamePlayer.direction();var x1 = $gamePlayer.x;var y1 = $gamePlayer.y;var x2 = $gameMap.roundXWithDirection(x1, direction);var y2 = $gameMap.roundYWithDirection(y1, direction);var e = new Game_Event($gameMap._mapId, 3);e.setPosition(x2, y2);$gameMap._events.push(e); $gameMap.requestRefresh();console.log($gameMap._events);Note: I tried $gameMap.requestRefresh() just for kicks -- it doesn't seem to help. I also tried explicitly setting the event to visible, but that didn't do anything either (the event I'm copying is visible anyway).
I'm guessing I need to add the event to some kind of draw queue somewhere, but I've been digging through the code, and so far I'm kind of at a loss as to where the event's corresponding sprite is located in the code (as far as I can tell, it doesn't seem to be referenced from inside the Game_Event object). If I can make this work, I'd like to release a simple eveny copying plugin so other people can make use of it too. Any help would be appreciated,