Frictional Games Forum (read-only)
LAMP CALLBACK PLEASE HELP - 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: LAMP CALLBACK PLEASE HELP (/thread-10372.html)



LAMP CALLBACK PLEASE HELP - Itskody - 09-17-2011

How do i trigger an event when i light a lamp?


RE: LAMP CALLBACK PLEASE HELP - Elven - 09-17-2011

void SetEntityCallbackFunc(string& asName, string& asCallback);
Calls a function when the player interacts with a certain entity.
Callback syntax: void MyFunc(string &in asEntity, string &in type)
Type depends on entity type and includes: “OnPickup”, “Break”, “OnIgnite”, etc

there you go Smile




RE: LAMP CALLBACK PLEASE HELP - Khyrpa - 09-17-2011

Or you can do this inside the level editor:
[Image: bloblitlampinteractthin.jpg]

Then add this in your script file:

void LightAndThisHappens(string &in asEntity)
{
//Stuff you want done
}



RE: LAMP CALLBACK PLEASE HELP - Itskody - 09-18-2011

yea but how do i make it so something only happens when all 3 lights are lit Sad


RE: LAMP CALLBACK PLEASE HELP - Khyrpa - 09-18-2011

Should be something similar to this

void OnStart()
{
for(int n=1;n<3;n++) SetEntityPlayerInteractCallback("LampName_"+n, "LampLitCallback", true);
}

void LampLitCallback(string &in asEntity)
{AddLocalVarInt("CheckHowmany", 1); //Adds 1 each time a lamp is lit to the variable
if(GetLocalVarInt("CheckHowmany") == 3){//DO STUFF}
}




RE: LAMP CALLBACK PLEASE HELP - Itskody - 09-18-2011

ok soo it would look like this?

void OnStart()
{
for(int n=1;n<3;n++) SetEntityPlayerInteractCallback("Lamp_01"+n, "LampLitCallback", true);
}

void LampLitCallback(string &in asEntity)
{AddLocalVarInt("3", 1); //Adds 1 each time a lamp is lit to the variable
if(GetLocalVarInt("3") == 3){//DO STUFF}
}



and that means that when 3 lights are lit it will trigger an effect?


RE: LAMP CALLBACK PLEASE HELP - Khyrpa - 09-18-2011

for(int n=1;n<3;n++) SetEntityPlayerInteractCallback("Lamp_01"+n, "LampLitCallback", true);

is the same thing as

SetEntityPlayerInteractCallback("Lamp_011", "LampLitCallback", true);
SetEntityPlayerInteractCallback("Lamp_012", "LampLitCallback", true);
SetEntityPlayerInteractCallback("Lamp_013", "LampLitCallback", true);