Events react to other events

Is it possible to make an event react to other nearby events? Like for example say in a citybuilding game, if events were spawned in from another map, is it possible to set up something so a building event could detect whether it's connected to a road or near enough to a power/water source or something like that?
not that way, event's can't trigger other events.

what you can do is setup a parallel process that constantly checks for certain conditions and react to them.
but such an event will be timing-critical, and will require some work to get right if there are many conditions to check.
not that way, event's can't trigger other events.

what you can do is setup a parallel process that constantly checks for certain conditions and react to them.
but such an event will be timing-critical, and will require some work to get right if there are many conditions to check.
The one way I can think of to do it with a parallel process is with variables, so like an X and Y variable for a building and one for the road, but would that work with an event spawner of clones of the same event?
RMMV should not be your choice to create a Simcity clone. However, it is possible. As Andar mentioned, parallel processes can
1. get X/Y coordinates from an event A and an event B
2. calculate the distance
3. using Conditions
But, you plan it to do even more complex as you want to have roads or multiple power plants. So using eventing, this becomes practically impossible and you need to use JS.

In the end I recommend to switch to a different Engine.
RMMV should not be your choice to create a Simcity clone. However, it is possible. As Andar mentioned, parallel processes can
1. get X/Y coordinates from an event A and an event B
2. calculate the distance
3. using Conditions
But, you plan it to do even more complex as you want to have roads or multiple power plants. So using eventing, this becomes practically impossible and you need to use JS.

In the end I recommend to switch to a different Engine.
I'd originally planned to do something with regions and omit roads because I figured I could have conditions for if the building is in the same region as a power source. Was just wondering if there was any other ways and ways i might be able to include roads. Might there be any plugins that might be able to work?
Why would you need a parallel process constantly checking? If events are spawned in from another map, then something has triggered to spawn them in. Just make that something also check where those events are, in relation to other events, and do whatever it is you need to do (which you didn't state, so can't really expand on - if a building is near a road or a power source, then what?)
Why would you need a parallel process constantly checking? If events are spawned in from another map, then something has triggered to spawn them in. Just make that something also check where those events are, in relation to other events, and do whatever it is you need to do (which you didn't state, so can't really expand on - if a building is near a road or a power source, then what?)
It'd be something like buildings need to be connected to a road and have a power source nearby for populations to move into them, that sort of thing
I only can repeat myself. RMMV should not be your choice for SimCity. How should the roads be built by the Player? Are these events that are spawned each time the Player wants to build a road? Or are the roads drawn on the A-Layer of the Map?
Since the beginning of the RPG Maker it never supported spawning or deletion of events well. It is possible using plugins, but I have doubts with the complexity of a SimCity game. Then you would have many many events, which then decreased framerate.

To make a SimCity in RMMV you really must be good in JS itself and also know well the JS Source Code of a RMMV game.
@Bumblefish97 Awhile ago I built a rudimentary version of this (because I got the bright idea to let people build their own base in the menu). There's no world where this is going to be simple... Hope you're ready! :LZSexcite:👍

Let me get you started. You are going to want Galv's Event Spawner https://galvs-scripts.com/2016/05/14/mv-event-spawner/ as it's the only one that lets you spawn events on top of events out of the box. Plus a lot more light weight than the others.

Next you'll want Shaz's Tile Changer https://forums.rpgmakerweb.com/index.php?threads/tile-changer-copy-tiles-and-change-tiles.90437/

Place stuff like roads, power, etc on your tileset. Change the terrain tags for all the roads to 1, all the power to 2, etc. Then use the spawner to call an event that changes the tile ID to whatever the player is trying to build. Have the event unspawn after that. This will keep the CPU/RAM usage down.

Now use the spawner to call in events for your buildings, these events won't unspawn. Have them check for terrain tags 1 & 2. If it finds them flip a switch on the building to turn it on. Make these processes parallel so if it later finds the terrain tags missing to shut off.

Of course the downside to this approach is you only get 8 different types of terrain tags. Optionally you could also do it entirely with events, but that's going to take a lot more JS especially to combat the lag.
@Bumblefish97 Awhile ago I built a rudimentary version of this (because I got the bright idea to let people build their own base in the menu). There's no world where this is going to be simple... Hope you're ready! :LZSexcite:👍

Let me get you started. You are going to want Galv's Event Spawner https://galvs-scripts.com/2016/05/14/mv-event-spawner/ as it's the only one that lets you spawn events on top of events out of the box. Plus a lot more light weight than the others.

