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
Script Help Lights ON and OFF
asghdrew Offline
Member

Posts: 138
Threads: 10
Joined: Mar 2012
Reputation: 7
#5
RE: Lights ON and OFF

(03-21-2012, 09:44 PM)Your Computer Wrote: Did you understand this? 'Cause it sounds like you didn't:

(03-21-2012, 04:08 PM)palistov Wrote: Third, lights don't turn on/off based on being 'active' or not. They aren't treated as entities, so you'll need to use the scripts to control them.

Also, use SetEntityConnectionStateChangeCallback not SetEntityPlayerInteractCallback.
Okay I used SetEntityConnectionStateChangeCallback

This is what it looks like

//////////////////////////////////////////////////
void OnStart()

{
SetEntityConnectionStateChangeCallback( "lights", "lights_on");
for(int i=1;i<=6;i++) SetLightVisible("light_"+i, false);
}

//////////////////////////////////////////////////

void lights_on(string &in asEntity)
{
SetLightVisible("light_1", true);
SetLightVisible("light_2", true);
SetLightVisible("light_3", true);
SetLightVisible("light_4", true);
SetLightVisible("light_5", true);
SetLightVisible("light_6", true);
}

void lights_off(string &in asEntity)
{
SetLightVisible("light_1", false);
SetLightVisible("light_2", false);
SetLightVisible("light_3", false);
SetLightVisible("light_4", false);
SetLightVisible("light_5", false);
SetLightVisible("light_6", false);
}

/////////////////////////////////////////////////

I hope thats right...
Well anyways now when i start the game the lights are OFF (which im very happy with Big Grin)
BUT interacting with (lights) button , doesn't turn them on Sad
What am I doing wrong ?


lol noobs
(This post was last modified: 03-22-2012, 02:04 PM by asghdrew.)
03-22-2012, 11:34 AM
Find


Messages In This Thread
Lights ON and OFF - by asghdrew - 03-21-2012, 03:57 PM
RE: Lights ON and OFF - by palistov - 03-21-2012, 04:08 PM
RE: Lights ON and OFF - by asghdrew - 03-21-2012, 04:27 PM
RE: Lights ON and OFF - by Your Computer - 03-21-2012, 09:44 PM
RE: Lights ON and OFF - by asghdrew - 03-22-2012, 11:34 AM
RE: Lights ON and OFF - by Your Computer - 03-22-2012, 08:09 PM
RE: Lights ON and OFF - by asghdrew - 03-22-2012, 08:40 PM
RE: Lights ON and OFF - by Your Computer - 03-22-2012, 08:57 PM
RE: Lights ON and OFF - by asghdrew - 03-22-2012, 09:02 PM
RE: Lights ON and OFF - by Your Computer - 03-22-2012, 09:41 PM



Users browsing this thread: 1 Guest(s)