Frictional Games Forum (read-only)

Full Version: Area collide turning on torches problem.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
So i have an area collide callback
Code:
AddEntityCollideCallback("Player", "Areagruntactive", "LightFuction", true, 1);

Which then is supposed to light "greentorch1". This is the void function that i have.
Code:
void LightFunction(string &in asParent, string &in asChild, int alState)
{
    SetLampLit("greentorch1", true,);
}

Now i'm pretty new to scripting in general, and a correction and/or explanation of why this doesn't work would be appreciated.
There is a comma after the true in SetLampLit.
Gotta remove it.
(08-25-2011, 05:18 AM)Juby Wrote: [ -> ]There is a comma after the true in SetLampLit.
Gotta remove it.

not the problem, still giving me a fatal error? got anything else? cus i'm CLUELESS
You need to specify the "effects" part of your SetLampLit state. The syntax is
Code:
void SetLampLit(string& asName, bool abLit, bool abEffects);
so you want your code to look like this:
Code:
AddEntityCollideCallback("Player", "Areagruntactive", "LightFuction", true, 1);
Code:
void LightFunction(string &in asParent, string &in asChild, int alState)
{
    SetLampLit("greentorch1", true, false);
}

(08-25-2011, 06:28 AM)Phoroneus Wrote: [ -> ]You need to specify the "effects" part of your SetLampLit state. The syntax is
Code:
void SetLampLit(string& asName, bool abLit, bool abEffects);
so you want your code to look like this:
Code:
AddEntityCollideCallback("Player", "Areagruntactive", "LightFuction", true, 1);
Code:
void LightFunction(string &in asParent, string &in asChild, int alState)
{
    SetLampLit("greentorch1", true, false);
}
well i did try that, and i didn't get a fatal error, the only problem is, that now the light won't actually light. it stays unlit.
So what does the effects do exactly?
I'm not positive, to be honest. I usually just set them to "false". You can try "true", it might be the actual fading in of the light (as seen when you manually light an object with a tinderbox).
I'd also add in "AddDebugMessage("Lights on now.", false);" inside the LightFunction er... function. If you have a dev environment set up, turn on debug messages and you can see if it's a problem with the trigger or the actual execution (if the debug message pops up, the trigger is working and only the SetLampLit function is broken).
well, i suppose, instead of making it light, couldn't i just use the set entity active and put another torch on top of the torch that is unlit? then just use the SetEntityActive function to just replace the torches?
If all else fails, that's what I would do is set it active and just do double work unfortuately.
(08-25-2011, 07:29 PM)JetlinerX Wrote: [ -> ]If all else fails, that's what I would do is set it active and just do double work unfortuately.

thanks jetliner. oh and loved the attic! can't wait for chapter two!
Did you notice that you misspelled "LightFunction" in the addentitycollidecallback part? it is missing an N.
Pages: 1 2