Player/Event barrier

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.
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);
Default is-passable should just depend on the default through-on or below-characters of the blocking events. Those events will still block the proper events based on their plugin condition.
Just to make absolute sure I'm not corrupting the code, do you have a new update for it? I'm assuming the last code here was but I feel the new MV version is causing issues with it. I don't know how drastic the engine updates changes plugins.
What is breaking with it?

I'm actually writing an app to update the JS engine libraries automatically for all projects at once, but interestingly enough I ran the previous JS versions through http://prettydiff.com/ because I want to show the updated lines of javascript before you replace it, and I've only actually found about 6 lines different per JS on average from RPG Maker 1.3.5 and a lot of it is just different comments.
Oh, so I'm not changing the codes correctly :s
this is more confusing that I thought it was going to be haha.
Your parameters look clean to me.

Is anything breaking?
Nothing is crashing, but the Car events are blocked no matter what page they are commanded to be halted or passable to.
There was a lot of forum banter about removing / not-removing the bug that made events impassable to all events no matter what their passibility or priority. Needless to say, it was a bug and they removed it.

There were some popular tutorials that exploited the bug as a game function, to keep events from moving where they weren't supposed to be on a map, etc.

I wonder if casual copying, or the popularity for the bug as positive, somehow accidentally, or purposely put it back in this version. I haven't tried it.
I have not heard of that discussion around at all to say for myself. It must of occurred during the duration when my OS died :s
Would you prefer blocking regions and game switches?

EDIT: I made one that does regions.

It uses $gameSwitches true/false so it's similar to the $gameSelfSwitches true/false boolean, in that it will also read true for any switch that's still left on, regardless of event page hierarchy, so like turn your switches off when you turn others on.

Now that I think about it; this could be your problem with the other version.

You don't need to take this version if you don't want to redo your whole system.
Spoiler
PHP:
/*:
 *
 * @plugindesc Makes Certain Regions Non Passable to Certain Events
 * @author Jake Jilg "mogwai"
 *
 */

(function(alias){
   var stoppers = [
       {
           "stopper-region" : 11,
           "stop-switch"    : 19,
           "stop-names"     : "sara,tara"
       },
       {
           "stopper-region" : 11,
           "stop-switch"    : 20,
           "stop-names"     : "sara,tara"
       },
       {
           "stopper-region" : 11,
           "stop-switch"    : 21,
           "stop-names"     : "sara,tara"
       }
   ];
   Game_CharacterBase.prototype.canPass = function(x, y, d) {
       var ev1 = this;
       var rgn = $gameMap.regionId(
           $gameMap.roundXWithDirection(x, d), // x2
           $gameMap.roundYWithDirection(y, d)  // y2
       );
       var char1 = ev1 !== undefined && ev1._eventId !== undefined;
       var char2 = typeof rgn === typeof 33;  
       if(char1 && char2){
           var isEvent1 = ev1._eventId !== undefined;
           var id1 = isEvent1 ? ev1._eventId : 1;
           var name1 = isEvent1 ? $dataMap.events[id1].name : $dataActors[id1].name;
      
           for(var i = 0; i < stoppers.length; i++){
               if(stoppers[i]["stopper-region"] !== rgn) continue
               if(stoppers[i]["stop-names"].split(/,/g).indexOf(name1) === -1)
                   continue;
               var swtch = stoppers[i]["stop-switch"];
               return $gameSwitches.value(swtch);
               break;
           }
       }
       return alias.apply(this,arguments);
   };
})(Game_CharacterBase.prototype.canPass);

reg1.png
reg2.gif
Unfortunately the use of the regions might deny me the use of the traffic light post graphics and such won't it?
The plugin before seemed to work fine for you- but my problem is understanding why it's not correctly blocking and letting the event name pass for me.

