Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Unexpected token 'if'
Redneb27 Offline
Junior Member

Posts: 10
Threads: 4
Joined: Jul 2012
Reputation: 0
#1
Unexpected token 'if'

If this is answered somewhere else, I'm sorry. I looked for hours. Really. I can't for the life of me figure out what is wrong. I tried to add an intro sequence, and i pretty much copied this one -
http://wiki.frictionalgames.com/hpl2/tut.../sequences- and now I have an unexpected token 'if' error.


////////////////////////////
// Run when entering map
void OnEnter()
{
SetLocalVarInt("iIntroPart", 0);
AddTimer("tmrIntro", 1.0f, "introSequence");
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
SetEntityConnectionStateChangeCallback("lever_simple01_1", "UnlockDoor");
SetEntityPlayerInteractCallback("key_2", "ActivateMonster", true);
AddEntityCollideCallback("Player", "Brute_Moan", "ScarePlayer", true, 1);
SetLevelDoorLocked("level_wood_1", true);
AddUseItemCallback("", "key_2", "level_wood_1", "UsedKeyOnDoor2", true);
}

void UsedKeyOnDoor(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("door_1", false, true);
AddUseItemCallback("", "key_1", "door_1", "UsedKeyOnDoor", true);
RemoveItem("key_1");
}

void introSequence(string &in asTimer)
{
AddLocalVarInt("iIntroPart", 1);
float partSpeed = 1.5f;
switch (GetLocalVarInt("iIntroPart"));
{
case 1:
partSpeed = 21.0f;
FadeOut (0.0f);
FadePlayerRollTo(50, 220, 220);
FadeIn(20,0f);
break;
case 2:
partSpeed = 10. 0f;
FadePlayerRollTo(0.0f, 33.0f, 33.0f);
break;
}
}

if (GetLocalVarInt ("iIntroPart") <2)
{
AddTimer("tmrIntro", partSpeed, "introSequence");
}

void ScarePlayer(string &in asParent, string &in asChild, int alState)
{
PlayMusic("enabled01.ogg", false, 0.6, 2, 1, true);

}

void ActivateMonster(string &in asEntity)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_8", 4, "");
}


void UnlockDoor(string &in asEntity, int level_state)
{
if (level_state == -1)
{
SetSwingDoorLocked("door_2", false, true);
PlaySoundAtEntity("", "unlock_door", "lever_simple01_1", 0, false);
}

}
////////////////////////////
// Run when leaving map
void OnLeave()
{

}
07-20-2012, 06:24 AM
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
RE: Unexpected token 'if'

The following is out of place:
if (GetLocalVarInt ("iIntroPart") <2)
{
AddTimer("tmrIntro", partSpeed, "introSequence");
}

It needs to be inside a function body.

Tutorials: From Noob to Pro
07-20-2012, 06:34 AM
Website Find




Users browsing this thread: 1 Guest(s)