Frictional Games Forum (read-only)
Area collide turning on torches problem. - 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: Area collide turning on torches problem. (/thread-9969.html)

Pages: 1 2


Area collide turning on torches problem. - Fetishman - 08-25-2011

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.


RE: Area collide turning on torches problem. - Juby - 08-25-2011

There is a comma after the true in SetLampLit.
Gotta remove it.



RE: Area collide turning on torches problem. - Fetishman - 08-25-2011

(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


RE: Area collide turning on torches problem. - Phoroneus - 08-25-2011

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);
}




RE: Area collide turning on torches problem. - Fetishman - 08-25-2011

(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?


RE: Area collide turning on torches problem. - Phoroneus - 08-25-2011

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).


RE: Area collide turning on torches problem. - Fetishman - 08-25-2011

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?


RE: Area collide turning on torches problem. - JetlinerX - 08-25-2011

If all else fails, that's what I would do is set it active and just do double work unfortuately.


RE: Area collide turning on torches problem. - Fetishman - 08-26-2011

(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!



RE: Area collide turning on torches problem. - Timmy - 08-26-2011

Did you notice that you misspelled "LightFunction" in the addentitycollidecallback part? it is missing an N.