-
Notifications
You must be signed in to change notification settings - Fork 0
Local switches and local variables
Local switches are not an RME's extension. However, like standard variables and switches, these last ones benefit a lightened syntax. As the Event Extender, RME provides local variables.
For some of you, this part might be a little more abstract, nevertheless we ensure you that local variables allows much more flexibility in the process of creating event systems.
A local variable look is practically identical as a global variable (standard variables in RPGMaker, gettable through V[ID]
), apart from the fact that they are referenced with 3 IDs instead of a single one:
- Map's ID
- Event's ID
- Variable's ID
The advantage lays in the fact that it is possible to create an event's local variable, specifying only the variable ID. The script will automatically assign it the two others ID. What's the benefit of local variables ? They avoid the creation of global variables for one event restricted use. It also allows you to copy/paste events (which use local variables) withouth having to change the variables that they use. On top of that, it considerably increase the amount of available variables. Personally, we use them to store results that we ONLY need in an event, or which are only related to a specific event. In addition, it is also possible to get local variables of another event, even an event which is in another map. In fact, these variables' adresses are purely virtual, therefore it is possible to access events' variables which do not exist.
Contrarywise to global (standard) variables, we use the following syntax: SV[map_id, event_id, id]
. SV
means Self Variables
.
As it has been stated in the previous paragraph, we are also able to only specify the variable's ID, RME will deduce the map's and event's id.
Let's imagine a map (n°23) where we can find many events such as the event n°4 which will use the following local variables:
-
SV[5]
: because it is the event n°4 of the map n°23 that call this event, this variable will be the variable:SV[23, 4, 5]
. -
SV[2, 8]
: here we want to get the variable n°8 of the event n°2 of the same map; so:SV[23, 2, 8]
-
SV[12, 3, 1]
: here all informations are specified, thus the we want to get the variable n°1 of the event n°3 which is located on the map n°12.
All operators introduced in the section about variables are compatible with local variables. For instance:
-
SV[5] += V[6]
: adds the value of the variable n°6 to the local variable n°5 (located in any event). -
SV[1,2,3], V[2] = V[2], SV[1,2,3]
: swaps the value of the local variable n°3 of the event n°2 (located in the map n°1) and the value of the variable n°2.
Beware!, use of ranges (
V[1...10]
, for instance) does not work with local variables.
A priori, local variables can handle everything the same way as standard variables do. However, we advise you to use them only as variable which are related to a single one event. For instance, ennemies' health points in an A-RPG, or reputation points that are specific to each event.
This time, it is not an added feature, but as for variables and switches, it is a syntaxic shortchut.
Local switches work the same as standard switches. The only difference lays in the fact that they are limited to 4. We can both access them via a letter (A
, B
, C
or D
) or via an integer (1
, 2
, 3
or 4
); matching the following: A
=1
, B
=2
, C
=3
and D
=4
. We use the SS
syntax to get a local switch (SS
means Self Switches
). For instance: SS["A"]
(A
must be inside double quotes(")) or SS[1]
. Its adressing system works exactly the same as local variables. Therefore, you can access local switches of other events.
As for local variables, logic operators and negation are compatible with local switches.
Both local variables and switches are pretty convenient, with them you can easily describe generic events and copy/past them without destroying the system's inner logic.
Introduction
Revised Syntax
- Switches and variables
- Local switches and local variables
- Tags and local tags
- Displaying informations in messages
Commands
Extended events
Advanced tools
RMEx use examples
- Create basic gauges
- Create gauges in battle
- Create easily a QuickTime Event
- A minimal multi-agents system
- Custom names typing system
- Titlescreen's skipper
Scripters corner