serbusfish
Member
Posts: 211
Threads: 75
Joined: Aug 2012
Reputation:
0
|
RE: SetGlobalVarInt not working
(07-03-2016, 10:50 PM)Darkfire Wrote: (snip)
It has to be a global variant as it taking place is across multiple maps, otherwise I would have stuck with the local as I have successfully used it in the past.
Anyway, I discovered 2 flaws with my original script which I fixed, 1) in my 'if' part of the script I had Local instead of Global, and 2) I realised if the command 'SetGlobalVarInt("DRDoor",0);' was in the OnStart section it would reset to 0 every time the map was loaded, so I put it inside one of my collide callbacks instead.
So I fixed these issues but it STILL wont work! This is really frustrating as I actually thought i'd cracked it. Can anyone see what is wrong now? Just for clarity this is what I now have:
map 1#:
Quote:void OnStart()
{
CheckDRDoor();
AddEntityCollideCallback("Player", "ScriptArea_1", "Creak", true, 1);
}
void CheckDRDoor()
{
if(GetGlobalVarInt("DRDoor") == 1)
{
SetLevelDoorLocked("level_wood_2", false);
}
}
void Creak(string &in asParent, string &in asChild, int alState)
{
PlaySoundAtEntity("", "afx_mans_hallquake_postdetail.snt", "ScriptArea_4", 0, false);
StartScreenShake(0.02f, 4.0f, 1.5f, 3.0f);
SetGlobalVarInt("DRDoor",0);
CreateParticleSystemAtEntity("", "ps_dust_falling_mansion_quake_landing.ps", "AreaDust_1", false);
CreateParticleSystemAtEntity("", "ps_dust_falling_mansion_quake_landing.ps", "AreaDust_2", false);
CreateParticleSystemAtEntity("", "ps_dust_falling_mansion_quake_landing.ps", "AreaDust_3", false);
CreateParticleSystemAtEntity("", "ps_dust_falling_mansion_quake_landing.ps", "AreaDust_4", false);
}
map #2:
Quote:void OnStart()
{
SetEntityPlayerInteractCallback("ExamineArea_1", "UnlockDoor", true);
}
void UnlockDoor(string &in asEntity)
{
SetMessage("Messages", "DoorNowUnlocked", 3);
PlaySoundAtEntity("", "lock_door.snt", "level_wood_5", 0, false);
SetEntityActive("ExamineArea_1", false);
AddGlobalVarInt("DRDoor", 1);
}
(This post was last modified: 07-04-2016, 10:14 AM by serbusfish.)
|
|