Frictional Games Forum (read-only)
Script Help - 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: Script Help (/thread-11778.html)



Script Help - aqfitz622 - 12-10-2011

I am continuing my story and this happened

FATAL ERROR: Could not load script file 'custom_stories/test/maps//Applications/Amnesia.app/Contents/Resources/custom_stories/test/maps/Hallways.hps'!
main (13, 1) : ERR : Unexpected token '{'
main (24, 1) : ERR : Unexpected token '{'

here is my Hallways.HPS File

void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
}
void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
}

{
AddUseItemCallback("", "key1", "Mansion_6", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Mansion_6", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key1");
}

{
AddUseItemCallback("", "key2", "castle_6", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key2");
}


RE: Script Help - flamez3 - 12-11-2011

Quote:void OnStart()
{
AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1);
AddUseItemCallback("", "key1", "Mansion_6", "FUNCTION1", true);
AddUseItemCallback("", "key2", "castle_6", "FUNCTION2", true);
}


void MonsterFunction(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("servant_grunt_1", true);
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_1", 2, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_2", 0, "");
AddEnemyPatrolNode("servant_grunt_1", "PathNodeArea_3", 0, "");
}
void FUNCTION1(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("Mansion_6", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key1");
}


void FUNCTION2(string &in asItem, string &in asEntity)
{
SetSwingDoorLocked("castle_1", false, true);
PlaySoundAtEntity("", "unlock_door", "door1", 0, false);
RemoveItem("key2");
}

The things like "AddEntityCollideCallback("Player", "PlayerCollide", "MonsterFunction", true, 1); " Always go in the void OnStart() block. I've also renamed some of your functions; two different functions can't have the same name. Just copy and paste that into your script.