Say you have a lever in level 2 that opens a door in level 1.
Level 1:
Quote: In the OnEnter() function, check your global variable with an if-else statement to see if it has changed from it's initial value.
void OnEnter()
{
CheckPoint("WaveChpt", "PlayerStartArea_FromLevel2", "ResetWave", "", "");
AddTimer("SanityTimer", 0.5f, "UpdateSanity"); //Set up a timer on entry.
int temp = GetGlobalVarInt("lockdown");
if(temp == 1)
{
AddEntityCollideCallback("Player", "ScriptArea_FinalWave", "FinalWave", true, 1);
AddTimer("TriggerBrute2", 4.0f, "SpawnBrute");
}
}
Now, in level 2, set the lever to change the global variable from 0 to 1.
void StopLockdown(string &in asEntity, int alState)
{
if(alState <= -0.9)
{
PlaySoundAtEntity("", "unlock_door.snt", "Player", 0, false);
StartScreenShake(0.1f, 6.0f, 1.0f, 1.4f);
PlaySoundAtEntity("", "21_alex_low_freq_rumble2.snt", "Player", 0, false);
SetMessage("Messages", "SwitchMessage", 9);
SetGlobalVarInt("lockdown", 1);
}
}
(Ripped this straight from one of my CSs, so sorry about the extra code
)