09-17-2011, 09:25 PM
09-17-2011, 09:33 PM
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
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
09-17-2011, 09:43 PM
09-18-2011, 05:30 AM
yea but how do i make it so something only happens when all 3 lights are lit
09-18-2011, 10:30 AM
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}
}
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, 04:28 PM
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?
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:42 PM
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);
is the same thing as
SetEntityPlayerInteractCallback("Lamp_011", "LampLitCallback", true);
SetEntityPlayerInteractCallback("Lamp_012", "LampLitCallback", true);
SetEntityPlayerInteractCallback("Lamp_013", "LampLitCallback", true);