(01-14-2013, 01:52 AM)Kiandra Wrote: Is it possible to have an action on one map, let's say pulling a lever is the action, effect another map, opening a secret door?
Yes, and it's actually quite simple: all you need to do is set a global variable in one map, and check it's value in another.
These are the (predefined) script functions that you need to use:
void SetGlobalVarInt(string& varName, int value);
int GetGlobalVarInt(string& varName);
Basically, in map1, inside your lever-callback simply check the position of the lever, and encode that position in a global variable using the SetGlobalVarInt() function. (Global variables are visible across maps.)
void OnLeverStateChanged(string &in entityID, int state)
{
// The state parameter indicates the position of the lever;
// it can be -1 = off, 0 = between, 1 = on
SetGlobalVarInt("lever.map1", state); // just pass the 'state' parameter along
}
Note: "lever.map1" just identifies the global variable, you can replace it with anything you want.
Then, in map2, you inside check he variable's value inside the OnEnter() function:
void OnEnter()
{
if(GetGlobalVarInt("lever.map1") == 1) // remember, 1 means "on"
{
// put the code to unlock/open the door (or whatever) here
}
// the rest of the OnEnter() code goes here
}