Frictional Games Forum
"SetGlobalVarInt" Problem - Printable Version

+- Frictional Games Forum (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: "SetGlobalVarInt" Problem (/thread-17910.html)



"SetGlobalVarInt" Problem - bjaffedj - 08-22-2012

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);    
}
}



RE: "SetGlobalVarInt" Problem - shadowZgamerZ - 08-22-2012

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!


RE: "SetGlobalVarInt" Problem - bjaffedj - 08-22-2012

THANK YOU SO MUCH! i see now that im a idot -.-