Is there an event self variable?

I know there are Self Switches ABCD. Is there a self variable? As in a variable that is tied directly to that event. Or some plugin that adds this function? Thanks!
The feature isn't present by default, you will need a plug-in for that. I'll move this to plug-in requests.
No, there is such think as Self-Variable for event, but there is a "workaround" of this problem. Not perfect of course, but works for my project.
In third tab of event place custom script:
Code:
this._myVariable = whatever you need

and using conditional branch -> script use this._myVariable.

I made that way unpredictible treasure chest.
https://prnt.sc/pv0r8j

But if you need it more complex then Yanfly has such plugin.
@Soulrender if you do it like that, it won't attach it to the event. You would have to do $gameMap.event(this._eventId)._myVariable.

The keyword this won't have the scope of the event in a regular script box without encapsulation.

However, in a move route's script box, you can say
this._myVariable
and it will attach it to the event.

You won't get an error doing it your way, but it isn't attaching it to the event.

If you were to type your script (I tested this just now) into a script box, on Event 3, launch the game and then check
$gameMap.event(3)._myVariable
in the console, it will be undefined.
@standardplayer You're right, but for small events, like mine and what he wants simply just do. Or Am I missing something else?
The thing is, in a regular script box, on an event, (event 5 for example), if you wrote
this._testVariable = 10;
It actually gets attached to the Game_Interpreter object.
However, if you did
$gameMap.event(this._eventId)._testVariable = 10;
then it would actually put it on that event. It's odd, and you can read up on it, but basically once you're inside of that $gameMap.event() call, in the parenthesis, the scope of this will change, and target the event itself.

You can test this by launching your playtest. If you open the console and type
$gameMap.event(5)._testVariable
It will only show 10 if you did it with the second call (the one I'm saying to use).

It's a little confusing, but there's another quirk.
If you're inside of an Event's code, and you do the event command Move Route, and open a script box from inside the move route commands, and type
this._testVariable = 10;
then the keyword this will target whatever event is in the dropdown menu for that moveroute (Player, This Event, or anything targeted in the drop down menu.

It's best not to just use plain old this inside of a regular script call box because, if not encapsulated, it will target the Game Interpreter. And depending on how you proceed, you may still wind up referencing it and getting the impression that you've attached something to the event. But it isn't safe, and you will eventually get unpredictable results.
Just to add: this._eventId is referencing an interpreter property, i.e. the ID of the currently-running event. The interpreter is a child of $gameMap, so gets saved and should be "safe" in that respect, but it's not readily usable as a self-variable sort of thing unless you want to go defining arrays and stuff. Also, like standardplayer says, it's much more intuitive to have "self" values on the events themselves. 🙂
What I meant by 'safe' was really 'reliable'. I guess I meant that, you don't want to do it thinking that it's attached to the event itself, because anytime outside of that event that you tried to target it and get to the property, it wouldn't be where you meant for it to be.
The thing is, in a regular script box, on an event, (event 5 for example), if you wrote
this._testVariable = 10;
It actually gets attached to the Game_Interpreter object.
However, if you did
$gameMap.event(this._eventId)._testVariable = 10;
then it would actually put it on that event. It's odd, and you can read up on it, but basically once you're inside of that $gameMap.event() call, in the parenthesis, the scope of this will change, and target the event itself.

You can test this by launching your playtest. If you open the console and type
$gameMap.event(5)._testVariable
It will only show 10 if you did it with the second call (the one I'm saying to use).

It's a little confusing, but there's another quirk.
If you're inside of an Event's code, and you do the event command Move Route, and open a script box from inside the move route commands, and type
this._testVariable = 10;
then the keyword this will target whatever event is in the dropdown menu for that moveroute (Player, This Event, or anything targeted in the drop down menu.

It's best not to just use plain old this inside of a regular script call box because, if not encapsulated, it will target the Game Interpreter. And depending on how you proceed, you may still wind up referencing it and getting the impression that you've attached something to the event. But it isn't safe, and you will eventually get unpredictable results.

This is perfect explanation for me, in the evening I made another fixes in my code 🙂

Original thread: https://forums.rpgmakerweb.com/threads/is-there-an-event-self-variable.115112/