[SCRIPT] Make a light flicker? - 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] Make a light flicker? (/thread-14118.html) |
Make a light flicker? - TheLastGreyKnight - 03-20-2012 What script would one use to make a light flicker? I'm brand new to scripting and have been trying to get a light to flicker for like an hour now I'm pretty sure I'm using the wrong script but I dun know, any help? void OnEnter() { AddEntityCollideCallback("Player", "Scare1", "FirstScare", true, 1); AddEntityCollideCallback("Player", "Scare2", "SecondScare", true, 1); AddEntityCollideCallback("Player", "LightOff", "LightFlicker_1", true, 1); } // sounds void FirstScare(string &in asParent, string &in asChild, int alState) { if(alState == 1) { PlayMusic("05_event_steps.ogg", false, 1.00, 0, 0, true); } } void SecondScare(string &in asParent, string &in asChild, int alState) { if (alState == 1) { PlayMusic("15_event_prisoner.ogg", false, 1.00, 0, 0, true); } } void LightFlicker_1(string& asLightName, bool abActive); { SetLightFlickerActive("LightOff", false); } everytime I try to start my CS I get "FATAL ERROR: Could not load script file 'custom_stories/Coma-Backup/maps/00_starting.hps'! main (23, 4) :ERR :Unexpected Token '{' Any help? RE: Make a light flicker? - Your Computer - 03-20-2012 Semicolons are not part of function headers. As for the other issue, (string, bool) is not the syntax for collision callbacks. RE: Make a light flicker? - TheLastGreyKnight - 03-20-2012 (03-20-2012, 04:13 AM)Your Computer Wrote: Semicolons are not part of function headers. As for the other issue, (string, bool) is not the syntax for collision callbacks.I tried "fixing it" to best of my ability's but now I get a new error. "FATAL ERROR: Could not load script file (my custom story) main (22, 21) : ERR : Expected data type. From what you said I did this to try and fix it. AddEntityCollideCallback("Player", "LightOff", "LightFlicker_1", true, 1); void LightFlicker_1("LightOff", false) { SetLightFlickerActive("LightOff", false); } I feel so needy posting for help, but as I said I've literally been scripting for only about 19 hours now so I'm a complete noob at it ;/ RE: Make a light flicker? - Your Computer - 03-20-2012 Function definitions don't contain values as their parameters. Proper syntax: PHP Code: void LightFlicker_1(string &in parent, string &in child, int state) BTW, i'm doubting "LightOff" is the name of the light. RE: Make a light flicker? - DaAinGame - 03-20-2012 (03-20-2012, 06:12 AM)TheLastGreyKnight Wrote:In the void part you messed up. If your using a script area to call upon that function it should be:(03-20-2012, 04:13 AM)Your Computer Wrote: Semicolons are not part of function headers. As for the other issue, (string, bool) is not the syntax for collision callbacks.I tried "fixing it" to best of my ability's but now I get a new error. "FATAL ERROR: Could not load script file (my custom story) main (22, 21) : ERR : Expected data type. AddEntityCollideCallback("Player", "LightOff", "LightFlicker_1", true, 1); void LightFlicker_1(string &in asParent, string &in asChild, int alState) { SetLightFlickerActive("LightOff", false); } And don't feel bad, getting use to the script takes some time. For some, they catch onto it right away. About 48 hours after being introduced to the new language I had a a pretty solid grasp of it. Feel free to ask if any more errors persist, but i think that it should work now. Also here's a useful website! http://wiki.frictionalgames.com/hpl2/amnesia/script_functions RE: Make a light flicker? - TheLastGreyKnight - 03-20-2012 (03-20-2012, 07:03 AM)Your Computer Wrote: Function definitions don't contain values as their parameters.Thank you so much, every little bit helps me learn how to use, lol if we didn't have awesome people like you noobs like me would never have a chance. And yeah, it is named LightOff because I'm lazy and couldn't think of any other names -.- lol thanks RE: Make a light flicker? - Your Computer - 03-20-2012 (03-20-2012, 07:11 AM)TheLastGreyKnight Wrote: And yeah, it is named LightOff because I'm lazy and couldn't think of any other names The reason why i doubted it is because that would mean you have the light set as the "child" for the collision. While i've never tried adding a collision callback to a light, if it doesn't trigger the callback, then my thoughts were correct in that lights do not support collision. |