加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有帐号?注册会员
x
#============================================================================= # 简易地图记忆功能 #----------------------------------------------------------------------------- # By:RyanBern #============================================================================= #============================================================================= # 说明 #----------------------------------------------------------------------------- # 切换地图后,重新进入地图会重新装载一遍地图,导致事件还在原位。这里经过简单 # 修改可使得某些地图的事件位置信息会保存下来。 #============================================================================= class Game_Map # 用于储存所记忆地图的变量 ID,这是为了地图信息能保存到下次读档之后,注意,一 # 旦设置了某变量用于记忆地图,则此变量不可作为他用(即不能出现在事件操作或者 # 事件出现条件中)。例如,将1号变量用于储存记忆地图,则写 MEMORIZED_POS = 1 MEMORIZED_POS = 1 alias ryan_setup setup def setup(map_id) unless $game_variables[MEMORIZED_POS].is_a?(Hash) $game_variables[MEMORIZED_POS] = {} end if $maps_need_memorize.include?($game_map.map_id) $game_variables[MEMORIZED_POS][$game_map.map_id] = $game_map.clone end if $game_variables[MEMORIZED_POS].include?(map_id) $game_map = $game_variables[MEMORIZED_POS][map_id] return end @fighters = {} @missiles = [] @bloods = [] ryan_setup(map_id) end end
#=============================================================================
# 简易地图记忆功能
#-----------------------------------------------------------------------------
# By:RyanBern
#=============================================================================
#=============================================================================
# 说明
#-----------------------------------------------------------------------------
# 切换地图后,重新进入地图会重新装载一遍地图,导致事件还在原位。这里经过简单
# 修改可使得某些地图的事件位置信息会保存下来。
#=============================================================================
class Game_Map
# 用于储存所记忆地图的变量 ID,这是为了地图信息能保存到下次读档之后,注意,一
# 旦设置了某变量用于记忆地图,则此变量不可作为他用(即不能出现在事件操作或者
# 事件出现条件中)。例如,将1号变量用于储存记忆地图,则写 MEMORIZED_POS = 1
MEMORIZED_POS = 1
alias ryan_setup setup
def setup(map_id)
unless $game_variables[MEMORIZED_POS].is_a?(Hash)
$game_variables[MEMORIZED_POS] = {}
end
if $maps_need_memorize.include?($game_map.map_id)
$game_variables[MEMORIZED_POS][$game_map.map_id] = $game_map.clone
end
if $game_variables[MEMORIZED_POS].include?(map_id)
$game_map = $game_variables[MEMORIZED_POS][map_id]
return
end
@fighters = {}
@missiles = []
@bloods = []
ryan_setup(map_id)
end
end
ps: $maps_need_memorize 在其他脚本中定义了。是个integer array。存储地图ID
以上是XP脚本 ”简易地图记忆功能 By:RyanBern “
在下尝试着模仿上面写了一个MV的脚本
结果却失败了
你们看看应该怎么改写呢?
我的
MBBS_MV.Core.Game_Map_setup = Game_Map.prototype.setup; Game_Map.prototype.setup = function(mapId) { if (typeof $gameVariables.value(Game_Map.MEMORIZED_POS) === 'number'){ $gameVariables.setValue(Game_Map.MEMORIZED_POS,[]); console.log("Created varible for map spot"); } //alert(mapId+" "+this._mapId); if (Game_Map.MAPS_NEED_MEMORIZE.indexOf(this._mapId)!==-1){ console.log("operating the data."); var temp = $gameVariables.value(Game_Map.MEMORIZED_POS); //var bill = (JSON.parse(JSON.stringify(bob))); temp[this._mapId] = (JSON.parse(JSON.stringify($gameMap))); $gameVariables.setValue(Game_Map.MEMORIZED_POS,temp); } //console.log("$gameVariables.value(Game_Map.MEMORIZED_POS)[mapId]: "+$gameVariables.value(Game_Map.MEMORIZED_POS)[mapId]); if ($gameVariables.value(Game_Map.MEMORIZED_POS)[mapId]){ console.log("data over loaded: mapId: " + mapId); $game_map = $gameVariables.value(Game_Map.MEMORIZED_POS)[mapId]; return; } $gameMap.requestRefresh(); this.setupEFSBattlers(); MBBS_MV.Core.Game_Map_setup.call(this,mapId); };
MBBS_MV.Core.Game_Map_setup = Game_Map.prototype.setup;
Game_Map.prototype.setup = function(mapId) {
if (typeof $gameVariables.value(Game_Map.MEMORIZED_POS) === 'number'){
$gameVariables.setValue(Game_Map.MEMORIZED_POS,[]);
console.log("Created varible for map spot");
}
//alert(mapId+" "+this._mapId);
if (Game_Map.MAPS_NEED_MEMORIZE.indexOf(this._mapId)!==-1){
console.log("operating the data.");
var temp = $gameVariables.value(Game_Map.MEMORIZED_POS);
//var bill = (JSON.parse(JSON.stringify(bob)));
temp[this._mapId] = (JSON.parse(JSON.stringify($gameMap)));
$gameVariables.setValue(Game_Map.MEMORIZED_POS,temp);
}
//console.log("$gameVariables.value(Game_Map.MEMORIZED_POS)[mapId]: "+$gameVariables.value(Game_Map.MEMORIZED_POS)[mapId]);
if ($gameVariables.value(Game_Map.MEMORIZED_POS)[mapId]){
console.log("data over loaded: mapId: " + mapId);
$game_map = $gameVariables.value(Game_Map.MEMORIZED_POS)[mapId];
return;
}
$gameMap.requestRefresh();
this.setupEFSBattlers();
MBBS_MV.Core.Game_Map_setup.call(this,mapId);
};
|