I'm a little confused how to specify if a default page blocks or is passable with this. When testing the plugin it seems the listed impassable switches allow access to pass but the pages left out to allow pass abilities is in reverse?
I'm really sorry for being thick skulled, i'm trying to learn to understand this new method.
Here is my changes to your plugin.
I'm really sorry for being thick skulled, i'm trying to learn to understand this new method.
Here is my changes to your plugin.
PHP:
/*:
*
* @plugindesc Makes Certain Events Non Passable to Certain Events
* @author Jake Jilg "mogwai"
*
*/
(function(alias){
var stoppers = [
{
"stopper-name" : "TRAFFIC LIGHT STOPPER",
"stop-switch" : "A",
"stop-names" : "Car Event",
},
{
"stopper-name" : "TRAFFIC LIGHT STOPPER",
"stop-switch" : "B",
"stop-names" : "Car Event",
},
{
"stopper-name" : "TRAFFIC LIGHT STOPPER",
"stop-switch" : "C",
"stop-names" : "Car Event",
},
{
"stopper-name" : "TRAFFIC LIGHT ODD",
"stop-switch" : "",
"stop-names" : "Car Event",
},
{
"stopper-name" : "TRAFFIC LIGHT ODD",
"stop-switch" : "A",
"stop-names" : "Car Event",
},
{
"stopper-name" : "TRAFFIC LIGHT ODD",
"stop-switch" : "C",
"stop-names" : "Car Event",
},
];
Game_CharacterBase.prototype.canPass = function(x, y, d) {
var ev1 = this;
var ev2 = $gameMap.eventsXy(
$gameMap.roundXWithDirection(x, d), // x2
$gameMap.roundYWithDirection(y, d) // y2
)[0];
var char1 = ev1 !== undefined && ev1._characterName !== undefined;
var char2 = ev2 !== undefined && ev2._eventId !== undefined;
if(char1 && char2){
var isEvent1 = ev1._eventId !== undefined;
var id1 = isEvent1 ? ev1._eventId : 1;
var name1 = isEvent1 ? $dataMap.events[id1].name : $dataActors[id1].name;
var isEvent2 = ev2._eventId !== undefined;
var id2 = isEvent2 ? ev2._eventId : 1;
var name2 = isEvent2 ? $dataMap.events[id2].name : $dataActors[id2].name;
for(var i = 0; i < stoppers.length; i++){
if(stoppers[i]["stopper-name"] !== name2) continue
if(stoppers[i]["stop-names"].split(/,/g).indexOf(name1) === -1)
continue;
var ABCD = stoppers[i]["stop-switch"];
return ABCD !== "" ?
$gameSelfSwitches.value([
ev2._mapId,
ev2._eventId,
ABCD
]) :
!$gameSelfSwitches.value([
ev2._mapId,
ev2._eventId,
"A"
]) &&
!$gameSelfSwitches.value([
ev2._mapId,
ev2._eventId,
"B"
]) &&
!$gameSelfSwitches.value([
ev2._mapId,
ev2._eventId,
"C"
]) &&
!$gameSelfSwitches.value([
ev2._mapId,
ev2._eventId,
"D"
]);
break;
}
}
return alias.apply(this,arguments);
};
})(Game_CharacterBase.prototype.canPass);
