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