Using event ID in event

In my enemy ABS event that I am prototyping I have had to hard code the event ID in a couple of places and I am looking to try to make this more generic now.


As an example, (and this is for EV002) I have used $gameMap.event(2).


Is there some way I can use a function to get my event ID. I tried $this but it doesn't work.


Similarly I am trying to keep a control variable to store this enemys HP. For now I have just hardcoded it to Control Variable #0002 but again I would like to base this variable on the event ID using a function/script.


Thanks for any ideas!
To be certain, you would need to provide the exact context (what command are you using that in?  A screenshot would be perfect).


If it's inside an event command like Control Variables, Conditional Branch, or Script, you could use this._eventId or this.eventId() to get the id of the current event.  If you want the current event itself (which is what you'd get if you did $gameMap.event(this.eventId()), you can just use this.character(0) instead.  0 always means "this event".


If the event command is a Move Route, you would use this._eventId or this.eventId() instead, to get the id, or just this to get the event itself.
This is working for me thanks!
Ignore - wrong thread

Original thread: https://forums.rpgmakerweb.com/threads/using-event-id-in-event.71477/