Frictional Games Forum (read-only)
Unexpected end of file - Printable Version

+- Frictional Games Forum (read-only) (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: Unexpected end of file (/thread-16343.html)

Pages: 1 2


Unexpected end of file - drunkmonk - 06-20-2012

Hi, I have been working on my first custom story for a little while now and I just came across an error that says "main (221, 2) :ERR: unexpected end of file. Can anyone one tell me what the problem is?

This is what I have for my script

void OnStart()
{
SetEntityConnectionStateChangeCallback("secret_lever", "Open_Secret_Door");
SetEntityConnectionStateChangeCallback("secret_lever_2", "Close_Secret_Door");
SetEntityPlayerInteractCallback("Discoveries", "Brute_Spawn", true);
SetEntityPlayerInteractCallback("Locked_Door", "LockedDoor", false);
PlayMusic("07_amb.ogg", true, 2, 10, 0, true);
CheckPoint("check01", "PlayerStartArea_2", "CheckPoint01", "", "");
AddEntityPlayerInteractCallback("Key_Upper_Levels", "monsterscare", true);
}
void CheckPoint01(string &in asName, int alCount)
{
SetPlayerHealth(RandFloat(80, 95));
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 1, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 3, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEntityCollideCallback("servant_brute_1", "MonsterOpenDoorArea", "Monster_Open_Door", true, 1);
SetEntityPlayerInteractCallback("door_barricade_1", "CloseDoor", true);
AddQuest("SecretDoor", "SecretDoor");
ResetProp("Locked_Door");
ResetProp("castle_5");
}
void LockedDoor(string &in Entity)
{
SetMessage("Messages", "Locked", 0);
}
void Brute_Spawn(string &in asEntity)
{
SetEntityActive("servant_brute_1", true);
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_1", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_2", 1, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_3", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_4", 3, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_5", 0, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_6", 0, "");
AddEntityCollideCallback("servant_brute_1", "MonsterOpenDoorArea", "Monster_Open_Door", true, 1);
SetEntityPlayerInteractCallback("door_barricade_1", "CloseDoor", true);
AddQuest("SecretDoor", "SecretDoor");
}
void Monster_Open_Door(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("castle_5", false, false);
SetSwingDoorDisableAutoClose("castle_5", true);
AddPropForce("castle_5", 70.0f, 0, 0, "World");
AddTimer("", 2.0, "New_Path");
}
void New_Path(string &in asTimer)
{
ClearEnemyPatrolNodes("servant_brute_1");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_7", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_8", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_9", 2, "");
AddEnemyPatrolNode("servant_brute_1", "PathNodeArea_10", 2, "");
}
void Open_Secret_Door(string &in Entity, int level_state)
{
if (level_state ==1)
{
SetMoveObjectState("shelf_secret_door_rot_1", 1.0f);
SetMoveObjectState("secret_door", 1.0f);
return;
}
}
void Close_Secret_Door(string &in Entity, int level_state)
{
if (level_state ==1)
{
SetMoveObjectState("shelf_secret_door_rot_1", 0.0f);
SetMoveObjectState("secret_door", 0.0f);
SetMoveObjectState("secret_door_2", 1.0f);
CompleteQuest("SecretDoor", "SecretDoor");
GiveSanityBoostSmall();
return;
}
}
void CloseDoor(string &in asEntity)
{
SetSwingDoorClosed("castle_5", true, true);
SetSwingDoorLocked("castle_5", true, false);
AddTimer("", 0.5f, "Timer_CloseBarricade");
}
void Timer_CloseBarricade(string &in asTimer)
{
SetSwingDoorClosed("door_barricade_1", true, true);
AddTimer("", 0.5f, "Timer_LockBarricade");
}
void Timer_LockBarricade(string &in asTimer)
{
SetEntityActive("door_barricade_1", false);
SetEntityActive("door_barricade_locked_1", true);
PlaySoundAtEntity("", "lock_door.snt", "Area_BarricadeLockDust", 0.0f, false);
CreateParticleSystemAtEntity("", "ps_hit_dirt.ps", "Area_BarricadeLockDust", false);
CreateParticleSystemAtEntity("", "ps_hit_metal.ps", "Area_BarricadeLockDust", false);
AddEntityCollideCallback("Player", "MonsterActive", "Give_Up", false, 0);
SetLocalVarInt("BruteInRoom", 1);
}
void Give_Up(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("BruteInRoom") != 1) return;
if(alState == 1)

