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
LAMP CALLBACK PLEASE HELP
Itskody Offline
Member

Posts: 100
Threads: 30
Joined: Mar 2011
Reputation: 1
#1
LAMP CALLBACK PLEASE HELP

How do i trigger an event when i light a lamp?
09-17-2011, 09:25 PM
Find
Elven Offline
Posting Freak

Posts: 862
Threads: 37
Joined: Aug 2011
Reputation: 26
#2
RE: LAMP CALLBACK PLEASE HELP

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


The Interrogation
Chapter 1

My tutorials
09-17-2011, 09:33 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#3
RE: LAMP CALLBACK PLEASE HELP

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
}

09-17-2011, 09:43 PM
Find
Itskody Offline
Member

Posts: 100
Threads: 30
Joined: Mar 2011
Reputation: 1
#4
RE: LAMP CALLBACK PLEASE HELP

yea but how do i make it so something only happens when all 3 lights are lit Sad
09-18-2011, 05:30 AM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#5
RE: LAMP CALLBACK PLEASE HELP

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


09-18-2011, 10:30 AM
Find
Itskody Offline
Member

Posts: 100
Threads: 30
Joined: Mar 2011
Reputation: 1
#6
RE: LAMP CALLBACK PLEASE HELP

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?
09-18-2011, 04:28 PM
Find
Khyrpa Offline
Senior Member

Posts: 638
Threads: 10
Joined: Apr 2011
Reputation: 24
#7
RE: LAMP CALLBACK PLEASE HELP

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

09-18-2011, 04:42 PM
Find




Users browsing this thread: 1 Guest(s)