Get current event id

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
248
Reaction score
67
First Language
english
Hey guys, I want to get current (running) event id.

I have tried

$gameMap.event(this.eventId)but it's not work. any solution?
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Use either

this._eventId

or

this.eventId()
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Show the whole script you're trying to run.  If your plugin runs through Game_Interpreter, either of the above will work.  So it depends on the context - whether it's in a Game_Interpreter function, a Game_Map function, a Game_Event function, or something of your own.
 
Last edited by a moderator:

izyees

My Secret Santa
Veteran
Joined
Oct 24, 2015
Messages
248
Reaction score
67
First Language
english
it's game_map.

Code:
//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)}; 
 

Shaz

Veteran
Veteran
Joined
Mar 2, 2012
Messages
40,098
Reaction score
13,704
First Language
English
Primarily Uses
RMMV
Then there is no "current" event.  The function would need to accept an event id, if it's called from a script or plugin call, or would need to test ALL of the events in its list to see which one(s) need to be moved.  If you are doing some "place event randomly when the map starts", I assume you would have some way of determining which events need to be placed randomly, and in that case, within Game_Event would be the better place for your code to go.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Posts

Latest Profile Posts

People3_5 and People3_8 added!

so hopefully tomorrow i get to go home from the hospital i've been here for 5 days already and it's driving me mad. I miss my family like crazy but at least I get to use my own toiletries and my own clothes. My mom is coming to visit soon i can't wait to see her cause i miss her the most. :kaojoy:
Couple hours of work. Might use in my game as a secret find or something. Not sure. Fancy though no? :D
Holy stink, where have I been? Well, I started my temporary job this week. So less time to spend on game design... :(
Cartoonier cloud cover that better fits the art style, as well as (slightly) improved blending/fading... fading clouds when there are larger patterns is still somewhat abrupt for some reason.

Forum statistics

Threads
105,868
Messages
1,017,096
Members
137,587
Latest member
Usagiis
Top