Frictional Games Forum (read-only)
script error - 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 error (/thread-9513.html)



script error - mr.bonent - 07-31-2011

What's the wrong in this script?

Sorry but I'm new in scripting.


Quote:{
AddEntityCollideCallback("Player", "DoorClosedArea_1", "DoorClosedAndLook", true, 1);
}

void DoorClosedAndLook(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_6", true, true);
StartPlayerLookAt("mansion_6", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");
}
void stoplook(string &in asTimer)
{
StopPlayerLookAt();
}




That's the error.




RE: script error - palistov - 07-31-2011

You're missing some of your script. There aren't even 17 lines in what you posted.

Anyways, in your script, look at the the first 17 lines. There's likely a extra/missing brace somewhere.


RE: script error - mr.bonent - 07-31-2011

Here are the missing lines.

Quote:void OnStart()
{
AddEntityCollideCallback("Player", "ScriptArea_1", "BuchErscheinung", true, 1);
}

void BuchErscheinung(string &in asParent, string &in asChild, int alState)
{
SetEntityActive("buch", true);
AddDebugMessage("buch", false);
}






{
AddEntityCollideCallback("Player", "DoorClosedArea_1", "DoorClosedAndLook", true, 1);
}

void DoorClosedAndLook(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("mansion_6", true, true);
StartPlayerLookAt("mansion_6", 10.0f, 10.0f, "");
AddTimer("", 1.0f, "stoplook");
}
void stoplook(string &in asTimer)
{
StopPlayerLookAt();
}









void OnEnter()
{
}
void OnLeave()
{
}



RE: script error - Kyle - 07-31-2011

You can't make functions out of nothing, there must be the type, name, and parameters for each one. The AddEntityCollideCallback is supposed to be in the "void OnStart()" function.

Code:
void OnStart()
{
     AddEntityCollideCallback("Player", "ScriptArea_1", "BuchErscheinung", true, 1);
     AddEntityCollideCallback("Player", "DoorClosedArea_1", "DoorClosedAndLook", true, 1);
}
void BuchErscheinung(string &in asParent, string &in asChild, int alState)
{
     SetEntityActive("buch", true);
     AddDebugMessage("buch", false);
}
void DoorClosedAndLook(string &in asParent, string &in asChild, int alState)
{
     SetSwingDoorClosed("mansion_6", true, true);
     StartPlayerLookAt("mansion_6", 10.0f, 10.0f, "");
     AddTimer("", 1.0f, "stoplook");
}
void stoplook(string &in asTimer)
{
     StopPlayerLookAt();
}
void OnEnter()
{
}
void OnLeave()
{
}



RE: script error - mr.bonent - 07-31-2011

Well thank you very much.Smile It works.