Frictional Games Forum (read-only)

Full Version: script error
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.

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.
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()
{
}
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()
{
}
Well thank you very much.Smile It works.