Frictional Games Forum (read-only)
[SCRIPT] teleport script fatal 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] teleport script fatal error (/thread-16037.html)



teleport script fatal error - putty992 - 06-10-2012

My script doesnt work its keep getting up "fatal error" when i launch the custom story


void OnStart()
}
AddEntityCollideCallback("Player","TeleportScript", string& asChildName, "NailThatSucker", true, 1);
{

void NailThatSuckerSadstring& asParent, string &in asChild, int alStates);
{
SetEntityActive("TeleportedNakedGuy", true);
AddPropForce("TeleportedNakedGuy", -10000, 0, 0, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "TeleportedNakedGuy", 0, false);
}


THANKS!!


RE: teleport script fatal error - Your Computer - 06-10-2012

You got the curly brackets wrong the first time, but correct the second time. You got the function header correct the first time, but wrong the second time.


RE: teleport script fatal error - SilentStriker - 06-10-2012

void NailThatSucker:

I think this : is the problem


RE: teleport script fatal error - Science - 06-10-2012

//Error code

void OnStart()
}
AddEntityCollideCallback("Player","TeleportScript", string& asChildName, "NailThatSucker", true, 1);
{

void NailThatSucker:(string& asParent, string &in asChild, int alStates);
{
-snip-
}


You didn't declare this, instead, you made a new section to the string. Look at the curly braces, { opens and } closes, you have it the other way around in your void OnStart() area. Also, in your function you added a colon ( : ) where it doesn't belong, and a semi-colon doesn't go at the end of a function.



//Good code

void OnStart()
{

AddEntityCollideCallback("Player", "TeleportScript", "NailThatSucker", true, 1);
}


void NailThatSucker(string& asParent, string &in asChild, int alStates)
{
SetEntityActive("TeleportedNakedGuy", true);
AddPropForce("TeleportedNakedGuy", -10000, 0, 0, "world");
PlaySoundAtEntity("", "24_iron_maiden.snt", "TeleportedNakedGuy", 0, false);
}



RE: teleport script fatal error - putty992 - 06-10-2012

The fatal error says : FATAL ERROR:could not script file
'Custom_Stories/TEST/custom_stories/TEST/maps/test.hps'!
main (2, 1) :ERR :Expected ',' or ';'
main (4, 1) :ERR :Unexpected token '{'