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 (/thread-16263.html) |
script - Shift421 - 06-18-2012 can anyone see if there are any errors in this script? i want a piano to play then stop when the player gets near. OnStart() { AddTimer("pianotimer", 0, "pianotimer"); AddEntityCollideCallback("player", "pianostop", "pianostop", true, 1); } void pianotimer(string &in asTimer) { PlaySoundAtEntity("piano", "general_piano03.snt", "piano", 0, false); AddTimer("pianotimer", 18, "pianotimer"); } void pianostop(string &in asParent, string &in asChild, int alState) { StopSound("piano", 0); RemoveTimer("pianotimer"); } RE: script - Damascus - 06-18-2012 I don't see any problems with it. However it may be more efficient to cause the sound to loop rather than make the timer repeat. Just change your command to this: void pianotimer(string &in asTimer) { PlaySoundAtEntity("piano", "general_piano03.snt", "piano", 0, true); } void pianostop(string &in asParent, string &in asChild, int alState) { StopSound("piano", 0); } |