[SCRIPT] Error with sound script - 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 with sound script (/thread-29739.html) |
Error with sound script - MaksoPL - 03-13-2015 Hi. I've got a error with script to play sounds. ExecuteString (1, 1) : No matching signatures to OnLeave() main (8,1) Unexpected token { It's my .hps file: void OnStart() { AddEntityCollideCallback("Player", "sound01", "ScarySound1", true, 1); } void ScarySound1(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound); { PlaySoundAtEntity("explosion_rock_large", "explosion_rock_large.snt", "sound01", 1.0f, true); } What I've must do? RE: Error with sound script - Darkfire - 03-13-2015 void ScarySound1(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound); You don't put the code in the name of the function. It normally would be void ScarySound1() { } But since this func is after AddEntityCollideCallback, it will look like void ScarySound1(string &in asParent, string &in asChild, int alState) { } Otherwise, I think it's correct. Watch some tutorials to get the hang of scripting. RE: Error with sound script - Neelke - 03-13-2015 Youve used the function completely wrong. void ScarySound1(string& asSoundName, string& asSoundFile, string& asEntity, float afFadeTime, bool abSaveSound); This doesn't have the proper setup and it also shouldn't have the ; in the end. To setup a collide function, you need three parameters: void ScarySound1(string &in asParent, string &in asChild, int alState) asParent = the main object colliding with asChild (in your case its the Player) asChild = the object asParent is meant to collide with ("sound01") alState = checking whether player is colliding with asChild or leaving the area (0 = check if player is both leaving and entering the area, 1 = check if player is entering area, -1 check if player is leaving area) |