Next you'll want Shaz's Tile Changer https://forums.rpgmakerweb.com/index.php?threads/tile-changer-copy-tiles-and-change-tiles.90437/

Place stuff like roads, power, etc on your tileset. Change the terrain tags for all the roads to 1, all the power to 2, etc. Then use the spawner to call an event that changes the tile ID to whatever the player is trying to build. Have the event unspawn after that. This will keep the CPU/RAM usage down.

Now use the spawner to call in events for your buildings, these events won't unspawn. Have them check for terrain tags 1 & 2. If it finds them flip a switch on the building to turn it on. Make these processes parallel so if it later finds the terrain tags missing to shut off.

Of course the downside to this approach is you only get 8 different types of terrain tags. Optionally you could also do it entirely with events, but that's going to take a lot more JS especially to combat the lag.
I'll give it a go with terrain tags, would I be checking if it's on top of a terrain tag or in front of one?
I only can repeat myself. RMMV should not be your choice for SimCity. How should the roads be built by the Player? Are these events that are spawned each time the Player wants to build a road? Or are the roads drawn on the A-Layer of the Map?
Since the beginning of the RPG Maker it never supported spawning or deletion of events well. It is possible using plugins, but I have doubts with the complexity of a SimCity game. Then you would have many many events, which then decreased framerate.

To make a SimCity in RMMV you really must be good in JS itself and also know well the JS Source Code of a RMMV game.
The plan was to have road events spawned but then it seems like the tile swapper will be better
You'll be checking the spaces around the event to see if the terrain tags include what you want. Regrettably that's 8 checks, so you'll want to include a wait time so the events don't run too often.
You'll be checking the spaces around the event to see if the terrain tags include what you want. Regrettably that's 8 checks, so you'll want to include a wait time so the events don't run too often.
What would the process for that look like?
basically just a long list of control variable commands with the occasional get location info and conditional branch thrown in.

you use control variable to get the coordinates of the current event - the center position.
then you use control variable to re-calculate the coordinates for the surrounding eight positions (different +1 or -1 on x or y to get all eight positions.
then you use get location info on each and conditional branch to check what you found.

basically what you want is requiring a lot of mathematics and logic sequences to get it done, and there is no existing shortcut to handle that math for you.
So if you have problems with building logic sequences and coordinate mathematics and other things in that area, then I strongly suggest you look for a different engine that might be able to handle this for you.
This is infinitely easier (and just more efficient) in Javascript, but I'll assume you're just using the editor.... So I've attached one of the checks, just adjust the X/Y in it by 1/-1 for each direction. Or -1/-1 for upper left, etc. If your game uses only 4 directions the good news is you'll only need 4 total variants of setup in the example.

The others are very right though, if you want to go down the road of heavy event interaction, coding it in Javascript yourself will yield far better results. But hey, I never want to discourage someone dreaming, after all building all this stuff in the editor is how I got started. If I didn't do that, I never would have upgraded to my own scripts later. So dream big! And remember to enjoy the journey, because the destination is going to be quite a distance off. :LZSwink:
@ImaginaryVillain all parallel processes like that should always have a wait(5) or so at the end to reduce lag, even if done as a quick example - because otherwise the example might be copied and used without.

And that goes double for complex plans like the OP has, although the exact number of waits required is probably different depending on how complex the process gets.
I would have included that, but what you said is an opinion and not an accurate statement. After all, as an example one could simply shut off the parallel process after it runs, so such a wait wouldn't be necessary. Or a process could be checking for player input so the wait can prevent the event from noticing when the player hits the button if it's during that time.

My example is stated as incomplete so of course I'm not really concerned if someone copies it directly into their game. After they discover they are just checking left, they'll have to complete the rest of it anyway. Should OP use a wait? Probably, but they'll figure it out as their game requires.
Should OP use a wait? Probably, but they'll figure it out as their game requires.
to figure that out, they need to know that waits reduce the lag in case of parallel processes - which is not something you can know without it being pointed out to you.
And that is exactly why the wait should be in a parallel process, you can't always assume that the person using the example knows what he's doing (in fact I have seen a lot of people over the years who try to use event commands withough understanding them, and the results were sometimes ... unique)

Original thread: https://forums.rpgmakerweb.com/threads/events-react-to-other-events.119057/