Is it possible to store information about the unit/event which triggered an event?

A unit walks onto a square -- say a trap. It triggers an event, which then stores the data about the unit somewhere. How would I do something like this? Does such a place to store data exist? Variables are good for determining the coordinates of events, but not for the events themselves...

The end result would be EvilDude triggering an event, the event storing a reference to EvilDude, then being able to subtract 5 from EvilDude's number using that stored reference. Of course, if NiceNancy triggered the trap, it would subtract 5 from NiceNancy's number instead. End result being less clogged code & more dynamic events. But idk how to store references to events here..
If statements, and then they can set a variable value, which would correspond to the character who triggered it.
If this trigger is literally when an event steps onto it, as in they would share the same tile, you could use the call
$gameMap.eventsXy(x, y), where x and y are the coords for the trap.
The result is an array, with all events on that x, y location, which would be the trap and whoever stepped on it.

If you loop through the array and check each item's ._eventId prop to make sure it isn't the trap's event Id, you'd wind up with the actual event that triggered the trap.
Does that makes sense?

EDIT: If you wanted this to work with $gamePlayer as well, it would be easiest just to check for that first, when the trap is triggered. Simply checking if the $gamePlayer's x and y are equal to the traps would suffice.

The longer (but cleaner) and slightly more complex route would be to add a function to Game_Character so that $gamePlayer and Events would have the function on them.

Original thread: https://forums.rpgmakerweb.com/threads/is-it-possible-to-store-information-about-the-unit-event-which-triggered-an-event.127986/