Hi, I'm new here, I'm searching for some help with an event using MZ.
I'm eventing a projectile (fired by the player) that trigger a barrel that explode.
the explosion can damage the player (if he's near) or completely kill an enemy.
I have a problem only with the barrel/bomb: I need to check the nearby area and damage the player or/and trigger the self swith "D" of all the events in the nearby area.
For now I set it like that:
-I have the barrel (event1) that is triggered using a projectile that turns his self switch A "on".
On the second page of event 1 (parallel), it needs to check near itself:
-when there is the player nearby it damages the hero (-xx HP)
-when there is an event (eg. an enemy) it needs to trigger the nearby event's self switch "D" to "on"
-when there is anything the bomb only do an explosion.
The barrel then, self switch B On and "erase" itself
So far I only managed to do it for a specific enemy (knowing the correct event id n'5).
But I need it to work with a common event so I can use it with different enemies/events without tracing with variables all the enemies data.
I need a way to get the nearby ID of the events in the area and put it in the "selfswitches.setValue" formula.
for the player damage I think I'll use the hero x and y variables to track him but first I want to fix the enemy part.
I also tried that approach in the barrel page(parallel):
--------------------------------
for a in (2..50)
if $gameMap.events[a] != nil
if ($gameMap.events[a].x - $gameMap.events(this.eventId).x).abs +
($gameMap.events[a].y - $gameMap.events(this.eventId).y).abs <= 1
$game_self_switches[[this._mapId, a, 'D']] = true
end ; end
end
--------------------------------
but I couldn't figure it out
I checked those threads:
forums.rpgmakerweb.com
forums.rpgmakerweb.com
forums.rpgmakerweb.com
and that's was really promising:
forums.rpgmakerweb.com
I'm not really good with script and English isn't my main language so, have mercy!
I'm eventing a projectile (fired by the player) that trigger a barrel that explode.
the explosion can damage the player (if he's near) or completely kill an enemy.
I have a problem only with the barrel/bomb: I need to check the nearby area and damage the player or/and trigger the self swith "D" of all the events in the nearby area.
For now I set it like that:
-I have the barrel (event1) that is triggered using a projectile that turns his self switch A "on".
On the second page of event 1 (parallel), it needs to check near itself:
-when there is the player nearby it damages the hero (-xx HP)
-when there is an event (eg. an enemy) it needs to trigger the nearby event's self switch "D" to "on"
-when there is anything the bomb only do an explosion.
The barrel then, self switch B On and "erase" itself
So far I only managed to do it for a specific enemy (knowing the correct event id n'5).
But I need it to work with a common event so I can use it with different enemies/events without tracing with variables all the enemies data.
I need a way to get the nearby ID of the events in the area and put it in the "selfswitches.setValue" formula.
for the player damage I think I'll use the hero x and y variables to track him but first I want to fix the enemy part.
I also tried that approach in the barrel page(parallel):
--------------------------------
for a in (2..50)
if $gameMap.events[a] != nil
if ($gameMap.events[a].x - $gameMap.events(this.eventId).x).abs +
($gameMap.events[a].y - $gameMap.events(this.eventId).y).abs <= 1
$game_self_switches[[this._mapId, a, 'D']] = true
end ; end
end
--------------------------------
but I couldn't figure it out

I checked those threads:
Event ID of Nearest Event to Player (RMMV)
I'm wondering if anyone knows of a way to get the event ID of the nearest event to the player in RPG Maker MV? I have been searching various forums for a while now and can't find anything for MV, only VX and Ace. I need to be able to store an event's ID in a variable for whichever event is...
forums.rpgmakerweb.com
Event ID from location.
Is there a way to check an X/Y location, determine if there's an event present there, and if so, what it's ID is? I imagine if it's possible it'll require either a script or possibly even a plugin, but first things, first, is it even possible?
forums.rpgmakerweb.com
Any way to affect the self-switch of a neighbouring event?
Hey everyone, I came up with a nice ''furniture'' system for my IGMC entry and it's going to be one of the key mechanics in the game. That said, it's just affecting the one tile the player aims at, is there some way to have the event ''check'' for the event above it and set the self-switch of...
forums.rpgmakerweb.com
and that's was really promising:
Is there any way to check and see if other events are around?
I have monster events that chase you in order to start a battle. I also have crystals to heal you, and reset the monsters locations. I was curious if It was possible to have a conditional branch check to make sure that my monster events are a certain distance away from my crystal event. If...
forums.rpgmakerweb.com
I'm not really good with script and English isn't my main language so, have mercy!