The following warnings occurred:
Warning [2] count(): Parameter must be an array or an object that implements Countable - Line: 906 - File: showthread.php PHP 7.2.24-0ubuntu0.18.04.17 (Linux)
File Line Function
/showthread.php 906 errorHandler->error



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


Messages In This Thread
Unexpected token 'if' - by Redneb27 - 07-20-2012, 06:24 AM
RE: Unexpected token 'if' - by Your Computer - 07-20-2012, 06:34 AM



Users browsing this thread: 1 Guest(s)