Amnesiaplayer
Senior Member
Posts: 539
Threads: 105
Joined: Jun 2014
Reputation:
0
|
Disabling "lights" activating area's...
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!
|
|
02-23-2015, 02:17 PM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: Disabling "lights" activating area's...
Instead of SetEntityPlayerInteractCallback, try
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 }
Discord: Romulator#0001
(This post was last modified: 02-23-2015, 07:34 PM by Romulator.)
|
|
02-23-2015, 02:31 PM |
|
Amnesiaplayer
Senior Member
Posts: 539
Threads: 105
Joined: Jun 2014
Reputation:
0
|
RE: Disabling "lights" activating area's...
(02-23-2015, 02:31 PM)Romulator Wrote: Instead of SetEntityPlayerInteractCallback, try
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
|
|
02-24-2015, 04:31 PM |
|
Romulator
Not Tech Support ;-)
Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation:
195
|
RE: Disabling "lights" activating area's...
Yep, make use of a timer.
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.
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()!
Discord: Romulator#0001
(This post was last modified: 02-24-2015, 04:57 PM by Romulator.)
|
|
02-24-2015, 04:56 PM |
|
Amnesiaplayer
Senior Member
Posts: 539
Threads: 105
Joined: Jun 2014
Reputation:
0
|
RE: Disabling "lights" activating area's...
(02-24-2015, 04:56 PM)Romulator Wrote: Yep, make use of a timer.
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.
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.
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.
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!!!
(This post was last modified: 02-24-2015, 05:16 PM by Amnesiaplayer.)
|
|
02-24-2015, 05:16 PM |
|
|