本帖最后由 任小雪 于 2022-6-5 02:24 编辑
//前程提要,$dataItems[1].meta.是我自定义变量(你可以理解为自设的公共变量)的数据的前缀,理论上都是存档时会被存档的数据,且也能被读取的。
//【已知bug,以下脚本也不是我的最终版本,但改的是一些同等水平可见的细节小bug,和最大的两个bug99%无关】第一,存档关游戏后再打开,游戏没法玩(即,其实毫无意义);第二,仅一开始的图能弄。
//【总结】于是,我还是把事情想简单了,现在也只能意识到困难没我想的简单,但怎么入手还是没有任何头绪,大概还是又又又再次放弃了这次新新新的尝试……当然如果有带佬三言两语能搞定,那倒是真的好
//【已知bug】貌似没法存档读取 //调用法子XinEventShengcheng(DituID,ShijianID,ShijianNumber,XYPiancha); var XinEventShengcheng= function(DituID,ShijianID,ShijianNumber,XYPiancha) {//无限生成新事件【同事件复制】 //DituID要复制事件的地图id,ShijianID要复制事件的事件id,ShijianNumber要复制事件的具体要复制数,XYPiancha所生成的新事件与被复制事件的坐标偏差 var EventNumber=$dataMap.events.length+ShijianNumber; Game_Event.prototype.event = function() { if(DituID&&ShijianID&&ShijianNumber&&XYPiancha){ if(this._mapId==DituID&&$dataMap.events.length<EventNumber){ var shijian=JsonEx.makeDeepCopy($dataMap.events[ShijianID]); shijian.id=$dataMap.events.length; var XYPianchaNumber=2+XYPiancha; shijian.x=$dataMap.events[ShijianID].x+XYPiancha-Math.randomInt(XYPianchaNumber); shijian.y=$dataMap.events[ShijianID].y+XYPiancha-Math.randomInt(XYPianchaNumber); $dataMap.events.push(shijian); $dataItems[1].meta.MapEvents[DituID]=$dataMap.events; var shijian=JsonEx.makeDeepCopy($gameMap._events[ShijianID]); shijian._eventId=$gameMap._events.length; shijian._realX=shijian.x=shijian._x=$dataItems[1].meta.MapEvents[DituID][shijian._eventId].x; shijian._realY=shijian.y=shijian._y=$dataItems[1].meta.MapEvents[DituID][shijian._eventId].y; $gameMap._events.push(shijian); $dataItems[1].meta.GameMapEvents[DituID]=$gameMap._events; }else if(this._mapId==DituID&&$dataMap.events.length==EventNumber){ DituID=null;ShijianID=null;ShijianNumber=null;XYPiancha=null; SceneManager.goto(Scene_Map); }; }; if($dataItems[1].meta.MapEvents[this._mapId]){ $dataMap.events=$dataItems[1].meta.MapEvents[this._mapId]; $gameMap._events=$dataItems[1].meta.GameMapEvents[this._mapId]; }; return $dataMap.events[this._eventId]; }; }
//【已知bug】貌似没法存档读取
//调用法子XinEventShengcheng(DituID,ShijianID,ShijianNumber,XYPiancha);
var XinEventShengcheng= function(DituID,ShijianID,ShijianNumber,XYPiancha) {//无限生成新事件【同事件复制】
//DituID要复制事件的地图id,ShijianID要复制事件的事件id,ShijianNumber要复制事件的具体要复制数,XYPiancha所生成的新事件与被复制事件的坐标偏差
var EventNumber=$dataMap.events.length+ShijianNumber;
Game_Event.prototype.event = function() {
if(DituID&&ShijianID&&ShijianNumber&&XYPiancha){
if(this._mapId==DituID&&$dataMap.events.length<EventNumber){
var shijian=JsonEx.makeDeepCopy($dataMap.events[ShijianID]);
shijian.id=$dataMap.events.length;
var XYPianchaNumber=2+XYPiancha;
shijian.x=$dataMap.events[ShijianID].x+XYPiancha-Math.randomInt(XYPianchaNumber);
shijian.y=$dataMap.events[ShijianID].y+XYPiancha-Math.randomInt(XYPianchaNumber);
$dataMap.events.push(shijian);
$dataItems[1].meta.MapEvents[DituID]=$dataMap.events;
var shijian=JsonEx.makeDeepCopy($gameMap._events[ShijianID]);
shijian._eventId=$gameMap._events.length;
shijian._realX=shijian.x=shijian._x=$dataItems[1].meta.MapEvents[DituID][shijian._eventId].x;
shijian._realY=shijian.y=shijian._y=$dataItems[1].meta.MapEvents[DituID][shijian._eventId].y;
$gameMap._events.push(shijian);
$dataItems[1].meta.GameMapEvents[DituID]=$gameMap._events;
}else if(this._mapId==DituID&&$dataMap.events.length==EventNumber){
DituID=null;ShijianID=null;ShijianNumber=null;XYPiancha=null;
SceneManager.goto(Scene_Map);
};
};
if($dataItems[1].meta.MapEvents[this._mapId]){
$dataMap.events=$dataItems[1].meta.MapEvents[this._mapId];
$gameMap._events=$dataItems[1].meta.GameMapEvents[this._mapId];
};
return $dataMap.events[this._eventId];
};
}
|