Home   Help Search Login Register  

Author Topic: Lights  (Read 599 times)

0 Members and 1 Guest are viewing this topic.

Offline bigdave003

  • Members
  • *
  • I'm a double bacon genius burger!!
Lights
« on: 17 Jul 2005, 13:10:48 »
Hi, ive made a script to kill the lights in a base when the player trips a trigger. There are two lights, so the trigger's "on activation" field i have:

Code: [Select]
[object 118906,object 173123] exec "Lights.sqs"
The script is as follows:

Code: [Select]
_light1 = _this select 0
_light2 = _this select 1

;wait 4 minuts for player to get into position
~240

;light 1 goes out
_light1 inflame false

~4

;light 2 goes out 4 seconds after light 1
_light2 inflame false

;lights are out for 11 mins
~660

;light 1 comes back on
_light1 inflame true

~4

;light 2 comes back on 4 seconds after light 1
_light2 inflame true

exit

Problem - The lights dont go out. Can anyone see what im doing wrong?

Thanks
« Last Edit: 17 Jul 2005, 13:12:03 by bigdave003 »
"From this day to the ending of the world we in it shall be remembered. We lucky few, we band of brothers. For he who today sheds his blood with me shall be my brother. "

Offline THobson

  • OFPEC Patron
  • Former Staff
  • ****
Re:Lights
« Reply #1 on: 17 Jul 2005, 13:51:02 »
Try:

_light1 switchlight "OFF"

John Smith

  • Guest
Re:Lights
« Reply #2 on: 17 Jul 2005, 14:00:42 »
Is there a reason that you have to use script? Can't you just use the simple switchlight command on it's own for each individual light?

Dane

  • Guest
Re:Lights
« Reply #3 on: 17 Jul 2005, 14:24:47 »
I think yes because one script can be less laggy than several triggers. I think so :P

and also less triggers to clutter up the mission editor.
« Last Edit: 17 Jul 2005, 14:30:01 by Dane »

Offline bigdave003

  • Members
  • *
  • I'm a double bacon genius burger!!
Re:Lights
« Reply #4 on: 18 Jul 2005, 16:48:17 »
Yeah that, plus i want to give the player a fixed time of around 10 mins of darkness. Is there a way i can randomly generate a number between 540 and 780? (so the player could get darkness for anywhere between 9 mins and 12 mins?)
"From this day to the ending of the world we in it shall be remembered. We lucky few, we band of brothers. For he who today sheds his blood with me shall be my brother. "

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Lights
« Reply #5 on: 18 Jul 2005, 17:58:25 »
Code: [Select]
;generate random number between 540 and 780

#loop
_rand = random 780
?_rand <540 : goto "loop"

_rand = _rand - (_rand mod 1)

that will return a rounded number between 540 and 780 ;)

Offline bigdave003

  • Members
  • *
  • I'm a double bacon genius burger!!
Re:Lights
« Reply #6 on: 18 Jul 2005, 18:10:00 »
How would I put that into my script? Appologies, I'm not very good at scripting
"From this day to the ending of the world we in it shall be remembered. We lucky few, we band of brothers. For he who today sheds his blood with me shall be my brother. "

Offline bedges

  • Administrator
  • *****
    • OFPEC The Editing Center
Re:Lights
« Reply #7 on: 18 Jul 2005, 18:22:39 »
when you want it to wait for between 9 and 12 minutes, put

Code: [Select]
#loop
_rand = random 780
?_rand <540 : goto "loop"

_rand = _rand - (_rand mod 1)

~ _rand

and don't worry about being new to scripting - everyone starts somewhere ;)

Offline bigdave003

  • Members
  • *
  • I'm a double bacon genius burger!!
Re:Lights
« Reply #8 on: 18 Jul 2005, 18:23:35 »
Cool, thanks for your patience  :cheers:
"From this day to the ending of the world we in it shall be remembered. We lucky few, we band of brothers. For he who today sheds his blood with me shall be my brother. "