OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: pazuzu on 24 Jun 2005, 23:44:14

Title: switching lights back on
Post by: pazuzu on 24 Jun 2005, 23:44:14
I've got a problem with a mission I'm making on Nogova island. I have all the lights switch off & if I go to restart mission, the light are still off. I've heard of this problem before but I'm not sure how to deal with it...

I tried switching lights back on with init.sqs & that works but if I go to a different mission after switching lights off that doesn't do me any good.

I then tried using exit.sqs to turn them back on but it didn't work.

I put these commands in both init & exit.sqs:

(object 18) switchLight "ON"
(object 161) switchlight "ON"
(object 14121) switchlight "ON"
(object 173887) switchlight "ON"

Thanks.
Title: Re:switching lights back on
Post by: Planck on 24 Jun 2005, 23:50:35
Have you tried "AUTO" instead?


Planck
Title: Re:switching lights back on
Post by: Pilot on 24 Jun 2005, 23:54:00
This is just a shot in the dark, but what if you ran a seperate script with something like this:

Quote
#Loop
?time <= 2: goto "LightOn"
~1
goto "Loop"

#LightOn
object 18 switchlight "ON"
object 161 switchlight "ON"
object 14121 switchlight "ON"
object 173887 switchlight "ON"
goto "Loop"

Syntax not guarenteed

-Student Pilot
Title: Re:switching lights back on
Post by: pazuzu on 25 Jun 2005, 00:09:00
Ok, this would turn them back on I guess but how do I run this and at what point in the mission.

I mean would I just call the scipt from end trigger? So lights are turned back on before mission ends?

They have to be turned back on no matter how the mission ends(win or lose).

Do you know about exit.sqs?

I read it works like init.sqs but is activated at end of mission...

Does it work in MP?

Thanks for reply.
Title: Re:switching lights back on
Post by: qqqqqq on 25 Jun 2005, 00:09:15
Quote
This is just a shot in the dark

 ;D ;D
Title: Re:switching lights back on
Post by: pazuzu on 25 Jun 2005, 00:17:08
hehe...this is seriuos business...
Title: Re:switching lights back on
Post by: Pilot on 25 Jun 2005, 01:12:56
Quote
This is just a shot in the dark

 ;D ;D
Lol, I didn't even realize I said that, please forgive me ;D

Quote
Ok, this would turn them back on I guess but how do I run this and at what point in the mission.
Just run the script from the beginning.  When the mission is reloaded or restarted the time varibale is set to 0.  The script recognizes this and, when the mission is reloaded, it automatically turns the lights back on.  Then the script starts itself over so if the mission is reloaded again, it turns the lights back on again.

Quote
Do you know about exit.sqs?

I read it works like init.sqs but is activated at end of mission...
No, I don't know much about it.  But I think the reason it isn't working for you is when the mission is reloaded, it isn't considered the end of the mission.  Then end of the mission comes when an end trigger fires.

Quote
Does it work in MP?
I have no clue, I'm in the dark when it comes to mp scripting (I'm sorry, I couldn't resist ;D)

-Student Pilot
Title: Re:switching lights back on
Post by: pazuzu on 25 Jun 2005, 04:55:42
Thanks Student Pilot, your script worked perfectly.