Author: Hakuen Studio
Introduction
Keeping track of a lot of different variables can let you more sensitive to making a mistake. That's why self variables come in handy!
It works like self switches, but you can use numbers instead of just true/false(ON/OFF). And just use one variable in a lot of events!
Features
- Add self variables to events.
- These self variables are persistent across the map.
- Can use plugin command to change the self variable of other events/maps.
- Integration with the default event commands!
- Work on the conditions tab of an event page.
Detailed tutorial on steam
Steam Community :: Guide :: Native Self Variables (MV & MV)
This guide will teach you how to use the Self Variable plugin from Hakuen Studio. The main difference of this self variable plugin to the others, is that this one is totally integrated with the event

steamcommunity.com
How to use
SpoilerAfter installing the plugin, the only thing you need to do is name a game variable like this:
SV: your variable name here.
It must start with "SV:" (It is case sensitive, so set the SV upper case).
Now, you have three ways to manipulate the self variable values:
♦ Script Calls ♦
● Getting self variable values:
- Current event -> this.selfVariableValue(varId) OR this.getSv(varId)
- Other events/map -> $gameVariables.selfValue([mapId, eventId, varId])
● Changing self variable values:
- Current event -> this.setSelfVariableValue(varId, value) OR this.setSv(varId, value)
- Other events/maps -> $gameVariables.setSelfValue([mapId, eventId, varId], value)
♦ Plugin Command(MZ only) ♦
You can change the self variables value using the plugin command.
NOTE¹: If you want to show the value of a self variable in a text like \v[id], you will need the Eli Escape Codes, where you set up an escape code of your choice to get their values. By default is \sv[id].
How to use the super integration feature
SpoilerThe super integration is a feature that lets you operate the self variables using the default event commands. In another word, using the editor.
♦ Default event command ♦
Self Variables are stored just like Self Switches. This means, that they mix Map Id, Event Id, and Variable Id to build a key that will hold the value of the self variable.
- MapId, EventId, VarId = value
So, if Event Id 6 of Map Id 114 has a Self Variable Id 2 with a value of 345, the game will save this like that:
So, with that in mind, if the variable has the "SV:" tag on their name, any event command that let you use a variable, will operate the self variable instead of the default game variable(Control Variable, Conditional Branch, etc.).
To do that, they will need a Variable Id, Map Id, and Event Id to access a Self Variable value.
The Var Id will get from the event command itself, by the user.
The Map Id and Event Id will be automatically got by the plugin and combined to find the value of a self variable.
But if in case you want to check the value of a self variable of another event? Or even in another map?
Then you must set a variable id into the Target Variables located on the plugin parameter.
These Target Variables will let you change the Event Id and Map Id that was being set automatically when you use the event commands.
You just need to change their values to something above 0 and they will set a Target Map Id and Event Id.
Set their value to 0 if you want to restore the normal behavior.
* They also must be set as Self Variables.
They will work on any event command that uses variables!
Terms of Use
Update Log
Hakuen Studio Self Variables for RPG Maker MZ by Hakuen Studio
Fully integrated Self Variables with the default event commands!
hakuenstudio.itch.io
本贴来自国际rpgmaker官方论坛作者:Eliaquim处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/eli-self-variables-set-self-variables-to-events-and-use-it-anywhere.133231/