すり抜けしないイベントIDの取得方法
Posted: 2020年4月12日(日) 23:08
スクリプトで$gameMap.eventsXyNt(x, y) を使用すると配列でイベントIDを取得する為か、他のスクリプトと合わせた時にエラーが発生してしまいます。
$gameMap.eventIdXy(x, y)のように1つだけイベントIDを取得し、かつすり抜けしないイベントだけを選べるスクリプトはあるでしょうか?
【現在のスクリプト】
$gameVariables.setValue(49,$gameMap.eventsXy($gameVariables.value(47),$gameVariables.value(48)));
var targetID = $gameVariables.value(49);
if(targetID != 0 && ~$dataMap.events[targetID].note.indexOf("[対象者]")){
var mapID = this._mapId;
if($gameSelfSwitches.value([mapID, targetID, "B"])){
$gameVariables.setValue($gameVariables.value(49),20);
if(~$dataMap.events[targetID].note.indexOf("[巨大モンスター]")){
$gameVariables.setValue(45,$gameVariables.value(45)+1);
}
$gameVariables.setValue(45,$gameVariables.value(45)-1);
}
【エラーコード】
TypeError
Cannot read property 'note' of undefined
【参考にしたページ】
RPGツクールと数学のブログ アクションRPGの基礎(RPGツクールMV)(2/4)
https://fermiumbay13.hatenablog.com/ent ... /01/190453
【解決済み】同じマスに複数イベントが重なっている時のイベントID所得方法
viewtopic.php?t=8470
$gameMap.eventIdXy(x, y)のように1つだけイベントIDを取得し、かつすり抜けしないイベントだけを選べるスクリプトはあるでしょうか?
【現在のスクリプト】
$gameVariables.setValue(49,$gameMap.eventsXy($gameVariables.value(47),$gameVariables.value(48)));
var targetID = $gameVariables.value(49);
if(targetID != 0 && ~$dataMap.events[targetID].note.indexOf("[対象者]")){
var mapID = this._mapId;
if($gameSelfSwitches.value([mapID, targetID, "B"])){
$gameVariables.setValue($gameVariables.value(49),20);
if(~$dataMap.events[targetID].note.indexOf("[巨大モンスター]")){
$gameVariables.setValue(45,$gameVariables.value(45)+1);
}
$gameVariables.setValue(45,$gameVariables.value(45)-1);
}
【エラーコード】
TypeError
Cannot read property 'note' of undefined
【参考にしたページ】
RPGツクールと数学のブログ アクションRPGの基礎(RPGツクールMV)(2/4)
https://fermiumbay13.hatenablog.com/ent ... /01/190453
【解決済み】同じマスに複数イベントが重なっている時のイベントID所得方法
viewtopic.php?t=8470