Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script Help Make a light flicker?
TheLastGreyKnight Offline
Junior Member

Posts: 16
Threads: 5
Joined: Jan 2012
Reputation: 0
#1
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 Sad 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
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#2
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.

Tutorials: From Noob to Pro
(This post was last modified: 03-20-2012, 04:14 AM by Your Computer.)
03-20-2012, 04:13 AM
Website Find
TheLastGreyKnight Offline
Junior Member

Posts: 16
Threads: 5
Joined: Jan 2012
Reputation: 0
#3
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
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#4
RE: Make a light flicker?

Function definitions don't contain values as their parameters.

Proper syntax:
PHP Code: (Select All)
void LightFlicker_1(string &in parentstring &in childint state)
{
SetLightFlickerActive("LightOff"false);


BTW, i'm doubting "LightOff" is the name of the light.

Tutorials: From Noob to Pro
03-20-2012, 07:03 AM
Website Find
DaAinGame Offline
Member

Posts: 90
Threads: 11
Joined: Mar 2012
Reputation: 4
#5
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


Realm Of Another Chapter 1: http://www.frictionalgames.com/forum/thread-14142.html
Realm Of Another Chapter 2: Postponed
Adder Halls: 5%
03-20-2012, 07:07 AM
Find
TheLastGreyKnight Offline
Junior Member

Posts: 16
Threads: 5
Joined: Jan 2012
Reputation: 0
#6
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:
PHP Code: (Select All)
void LightFlicker_1(string &in parentstring &in childint 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
Find
Your Computer Offline
SCAN ME!

Posts: 3,456
Threads: 32
Joined: Jul 2011
Reputation: 235
#7
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.

Tutorials: From Noob to Pro
03-20-2012, 07:19 AM
Website Find




Users browsing this thread: 1 Guest(s)