Trying to check if the event under the player has been erased?

I am using the following plugins for this:
Galv's event spawner
Eli's (Hakuen) button common event caller

The player can hit 'c' to spawn an ice bridge on areas of region ID 33 (water).
These bridges slowly decay.

What I want, is if the player is standing on an ice bridge section when it vanishes, for them to 'drown'.


I've tried the event itself causing this - but since the bridges are parallel events, and spawned en-masse, I'm not sure how to store the event's variables VS the player location to check they're standing on it (since there are many duplicate events!).

My next try was to have a parallel common event 'falling' which checks if the player is standing on region 33 and not on an event to trigger the fall. This works great if I walk into the water, but it seems that even after my summoned bridge events "erase event" that the player is still considered to be standing on an event somehow. Worse, this is for any area that a bridge was ever spawned on.


Player standing on an erased bridge event scott-free! Madness!


It works just fine if there was never an event spawned there. 10/10 drowning.

Spoiler: Screenshots

The common event for drowning.



Event pages 1 and 2 for my ice bridges.

The lovely tileset was made by Jamie Brownhill, character from Franuka's heroes.
Ignore all the other strange art - It's 99% placeholders atm as I want to get the mechanics down first.

If anyone has any suggestions, I'd be forever grateful! Thank you!!
Hmmm, I don't think the "erase event" command erases the event in a way that it would completely vanish (like not give location info)? That is why your common event if-branch is never true if there has been a bridge in some location. Not 100% sure though.

EDIT:

Can you use that plugin to "spawn away" the bridge after it expires, or maybe just use transfer event to move the empty event to some out of reach tile. I guess your events would work then.
your problem is most likely the wrong javascript - your code should have worked with the event commands (get location info for event id), but a comparison in javascript should be done with triple equal, not double.

x === 0
Also rpgLord69 is right, 'erase event' only removes the event until the next time you load the map and then it runs again. That may be what you want to happen, but just in case it's not I thought I'd mention it.
@rpgLord69 is correct, the erase event command is only while you are on the same map, as soon as you leave and re-enter the event comes back.
your problem is most likely the wrong javascript - your code should have worked with the event commands (get location info for event id), but a comparison in javascript should be done with triple equal, not double.

x === 0
That's not accurate - JavaScript equality can be double or triple signs. And for all situations I can think of in RPG Maker, the triple is unnecessary (it doesn't hurt anything, but it's not more correct).
@Kes @Ahuramazda

I didn't mean about leaving and entering again. I mean that the 'erase event' command doesn't fully erase the event even if you stay in the same map (unless I'm misunderstanding something). I just tested it (well in MV, but whatever), and it's getting the ID of the event even after I use 'erase event'. I need to transfer the erased event elsewhere after erasing it, if I want the coordinates to return a 0 for event ID.
I didn't mean about leaving and entering again. I mean that the 'erase event' command doesn't fully erase the event even if you stay in the same map (unless I'm misunderstanding something). I just tested it (well in MV, but whatever), and it's getting the ID of the event even after I use 'erase event'. I need to transfer the erased event elsewhere after erasing it, if I want the coordinates to return a 0 for event ID.
Yeah, I did think about that as a potential solution but I was hoping there was a more elegant way about it I'd missed! How are 'falling platforms' usually implemented??
I'm not great at scripting but I was wondering if the falling platforms could know their own location.
Something like"if player(x,y) == this.event(x,y)?? and trigger the death then.
when I get home I might experiment with $game_map.events[@event_id] to see what the summoned event ID is and if I can do it that way....!

Sadly it doesn't look like I can use Hakuen's moving platform plugin due to it and GALV's stuff not playing nice, which is a shame, as that would help here! X'D

I'll try moving the events elsewhere when they expire and hopefully that doesn't cause too many issues...! Thanks all for your input! Always appreciated. 😀
and it's getting the ID of the event even after I use 'erase event'.
does this also happen if you don't use the script but go through the get location info command?

In my experience the event commands include filters and checkups that are ignored and missing when using the direct script commands.
so it might work if you don't use the scripts but go by the event commands.
does this also happen if you don't use the script but go through the get location info command?
I was curious about this question and looked into the source code. Yes, the Event Command is 1:1 the same as using "$gameMap.eventIdXy(x, y)", therefore you hit an Event even if it has been erased before.
@Kay_Erthisia

Does it work if you make the bridges parallel events and after they expire use this conditional:

$gameMap.event(this._eventId).x === $gamePlayer.x && $gameMap.event(this._eventId).y === $gamePlayer.y
If these are spawned events then you should really be despawning them, not erasing them.

From Galv's plugin's help section:

Galv.SPAWN.clear(mapId); // Remove normal spawned events from map Galv.SPAWN.clear(mapId,true); // Remove ALL spawned events inc. saved // Make MapId = 0 to clear current map Galv.SPAWN.unspawn(this); // Unspawns event code is executed in.
So you could try replacing each bridge's Erase Event with a Script: Galv.SPAWN.unspawn(this);.
Does it work if you make the bridges parallel events and after they expire use this conditional:

$gameMap.event(this._eventId).x === $gamePlayer.x && $gameMap.event(this._eventId).y === $gamePlayer.y
I can confirm this works!

Spoiler: Image
solution.PNG

If these are spawned events then you should really be despawning them, not erasing them.

From Galv's plugin's help section:

Galv.SPAWN.clear(mapId); // Remove normal spawned events from map Galv.SPAWN.clear(mapId,true); // Remove ALL spawned events inc. saved // Make MapId = 0 to clear current map Galv.SPAWN.unspawn(this); // Unspawns event code is executed in.

So you could try replacing each bridge's Erase Event with a Script: Galv.SPAWN.unspawn(this);.
I can confirm this also works!! And also derp I did read this but somehow assumed it would function the same as the 'erase event' command (just on a wider scale for all the events spawned..!) Thank you for correcting me!! 😮

I have decided to use both solutions in my setup - despawning instead of erasing is likely much better for performance, and since each bridge is its own parallel event for their despawning anyway, it would make sense to put the check for player location on them - which means I can use one less parallel common event.
Thank you all!!

Thank you all for the fantastic help! Seriously you're the best <3
As a little extra explanation:
  • Erasing an event basically sets it to a blank event page: it'll disappear visually and (in most ways) interactively until the player leaves and revisits its map.

  • By contrast, a spawned event is extra game data created mid-playthrough. Despawning removes that extra data, so there is nothing left to erase: it is literally gone at that point.
Good to hear you got it working! Happy RPG Making~

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/trying-to-check-if-the-event-under-the-player-has-been-erased.149576/