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
#3
RE: Lights ON and OFF

(03-21-2012, 04:08 PM)palistov Wrote: A few things:

First, players cannot interact with lights in-game. You can script interactions through buttons or levers (like I'm guessing you're trying to do), but scripting a direct player interaction with a light (e.g. the player walks up and literally clicks on the light source) won't work. Second, the only thing your current script would do, even if it worked, is turn the lights on. 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.

In your OnStart function, put this line. It is a for-loop which will turn off all of the lights.

for(int i=1;i<=6;i++) SetLightVisible("light_"+i, false);

Now you can work out the function to turn the lights on and off, and use that same line of script (changing the value of false as needed).
Yes im using a button (switch)
which is attached in wall (its not a static object ,its an entity)
And what I need is that the lights at start of the game are Off not On.
Its like when I start the game (the switch which im suposed to press magicaly turns on by itself and the lights are on)
Il use the loop line and see if it works Smile



lol noobs
03-21-2012, 04:27 PM
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: 2 Guest(s)