StartBangDoorEvent();
else
StopBangDoorEvent();

}
void StartBangDoorEvent()
{
SetEntityActive("servant_brute_1", false);
AddTimer("BangDoor", RandFloat(1.0, 2.0f), "BangDoor");
}
void StopBangDoorEvent()
{
RemoveTimer("BangDoor");
SetLocalVarInt("BangDoor", 0);
if(GetLocalVarInt("Stop") == 2)
{
SetEntityActive("MonsterActive", false);
}

}
void BangDoor(string &in asTimer)
{
string sEvent =asTimer;
AddLocalVarInt(sEvent, 1);
bool bPauseAtStep = false;
float fEventSpeed = 0.5f;
switch(GetLocalVarInt(sEvent))
{
case 1:
BangOnDoorEffects("brute", "brute/notice.snt", false);
break;
case 2:
BangOnDoorEffects("bang2", "lurker_hit_wood.snt", true);
fEventSpeed = RandFloat(0.2f, 0.8f);
break;

case 3:
BangOnDoorEffects("bang3", "lurker_hit_wood.snt", true);
fEventSpeed = RandFloat(0.2f, 0.8f);
break;
case 4:
BangOnDoorEffects("bang4", "lurker_hit_wood.snt", true);
AddLocalVarInt("Stop", 1);
if(GetLocalVarInt("Stop") == 2)
StopBangDoorEvent();
break;
default:
bPauseAtStep = true;
break;
}
if(!bPauseAtStep) AddTimer(sEvent, fEventSpeed, sEvent);
}
void BangOnDoorEffects(string &in sName, string &in sSound, bool bParticle)
{
PlaySoundAtEntity(sName, sSound, "castle_5", 0.0f, false);
if(bParticle)
CreateParticleSystemAtEntity("ps"+sName, "ps_hit_wood.ps", "castle_5", false);
}
void monsterscare(string &in asEntity)
{
AddEntityCollideCallback("Player", "monsterscarearea", "monsterscare2" true, 1);
SetSwingDoorClosed("castle_arched02", false, false);
SetSwingDoorDisableAutoClose("castle_arched02", true);
AddPropForce("castle_arched02", 70.0f, 0, 0, "World");
SetSwingDoorLocked("castle_arched02_1", false, false);
SetSwingDoorClosed("castle_arched02_1", false, false);
SetSwingDoorDisableAutoClose("castle_arched02_1", true);
AddPropForce("castle_arched02_1", 70.0f, 0, 0, "World");
SetEntityActive("monsterscarearea", true);
SetEntityActive("MonsterActive", false);
}
void monsterscare2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "monster_disable_node", 0, "run.dae_anim");
AddEntityCollideCallback("servant_brute_2", "monster_disable_area", monsterdisable", false, 1);
StartPlayerLookAt("castle_arched02", 10, 10, "");
AddTimer("stoplook", 2.0, "PlayerStopLook");
GiveSanityDamage(0, true);
}
void PlayerStopLook(string &in asTimer)
{
StopPlayerLookAt();
}
void OnLeave()
{
StopMusic( 0,0);
PlayMusic("09_amb_safe.ogg", true, 2, 10, 0, true);
}


RE: Unexpected end of file - Cruzore - 06-20-2012

void Give_Up(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("BruteInRoom") != 1) return;
if(alState == 1)

StartBangDoorEvent();
else
StopBangDoorEvent();

}
missing parantheses.


RE: Unexpected end of file - drunkmonk - 06-20-2012

(06-20-2012, 08:55 PM)FastHunteR Wrote: void Give_Up(string &in asParent, string &in asChild, int alState)
{
if(GetLocalVarInt("BruteInRoom") != 1) return;
if(alState == 1)

StartBangDoorEvent();
else
StopBangDoorEvent();

}
missing parantheses.
That line of script did work before I added more stuff to the script


RE: Unexpected end of file - Cruzore - 06-20-2012

Sorry, misread Smile
There are no missing parantheses, and I can't find anything missing by that way. Since when is that error occuring, and what section of this code is new?


RE: Unexpected end of file - drunkmonk - 06-20-2012

AddEntityPlayerInteractCallback("Key_Upper_Levels", "monsterscare", true);
void monsterscare(string &in asEntity)
{
AddEntityCollideCallback("Player", "monsterscarearea", "monsterscare2" true, 1);
SetSwingDoorClosed("castle_arched02", false, false);
SetSwingDoorDisableAutoClose("castle_arched02", true);
AddPropForce("castle_arched02", 70.0f, 0, 0, "World");
SetSwingDoorLocked("castle_arched02_1", false, false);
SetSwingDoorClosed("castle_arched02_1", false, false);
SetSwingDoorDisableAutoClose("castle_arched02_1", true);
AddPropForce("castle_arched02_1", 70.0f, 0, 0, "World");
SetEntityActive("monsterscarearea", true);
SetEntityActive("MonsterActive", false);
}
void monsterscare2(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_brute_2", true);
AddEnemyPatrolNode("servant_brute_2", "monster_disable_node", 0, "run.dae_anim");
AddEntityCollideCallback("servant_brute_2", "monster_disable_area", monsterdisable", false, 1);
StartPlayerLookAt("castle_arched02", 10, 10, "");
AddTimer("stoplook", 2.0, "PlayerStopLook");
GiveSanityDamage(0, true);
}
void PlayerStopLook(string &in asTimer)
{
StopPlayerLookAt();
}

I think thats all the new stuff


RE: Unexpected end of file - Cruzore - 06-20-2012

AddEntityPlayerInteractCallback("Key_Upper_Levels", "monsterscare", true);
it's SetEntity, not AddEntity.

(That's the only thing I noticed)


RE: Unexpected end of file - drunkmonk - 06-20-2012

(06-20-2012, 09:13 PM)FastHunteR Wrote: AddEntityPlayerInteractCallback("Key_Upper_Levels", "monsterscare", true);
it's SetEntity, not AddEntity.

(That's the only thing I noticed)
oh I didn't see that and I fixed it but im still getting the same error message pop up


RE: Unexpected end of file - Cruzore - 06-20-2012

AddEntityCollideCallback("servant_brute_2", "monster_disable_area", monsterdisable", false, 1);
No monsterdisable function?


RE: Unexpected end of file - drunkmonk - 06-20-2012

(06-20-2012, 09:22 PM)FastHunteR Wrote: AddEntityCollideCallback("servant_brute_2", "monster_disable_area", monsterdisable", false, 1);
No monsterdisable function?
oh I completely forgot about that and now that iv added it im still get the same message


RE: Unexpected end of file - Apjjm - 06-20-2012

You appear to be missing a ":
AddEntityCollideCallback("servant_brute_2", "monster_disable_area", monsterdisable", false, 1);


Try:
AddEntityCollideCallback("servant_brute_2", "monster_disable_area", "monsterdisable", false, 1);