Requiring event barrier/passability.

Hello everyone, I've been doing some extensive bug testing recently and to complete my game's atmosphere with it's city life I'm requiring a new plugin that can control passage for specific events. I did previously have a plugin that did this, but unfortunately it no longer gets worked on and it had too many experimental versions they crashed too often.

I'm requiring a unique function which can give events the power to allow/disallow passage through itself to specifically named events.

For example a traffic light post prevents vehicles passing through when its red, but when it goes green the vehicle is allowed passage. Say event 'TRAFFIC LIGHT' has the power to block events named 'CAR EVENT'

Any further questions or assistance is greatly appreciated!
Make invisible events on the road that go from priority below player to same as player when the red light switch is on (2 event pages) ? Other events will be blocked unless they have through on. That or give event CAR another page with fixed movement when the light is red.

If you're not using a global switch for the lights you can try using my remote control plugin to make event TRAFFIC LIGHT turn on self switches of events BLOCK ROAD. That or remotely stop movement of events CAR on map x1-x2, y1-y2 by flipping their self switches.

Here's an example of BLOCK ROAD. this.SetSSW is a script call from my plugin, it just changes the traffic light color by turning on self switch A. Variables 11 and 12 store an array containing the eventIds of all TRAFFIC LIGHTS and BLOCK ROAD (which I went and called traffic light up/left for convenience), also using a script call from my plugin.

Finally, as for specifically allowing passage through by name, it's doable using SearchNames with an if/else branch at BLOCK ROAD (check if this._eventId is part of blocked eventId array) but I'm not demoing it here.
2f2eba32-a568-4a9e-884a-22cd79d292c3

conditional branch script: blockedeventIds.some(function(eventId){ return eventId === this._eventId; })

It will be true if the current event is in the blocked list.


anYIhCJ.png
vxqPy6j.png

la1iGLp.jpg
This is an interesting take on the traffic system, I almost gave up but then I hadn't even been notified of this post 😮

I could be using fixed move routes to simulate traffic, but my Car NPC's are supposed to be running of randomized time increments to simulate more life like and unpredictable traffic, something the player cannot be bored always timing when a vehicle is arriving on map- soley because I plan to have enemy occupied vehicles occasionally scoot past.

My traffic lights operate on a 4 page system, ones facing horizontal on the first two pages are on orange light and red light, orange initially is a very short spanned page that warns NPC vehicles and Players of an impeding red light (hence the following page) while the 3rd page activates a green light it is still a blockade to NPC vehicles but after a short duration it switches to the 4th page which is a passable green light.
The vertical facing traffic lights operate basically the same way but begin as if it were page 4 of the horizontal traffic light.
Also teleporting events reset the variable switch on the traffic lights which will always result them starting on page 1 to avoid instances where pages may be glitched during teleportation.

You mentioned a plugin? I am unsure how to apply these scripts without one but I am very eager to give your formula a shot!
I made a simple demo. You can see it here. The random spawning thing isn't working perfectly because I lazily left both the traffic lights and the whole spawning thing to common events (the cars themselves are only 1 page with no content, lights are 2 pages, different sprites but also no content), but it looks like you've got that part down. My plugin is inside the demo, it makes mass control of events simpler but they all behave the same way.

It's different from yours in that my cars and lights act independently. The lights just stop the cars. It doesn't glitch but cars tend to bunch up at lights. There's also an autorun event that stores the eventIds of the lights and cars so I can leave all my traffic to central control.
I will run a massive check through all of this and will give you the results after I finish work today!
I'm looking forward to this, I noticed that cars also bunch up a bit aswell but i've been meaning to get that sorted by having event hit boxes extended since my cars sprites are bigger than 48x48 in pixels, my project is alot about condensing events and hopefully I can accumulate as much as possible into common events in the case of emergency I need to fix an issue globally within the game 🙂
Curious to know how you made the car events be blocked specifically by the tragic lights?
I might need further explanation 🙂
Actually, all events are blocked by the BLOCK ROAD event in my demo. I just made it not obvious by minimizing the possibility that any pedestrian would be dumb enough to step onto that tile (except the player, who is unblocked because the event priority is set to below player). The pedestrians would be programmed to use the zebra crossing, with pedestrian traffic controlled the same way as the cars. Of course, only the player is free to jaywalk. I took a look at your game maps and I think it's okay if cars stopped some distance away from pedestrian crossings caused by you placing a hidden event there. Real roads are like that, after all. I think this is the simplest way to make the traffic work. Having gangsters jaywalking with the player is likely to cause a lot of unbelievable vehicle-npc accidents too.

To block only car events, I'd use a collision checker plugin. Thus, when CAR collides with BLOCK ROAD, it would then check what color the traffic light is (by remotely accessing the traffic light's self switch), and decide whether to set BLOCK ROAD's movement route to THROUGH or not (also by remote control of BLOCK ROAD's self switches). After passing through, BLOCK ROAD would need to be reset till the next collision. It's definitely doable via common event, but I'm going to need some time to think it through, or write a quick plugin (sorry, I've only been using rmmv for a month, I'm not totally familiar with its base code yet).

For random traffic, see here. I've realized that the inbuilt rmmv setlocation command is stupid and laggy when the common event is in charge, but that reddit post will show you how to simulate random traffic without appearing to. A common event can still be used to control the forward/reverse CAR self switch. That or you can hide cars with custom routes in an inaccessible corner of the map and spawn them on the roads at random.

By the way, could you show me the plugin that you previously used? Might be able to fix it or at least study it and write a new one. Coding is fun!

I saw your game and I must say, you're AMAZING. Beautiful lighting and atmosphere, reminiscent of gta chinatown and saints row. Please let me try a demo when you're ready! My own artistic skills died at stick figure level so I only get rtp tiles to play with, though my current personal goal is to reach skyrim-level AI for my npcs (hence the coding mania). My head is also packed with ideas on game mechanics.
Oh I think I know whats going on sorta, the demo you provided is missing some of these things you mentioned only now?
Because I've been searching through everything and could not find some of the things you mentioned, my cars function in an pretty unique way so i'll give you the basic rundown how they operate.


Each lane present on the map has an Event that is invisible, provided it uses several variable random checks to dictate it's movement and graphic.
  • First the Vehicle remains invisible and is set on THROUGH followed by a timer check branching off into a select few wait commands simulating a delay on arrival.
  • Eventually if it lands on vehicle arrival check it will run a plugin command that selects one out of 8 sprite sheets, and selects 1 of them from the 8 already on the one sheet totaling from 64 different graphics excluding Police and Gang faction vehicles and then proceeding to make itself visible
  • Depending on the map- it runs another random check which determines it's path,speed, on the map, once it has reached its target point-it will fade away it's graphic and teleport back to it's place of origin. The Event repeats the step from the first page.
  • Each NPC car even however has it's own #Graphic,pathway,wait variable checks to avoid causing vehicles on the map from suddenly changing it's course.
The Traffic lights are there to block cars from colliding with each other on intercessions,T junctions, Npc Vehicles pathways also include slowing down near traffic lights, pedestrians have pathways only on marked walking areas since they are region restricted.


I'm happy you have a great interest in my project- I really do want to create something good here and I definitely intend to release a demo for everyone to play when it's bug free at a playable lengthy state.

Original thread: https://forums.rpgmakerweb.com/threads/requiring-event-barrier-passability.84828/