|
Creating the Local Variables
Let's say you wish to spawn a money crate on a map when both of 2 pre-placed buildings are destroyed. For the purpose of
this example we'll make both of these building Tesla Coils. The idea is, the crate won't appear until both Tesla Coils are
destroyed - we don't want a crate to appear if only one is destroyed.
First things first: Create the local variables. In Final Alert2, with the map loaded, go to the Edit menu and click
Local variables (Locals). A small dialog will open. Type a description of your first variable in the
Description field - in this case, let's call it "Coil 1 Destroyed".
Now you should set the Preset value for this local. As mentioned in the introduction, locals are flags that are
either "set" (on) or "cleared" (off). In this dialog you can preset the local to be on or off when the
map first loads. A value of 0 is a cleared local, and a value of 1 is a set local. In this case, let's give
the local a preset value of 0, since when the map loads, the building won't be destroyed yet.
The drop-down selection field on this dialog should now display: 0 Coil 1 Destroyed,0. The first zero
refers to the number of this local on the map's [VariableNames] list, and the second number indicates that this local starts
off cleared.
Repeat for the second local variable you must create. Choose 1 No Name from the drop-down list, and enter
"Coil 2 Destroyed" in the Description field, and again give this local a Preset value of
"0". When done the drop-down selection field should display 1 Coil 2 Destroyed,0.
Suppose you screwed up the creation of your locals and you want to delete them? Sadly there is no way to delete unwanted
local variables in Final Alert2. Unused locals will do no harm, so you could just leave them there, but if you prefer to
clean up unneeded stuff, then you can delete local variables manually, by editing your map in a text editor. Locals are
listed in the map under the [VariableNames] section. If you have created your locals exactly as described above, your
[VariableNames] section should look like this:
[VariableNames]
0=Coil 1 Destroyed,0
1=Coil 1 Destroyed,0
As you can see the format is very simple, using the typical numbered list which starts with 0, as is used by many other
lists in the RA2/YR games. The description can be anything and really doesn't matter to the game at all. The final number
after the comma is always either 0 or 1 and determines whether the local is set or clear. Manual editing is therefore very
easy should you wish to manage your locals by text editing instead.
Now let's move on to setting up the triggers so we can put these variables to work.
|