//this script will locate the event at random position specific by region.var alias = Game_Map.prototype.initialize;Game_Map.prototype.initialize = function () { alias.apply(this);};var mapRegion = [];var mapRegionData = [];var alias2 = Scene_Map.prototype.start;Scene_Map.prototype.start = function () { alias2.apply(this) //console.log($gameMap.regionId($gamePlayer.x, $gamePlayer.y)) if (this.isReady()) { console.log(Number($gameMap.getWidth())); }};Game_Map.prototype.setupRegion = function () { mapRegion = []; mapRegionData = []; for (i = 0; i < 255; i++) { mapRegion.push(i); mapRegionData.push([]) } for (j = 0; j < Number($gameMap.getWidth()); j++) { for (k = 0; k < Number($gameMap.getHeight()); k++) { if (($gameMap.regionId(j, k) == 0) == false) { mapRegionData[$gameMap.regionId(j, k)].push(j + "," + k); }; }; };};Game_Map.prototype.setEventLocatex = function (region,direction) { if (mapRegionData[region].length > 0) { var rand = Math.floor((Math.random() * mapRegionData[region].length) + 1); var test = mapRegionData[region][rand]; var text = test.split(/\s*,\s*/); //console.log('X: ' + text[0] + ' \nY: ' + text[1]); console.log(test); console.log(rand); console.log($gameMap.event(this._eventId).x) // << this is the error //$gameMap.event(this.eventId).locate(Number(text[0]),Number(text[1])); // << this is the error //$gameMap.event(this._eventId).locate(Number(text[0]),Number(text[1])); // << this is the error if (direction) { $gameMap.events(this.eventId()).setDirection(direction) }; };};Game_Map.prototype.getWidth = function () { return String($dataMap.width)};Game_Map.prototype.getHeight = function () { return String($dataMap.height)};