Frictional Games Forum (read-only)

Full Version: Scripting issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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);
}
Make sure your level file and your script file have the same name.
For example:
example.map
example.hps
(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
You have a dangling code block directly under the "KEY 1 DONE" comment.
(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);
}
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.
(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 !