Um I tried this earlier- it makes a little sense to me since I noticed that maybe taking out the event name on a page would solve the passable issue but it's not adding up either way.
Code:
(function(alias){
   var stoppers = [
       {
           "stopper-name" : "TRAFFIC LIGHT STOPPER",
           "stop-switch"  : "default",
           "stop-names"   : "",
       },
       {
           "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"  : "default",
           "stop-names"   : "Car Event",
       },
       {
           "stopper-name" : "TRAFFIC LIGHT ODD",
           "stop-switch"  : "A",
           "stop-names"   : "Car Event",
       },
       {
           "stopper-name" : "TRAFFIC LIGHT ODD",
           "stop-switch"  : "B",
           "stop-names"   : "Car Event",
       },
       {
           "stopper-name" : "TRAFFIC LIGHT ODD",
           "stop-switch"  : "C",
           "stop-names"   : "",
       },

   ];

Gah I'm terrible at this.
Oh rats! You won't believe this... I made a major snafu!

I just tested it and my plugin only works for me in opposite land.😕

canPass only lets you pass if it returns true, and I was returning the selfswitch value which would be true (not false)...

I needed to return false if selfSwitch is true... That would help. !false === true

I'm so dumb....

This version should be solid now that I know what a boolean is.
Spoiler
PHP:
/*:
 *
 * @plugindesc Makes Certain Events Non Passable to Certain Events
 * @author Jake Jilg "mogwai"
 *
 */

(function(alias){
   var stoppers = [
       {
           "stopper-name" : "jake",
           "stop-switch"  : "B",
           "stop-names"   : "sara,tara",
       },
       {
           "stopper-name" : "jake",
           "stop-switch"  : "C",
           "stop-names"   : "sara",
       },
       {
           "stopper-name" : "sammy",
           "stop-switch"  : "B",
           "stop-names"   : "tara,mara",
       },
   ];
   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 !== "" && ABCD !== "default" ?
               !$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);

EDIT2: ^ now with "default" for none switches

EDIT: By the way, what is stop-switch "default"? I can add that. Ok, I added it.
Oh Um the default thing I wrote down was to signify the default page of an event i.e a page without A,B,C,D self switched pages.
So that one can be determined if it's a blockade to begin with or not depending on which light TRAFFIC STOPPER and TRAFFIC STOPPER ODD.
Still getting Car Event moving through the lights- but I'm assuming that's because the default part is still left around. Adding default would probably help fix this 🙂
I edited the "default" self switch to return false on canPass, if all A,B,C,D self switches are false.

I originally thought we were using an "" empty string for that none switch.
Oh ok, haha wow this is confusing. Just to clarify changes now with the recent update:

If I wanted for example TRAFFIC LIGHT STOPPER's default page as passable- I would set it as:
"stopper-name" : "TRAFFIC LIGHT STOPPER",
"stop-switch" : "default",
"stop-names" : "", <--- Left blank for being passable to all events- left empty to allow Car Event to pass?
},
{
"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",
},

^All above except the default page designated to block 'Car Event' from moving through.

As for the opposing traffic light TRAFFIC LIGHT ODD which begins as a blockade to ' Car Event' but becomes passable on page 'C'

{
"stopper-name" : "TRAFFIC LIGHT ODD",
"stop-switch" : "default",
"stop-names" : "Car Event",
},
{
"stopper-name" : "TRAFFIC LIGHT ODD",
"stop-switch" : "A",
"stop-names" : "Car Event",
},
{
"stopper-name" : "TRAFFIC LIGHT ODD",
"stop-switch" : "B",
"stop-names" : "Car Event",
},
{
"stopper-name" : "TRAFFIC LIGHT ODD",
"stop-switch" : "C",
"stop-names" : "",<--- Left blank for being passable to all events- left empty to allow Car Event to pass?
},
You don't need blank stoppers to allow events to pass. You might have gotten this confused when I had the boolean backwards; I apologize.

All you need for self-switch C to be passable to all events, is to be above/below characters or have through-ON for the page with self switch C.
Ah I see now, but I thought the plugin was supposed to block or pass regardless of Priority: my reason being is because for instances where the blockade pages are set to below or same layer- the traffic light graphic will no longer be above characters visually looking awkward such as this screen cap here.


I know the traffic light graphic itself is facing the wrong way- but on certain maps where the light would be below merging into traffic north of it- the lighting would be behind it visually almost being un see-able.
I'm awfully sorry about all this trouble :s
Do you think there could be a way around making the graphics priority different all together?
I have no idea what's going on anymore. Nothing is being blocked atm :/

EDIT: I may have this thing figured out, all I need to do is configure a way to have the graphics on top whilest also blocking events on the same level. I will report progress.

Original thread: https://forums.rpgmakerweb.com/threads/player-event-barrier.76237/