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
#1
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 Sad and i want a Area that was inactive, will become active after picking the lantern... i think that works with the Setentityactive thing Tongue but the light Sad my script about this:

SetEntityPlayerInteractCallback("Lantern", "BadThings", true);

void BadThings(string &in asItem, string &in asEntity)
{
SetLightVisible("Lamp", false);
}

Sad thanks if you can help me!
02-23-2015, 02:17 PM
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#2
RE: Disabling "lights" activating area's...

Instead of SetEntityPlayerInteractCallback, try

PHP Code: (Select All)
SetEntityCallbackFunc("Lantern""BadThings");  //This will go in OnStart()

void BadThings(string &in asEntitystring &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
[Image: 3f6f01a904.png]
(This post was last modified: 02-23-2015, 07:34 PM by Romulator.)
02-23-2015, 02:31 PM
Find
Amnesiaplayer Offline
Senior Member

Posts: 539
Threads: 105
Joined: Jun 2014
Reputation: 0
#3
RE: Disabling "lights" activating area's...

(02-23-2015, 02:31 PM)Romulator Wrote: Instead of SetEntityPlayerInteractCallback, try

PHP Code: (Select All)
SetEntityCallbackFunc("Lantern""BadThings");  //This will go in OnStart()

void BadThings(string &in asEntitystring &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
Find
Romulator Offline
Not Tech Support ;-)

Posts: 3,628
Threads: 63
Joined: Jan 2013
Reputation: 195
#4
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.

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()!

Discord: Romulator#0001
[Image: 3f6f01a904.png]
(This post was last modified: 02-24-2015, 04:57 PM by Romulator.)
02-24-2015, 04:56 PM
Find
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




Users browsing this thread: 1 Guest(s)