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
Disabling "lights" activating area's...
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#5
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.

PHP Code: (Select All)
void BadThings(string &in asEntitystring &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!!! Big Grin

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

PHP Code: (Select All)
void BadThings(string &in asEntitystring &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!!! Big Grin
(This post was last modified: 02-24-2015, 05:16 PM by Amnesiaplayer.)
02-24-2015, 05:16 PM
Find


Messages In This Thread
RE: Disabling "lights" activating area's... - by Amnesiaplayer - 02-24-2015, 05:16 PM



Users browsing this thread: 1 Guest(s)