Give an Event Hitpoints, just like a character?

Outside of SV battle, a character can take damage and die. What is a GOOD way to do that for NPCs and monster events while in a map scene?
NOTE: I've made my character swing his sword in the right direction when you hit the appropriate key, and I can get the event data of the monster that would be hit, so those parts are working. The 'damage' that would be dealt is calculated properly, as is the max HP of the target (based on monster type and level). I just need some way to track the current hp of an event with reasonable and forward-facing code.
Define a variable to have it increment, have it trigger a self-switch when variable is hits a certain number, then reset the variable if you wanna reuse it.
Makes sense. So, I would probably need an invisible event that finds the monster events and sets their HP dynamically. I was kinda hoping there was a more dynamic way to do it, but this should be sufficient for now. ty!
you can also add a plugin for self-variables if you have a lot of events
Ideally, I'd love to listen for a `player_transferred` event and run a method checking for monsters on the map he/she just moved to, and making those monster events a new property. Right now I just have an invisible event that runs once after the player arrives in the map.
Is there a reason why you don't want to just give the event a "hp" property? Or are you trying to do this without script calls or something?
I want to have the plugin give it that 'hp' or 'hp_current' property automatically when the player enters the map. I would rather not have lots of events with script calls, as that would confuse future users of the plugin.
Oh, you're making a plugin? Sorry, your initial post didn't really make it clear exactly what you're doing. It's a really simple matter in that case, so I thought maybe you were trying to do this all through eventing or something. If you're making a plugin, then just hook into one of the methods that deals with the creation of the events, and then assign the property there. For example:

JavaScript:
(function(alias) {
    Game_Map.prototype.setupEvents = function() {
        alias.call(this);

        for (const event of this._events.filter(event => !!event)) {
            event.hp = 500;
        }
    };
})(Game_Map.prototype.setupEvents);

That will make it so that when you enter a map, it will iterate through all events on the map and give them a hp property with an initial value of 500. Of course, you're probably going to want to pull the hp value from a note tag, or from some calculation or something, rather than assigning a flat value like I did in the example.

*edit* I should mention that I wrote that based on MZ's code base, because I already had it open in VS Code and didn't feel like switching. Pretty sure it won't matter in this case, but in the event that it doesn't work, that's probably why.
Ah, this answers so many questions. Ty!
Sorry for the double-post, but this actually spat out an error the moment I clicked "New Game". I must have an outdated plugin or something:
That shouldn't have anything to do with my code. When the error occurs, can you press F8 to open up the console, and post a picture of it? The stack trace might help us figure out what's going on.
Here's the stack trace

EDIT: I found the issue. It was this:
JavaScript:
// Game_Player.prototype.performTransfer = function() {
// };
I thought I had commented it out, but I just found that I hadn't...
Glad you got it figured out.

Original thread: https://forums.rpgmakerweb.com/threads/give-an-event-hitpoints-just-like-a-character.144029/