Frictional Games Forum (read-only)
Scripting issues - 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: Scripting issues (/thread-11715.html)



Scripting issues - Spermaharen - 12-06-2011

Hello Again ! Sorry if i post much of this but is a forum Blush
I,ve done a little script but it dont work when i try to start my custom story i get this error message : Fatal Error : could not load script file !
And my script looks like ! and if i delete the part with the door it works its really enoying so if someone knows please help ! Heart

SPERMAHAREN Cool


void OnStart()
{

AddUseItemCallback("", "Key1", "Door", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{

SetSwingDoorLocked("Door", false, true);
PlaySoundAtEntity("", "unlock_door", "Door", 0, false);
RemoveItem("Key1");

}

//////// KEY 1 DONE

{

AddEntityCollideCallback("Player", "script_1", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door2", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}



RE: Scripting issues - Tanshaydar - 12-06-2011

Make sure your level file and your script file have the same name.
For example:
example.map
example.hps


RE: Scripting issues - Spermaharen - 12-06-2011

(12-06-2011, 09:54 AM)Tanshaydar Wrote: Make sure your level file and your script file have the same name.
For example:
example.map
example.hps
My map and hps is same name so it cant be that
Mackan.map
Mackan.hps



RE: Scripting issues - Your Computer - 12-06-2011

You have a dangling code block directly under the "KEY 1 DONE" comment.


RE: Scripting issues - Spermaharen - 12-06-2011

(12-06-2011, 10:08 AM)Your Computer Wrote: You have a dangling code block directly under the "KEY 1 DONE" comment.
void OnStart()
{

AddUseItemCallback("", "Key1", "Door", "FUNCTION", true);
}

void FUNCTION(string &in asItem, string &in asEntity)
{

SetSwingDoorLocked("Door", false, true);
PlaySoundAtEntity("", "unlock_door", "Door", 0, false);
RemoveItem("Key1");

}

//////// KEY 1 DONE

{ <----------------------- Deleted still dont work !

AddEntityCollideCallback("Player", "script_1", "func_slam", true, 1);
}

void func_slam(string &in asParent, string &in asChild, int alState)
{
SetSwingDoorClosed("door2", true, true);

PlaySoundAtEntity("", "react_breath_slow.snt", "Player", 0, false);

PlaySoundAtEntity("", "react_scare", "Player", 0, false); PlaySoundAtEntity("", "close_door.snt", "Player", 0, false);

GiveSanityDamage(5.0f, true);
}



RE: Scripting issues - Your Computer - 12-06-2011

I'd fix it for you, but i have no idea what that AddEntityCollideCallback's purpose is. Was that code block supposed to be for a function that you forgot to define? Was that AddEntityCollideCallback supposed to go in OnStart but ended up else where? Figure out what you want to happen, then figure out how to make it happen. If you don't know what the purpose of every single thing you've written in the script is, then you're going to get lost again the next time this happens.


RE: Scripting issues - Spermaharen - 12-06-2011

(12-06-2011, 11:57 AM)Your Computer Wrote: I'd fix it for you, but i have no idea what that AddEntityCollideCallback's purpose is. Was that code block supposed to be for a function that you forgot to define? Was that AddEntityCollideCallback supposed to go in OnStart but ended up else where? Figure out what you want to happen, then figure out how to make it happen. If you don't know what the purpose of every single thing you've written in the script is, then you're going to get lost again the next time this happens.
Im newb at this scripting part i looked at some of your guides awesome !