Frictional Games Forum

Full Version: "SetGlobalVarInt" Problem
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
okay i have a huge problem with "SetGlobalVarInt".
i heard that it could cause problems to use "AddGlobalVarInt", so i just use Set.

each time i run the custom story, it gives me an error that says, "LanternInt is not declared"


please help, since i don't know what to do anymore.

the code(left out unneccesarys):


Code:
void OnStart()
{
SetGlobalVarInt("LanternInt", 0);
}

void OnEnter()
{
if(GetGlobalVarInt(LanternInt) == 0)    
{    
SetLevelDoorLocked("level_dungeon_1", true);
}

if(GetGlobalVarInt(LanternInt) == 1)
{    
SetLevelDoorLocked("level_dungeon_1", false);    
}
}
Try this:

void OnStart()
{
SetGlobalVarInt("LanternInt", 0);
}

void OnEnter()
{
if (GetGlobalVarInt("LanternInt") == 0)
{
SetLevelDoorLocked("level_dungeon_1", true);
}

if (GetGlobalVarInt("LanternInt") == 1)
{
SetLevelDoorLocked("level_dungeon_1", false);
}
//Watch out for these ones: ""
}

- I hope i didn't spell something wrong, because I am writing this on my phone! Hope this helped!
THANK YOU SO MUCH! i see now that im a idot -.-