Frictional Games Forum (read-only)

Full Version: LAMP CALLBACK PLEASE HELP
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How do i trigger an event when i light a lamp?
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

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
}
yea but how do i make it so something only happens when all 3 lights are lit Sad
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}
}

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