Set Event's Position from Javascript

Does anyone how to set an event's location from a javascript command? I'm trying to get an event to follow the player's x position, but the code isn't doing anything:


$gameMap.event(84).x = $gamePlayer.x;




What's wrong with my code above or is there another way to set an event's location?
'x' in this instance is a function, and only returns whatever the variable '_x' is. What you need to use is '_x'. You will also need to set '_realX', as well. Otherwise the event will 'float' over to the location instead of instantly appearing there.

Code:
$gameMap.event(14)._x = $gamePlayer._x;
$gameMap.event(14)._realX = $gamePlayer._realX;
Awesome! Thanks for the fast response and help! It works like a charm.

Original thread: https://forums.rpgmakerweb.com/threads/set-events-position-from-javascript.69181/