Hello
I have this script on a map where I want two leaders to add 1 and 7 to a local int, when int is 8 a Swing door should unlock.
But instead I just get the error "Unexpected token "{"" when I try to launch the game map.
Here is the script:
Code:
void AddLocalVarInt(string& Unlock, int alVal);
{
if(GetLocalVarInt("Unlock")==8)
{
SetLevelSwingDoorLocked(mansion_1, false);
}
}
void OnLeverStateChange(string &in Lever1, int alState)
{
AddDebugMessage(Lever1 + "'s current state: " + alState, false);
if (alState == -1)
{
AddLocalVarInt("Unlock", 1);
}
}
Thank you for your help
(05-26-2011, 08:11 PM)dasde Wrote: [ -> ]Hello
I have this script on a map where I want two leaders to add 1 and 7 to a local int, when int is 8 a Swing door should unlock.
But instead I just get the error "Unexpected token "{"" when I try to launch the game map.
Here is the script:
Code:
void AddLocalVarInt(string& Unlock, int alVal);
{
if(GetLocalVarInt("Unlock")==8)
{
SetLevelSwingDoorLocked(mansion_1, false);
}
}
void OnLeverStateChange(string &in Lever1, int alState)
{
AddDebugMessage(Lever1 + "'s current state: " + alState, false);
if (alState == -1)
{
AddLocalVarInt("Unlock", 1);
}
}
Thank you for your help
At the "void AddLocalVarInt(string& Unlock, int alVal);" There shouldnt be a ; at the end.
Okay, now I get this error: (see attachment)
Here is the full script:
Code:
//===========================================
// Starter's Script File!
//===========================================
//===========================================
// This runs when the map first starts
void OnStart()
{
}
//===========================================
// This runs when the player enters the map
void OnEnter()
{
}
//===========================================
// This runs when the player leaves the map
void OnLeave()
{
}
//===========================================
// Areas
////////////////////////////////////////
//UNLOCK START SWINGDOOR
void AddLocalVarInt(string& UnlockDoor, int alVal)
{
if(GetLocalVarInt("UnlockDoor")==8)
{
SetLevelSwingDoorLocked(mansion_1, false);
}
}
void OnLeverStateChange(string &in Lever1, int alState)
{
AddDebugMessage(Lever1 + "'s current state: " + alState, false);
if (alState == -1)
{
AddLocalVarInt("UnlockDoor", 1);
}
}
void OnLeverStateChange(string &in Lever7, int alState)
{
AddDebugMessage(Lever7 + "'s current state: " + alState, false);
if (alState == -1)
{
AddLocalVarInt("UnlockDoor", 7);
}
}
hmm.. i dont know alot with the whole "if" thing but when it says mansion_1 is not declared it means it needs "". Like this SetLevelSwingDoorLocked("mansion_1", false);
Fixed it by myself.
This is my script for future googlers:
Code:
void OnLeverStateChange(string &in Lever1, int alState)
{
if (alState == -1)
{
AddLocalVarInt("Var01", 1);
}
}
void OnLeverStateChange1(string &in Lever7, int alState)
{
if (alState == -1)
{
AddLocalVarInt("Var01", 7);
}
}