TheLastGreyKnight
Junior Member
Posts: 16
Threads: 5
Joined: Jan 2012
Reputation:
0
|
Make a light flicker?
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?
|
|
03-20-2012, 03:56 AM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Make a light flicker?
Semicolons are not part of function headers. As for the other issue, (string, bool) is not the syntax for collision callbacks.
(This post was last modified: 03-20-2012, 04:14 AM by Your Computer.)
|
|
03-20-2012, 04:13 AM |
|
TheLastGreyKnight
Junior Member
Posts: 16
Threads: 5
Joined: Jan 2012
Reputation:
0
|
RE: Make a light flicker?
(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 ;/
|
|
03-20-2012, 06:12 AM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Make a light flicker?
Function definitions don't contain values as their parameters.
Proper syntax:
void LightFlicker_1(string &in parent, string &in child, int state) { SetLightFlickerActive("LightOff", false); }
BTW, i'm doubting "LightOff" is the name of the light.
|
|
03-20-2012, 07:03 AM |
|
DaAinGame
Member
Posts: 90
Threads: 11
Joined: Mar 2012
Reputation:
4
|
RE: Make a light flicker?
(03-20-2012, 06:12 AM)TheLastGreyKnight Wrote: (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 ;/ In the void part you messed up. If your using a script area to call upon that function it should be:
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/amn..._functions
|
|
03-20-2012, 07:07 AM |
|
TheLastGreyKnight
Junior Member
Posts: 16
Threads: 5
Joined: Jan 2012
Reputation:
0
|
RE: Make a light flicker?
(03-20-2012, 07:03 AM)Your Computer Wrote: Function definitions don't contain values as their parameters.
Proper syntax:
void LightFlicker_1(string &in parent, string &in child, int state) { SetLightFlickerActive("LightOff", false); }
BTW, i'm doubting "LightOff" is the name of the light. 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
|
|
03-20-2012, 07:11 AM |
|
Your Computer
SCAN ME!
Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation:
235
|
RE: Make a light flicker?
(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.
|
|
03-20-2012, 07:19 AM |
|
|