現在実行されているコモンイベントの取得
Posted: 2016年5月23日(月) 10:06
タイトル通りです
Scene_xx内で現在実行されてるコモンイベントのIDを取得したいのですが
方法がわからず質問させていただきました
Scene_xx内で現在実行されてるコモンイベントのIDを取得したいのですが
方法がわからず質問させていただきました
コード: 全て選択
var interpreter = $gameParty.inBattle() ? $gameTroop._interpreter : $gameMap._interpreter;
while (interpreter._childInterpreter !== null) interpreter = interpreter._childInterpreter;
console.log(interpreter._eventId); // 現在起動中のコモンイベント表示
コード: 全て選択
// 現在起動中の並列コモンイベントIDを配列にして取得
var array = $gameMap._commonEvents.filter(function (event) {
return event.isActive();
}).map(function (event) {
return event.event().id;
});
console.log(array); // 現在起動中の並列コモンイベント表示
コード: 全て選択
(function(){
// Common Event
var Game_Interpreter_command117 = Game_Interpreter.prototype.command117;
Game_Interpreter.prototype.command117 = function() {
$gameVariables.setValue(1, this._params[0]); // 変数番号1番にコモンイベントIDを記録する。
return Game_Interpreter_command117.call(this);
};
}());
コード: 全て選択
(function(){
var Game_Temp_reserveCommonEvent = Game_Temp.prototype.reserveCommonEvent;
Game_Temp.prototype.reserveCommonEvent = function(commonEventId) {
$gameVariables.setValue(1, commonEventId); // 変数番号1番にコモンイベントIDを記録する。
Game_Temp_reserveCommonEvent.call(this, commonEventId);
};
}());
コード: 全て選択
var commonEventId = $gameVariables.value(1); // 格納したコモンイベントIDを戻す
var commonEventName = $dataCommonEvents[commonEventId].name; // 名前の取得