i searched in the engine scripts and there is nothing i can find.
but i want, that if i pick a lantern, the "light" will disappear (i have a big lightbox, and i want that the whole box will disappear, so "de activating" i tried setentityactive false but it didn't worked, and i tried this one to SetLightVisible(string& asLightName, bool abVisible);
but it doesn't work to... is this even possible
and i want a Area that was inactive, will become active after picking the lantern... i think that works with the Setentityactive thing
but the light
my script about this:
SetEntityPlayerInteractCallback("Lantern", "BadThings", true);
void BadThings(string &in asItem, string &in asEntity)
{
SetLightVisible("Lamp", false);
}
thanks if you can help me!
Instead of SetEntityPlayerInteractCallback, try
PHP Code:
SetEntityCallbackFunc("Lantern", "BadThings"); //This will go in OnStart()
void BadThings(string &in asEntity, string &in type)
{
SetLightVisible("Lamp", false); //The name of your lamp goes here.
SetEntityActive("ScriptArea_1", true); //The script area you want to activate
}
(02-23-2015, 02:31 PM)Romulator Wrote: [ -> ]Instead of SetEntityPlayerInteractCallback, try
PHP Code:
SetEntityCallbackFunc("Lantern", "BadThings"); //This will go in OnStart()
void BadThings(string &in asEntity, string &in type)
{
SetLightVisible("Lamp", false); //The name of your lamp goes here.
SetEntityActive("ScriptArea_1", true); //The script area you want to activate
}
Yes!! it worked!! but can i let it happen after some time delay... like after 3 seconds (you picked the Lantern) the lights will go off.... so you pick the lantern, wait 3 seconds and then the lights go off... it's really funny if i just pick up a lantern and boom xD
Yep, make use of a timer.
Code:
AddTimer(string& asName, float afTime, string& asFunction);
Callback syntax: void MyFunc(string &in asTimer)
asName - the name of the timer
afTime - time in seconds
asFunction - the function to call
You can leave asName blank, but still need to declare it. You don't need to remove the timer, so simply making it "" will do.
afTime is how long you want in seconds, and as a float, can be decimal. We'll make it 3.0f.
asFunction is like the "BadThings" from before. It is the name of the function which we add code to.
For the function, we make use of the Callback syntax, which can be seen above. We just change MyFunc to the name of the Function, which in this case will be called "Lights_Out".
We make the Timer count down in BadThings, then we define what should happen.
PHP Code:
void BadThings(string &in asEntity, string &in type)
{
AddTimer("", 3.0f, "Lights_Out"); //Happens 3 seconds after picking up lantern.
}
void Lights_Out(string &in asTimer)
{
SetLightVisible("Lamp", false); //The name of your lamp goes here.
SetEntityActive("ScriptArea_1", true); //The script area you want to activate
}
Make sure to keep the SetEntityCallbackFunc in your OnStart()!
(02-24-2015, 04:56 PM)Romulator Wrote: [ -> ]Yep, make use of a timer.
Code:
AddTimer(string& asName, float afTime, string& asFunction);
Callback syntax: void MyFunc(string &in asTimer)
asName - the name of the timer
afTime - time in seconds
asFunction - the function to call
You can leave asName blank, but still need to declare it. You don't need to remove the timer, so simply making it "" will do.
afTime is how long you want in seconds, and as a float, can be decimal. We'll make it 3.0f.
asFunction is like the "BadThings" from before. It is the name of the function which we add code to.
For the function, we make use of the Callback syntax, which can be seen above. We just change MyFunc to the name of the Function, which in this case will be called "Lights_Out".
We make the Timer count down in BadThings, then we define what should happen.
PHP Code:
void BadThings(string &in asEntity, string &in type)
{
AddTimer("", 3.0f, "Lights_Out"); //Happens 3 seconds after picking up lantern.
}
void Lights_Out(string &in asTimer)
{
SetLightVisible("Lamp", false); //The name of your lamp goes here.
SetEntityActive("ScriptArea_1", true); //The script area you want to activate
}
Make sure to keep the SetEntityCallbackFunc in your OnStart()!
Thankss!! it worked!! and i finally understand about the timer!!!
(02-24-2015, 04:56 PM)Romulator Wrote: [ -> ]Yep, make use of a timer.
Code:
AddTimer(string& asName, float afTime, string& asFunction);
Callback syntax: void MyFunc(string &in asTimer)
asName - the name of the timer
afTime - time in seconds
asFunction - the function to call
You can leave asName blank, but still need to declare it. You don't need to remove the timer, so simply making it "" will do.
afTime is how long you want in seconds, and as a float, can be decimal. We'll make it 3.0f.
asFunction is like the "BadThings" from before. It is the name of the function which we add code to.
For the function, we make use of the Callback syntax, which can be seen above. We just change MyFunc to the name of the Function, which in this case will be called "Lights_Out".
We make the Timer count down in BadThings, then we define what should happen.
PHP Code:
void BadThings(string &in asEntity, string &in type)
{
AddTimer("", 3.0f, "Lights_Out"); //Happens 3 seconds after picking up lantern.
}
void Lights_Out(string &in asTimer)
{
SetLightVisible("Lamp", false); //The name of your lamp goes here.
SetEntityActive("ScriptArea_1", true); //The script area you want to activate
}
Make sure to keep the SetEntityCallbackFunc in your OnStart()!
Thankss!! it worked!! and i finally understand about the timer!!!