OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: B-2-0 on 07 Oct 2003, 10:03:23
-
I have a mission in a desert with selectable time.
There are various fires dotted around the map which i would like to be lit at night but not during the day, as a fire in the desert in the day looks kinda weird.......i know i have to create a script that has all the fire names in an array, detects what time of day it is and lights the fires or puts them out accordingly but i have no clue how to create this script. ??? Can anyone help?
Thanx in advance
-
_firearray = [fire1,fire2,fire3,...]
?(daytime > 19) || (daytime < 5): "_x inflame true" foreach _firearray
exit
Try if that should work.
-
Ok, today is OFP take the piss out of B-2-0 day!!
Thx for the reply Artak!
The snippet u made didn't work so i played around with it a little and got some strange results.
_firearray = [fire1,fire2,fire3,fire4,fire5]
?(daytime > 19) || (daytime < 5): "_x inflame true" foreach _firearray
exit
Day = On
Night = On
--------------------------------------------
_firearray = [fire1,fire2,fire3,fire4,fire5]
?(daytime > 19) || (daytime < 5): "_x inflame false" foreach _firearray
exit
Day = On
Night = Off
---------------------------------------------
_firearray = [fire1,fire2,fire3,fire4,fire5]
?(daytime < 19) || (daytime > 5): "_x inflame true" foreach _firearray
exit
Day = On
Night = On
---------------------------------------------
_firearray = [fire1,fire2,fire3,fire4,fire5]
?(daytime < 19) || (daytime > 5): "_x inflame false" foreach _firearray
exit
Day = Off
Night = Off
----------------------------------------------
Now common sense told me that one of these four ways should work as there are only 4 possible outcomes...on on, off off, on off and off on (the one i want) but nooooo, OFP want's to take the piss out of me once again...lol
Anyone have the answer?
-
Did you put it in the Init.sqs or somewhere else where it's loaded before the briefing?
I keep reading the code over and over again and keep thinking it should work.
The one thing I can think of is that you have daytime between 05:00 and 19:00 in the editor, and as the player chooses night, the script still uses the time from editor first.. so.. umm.. what if you'd put a short delay to the start to let the daytime starting param kick in.
It's pretty thin, but maybe, just maybe.. :P
-
Do you have accelerated time or somthing?
I suppose that when the scripts fail, the triggers come to the rescue!
Make a trigger, triggered by timeout, and simply make it turn on the fires by setting a global variable to true...have it another script set the variable to false, 12 hrs after the first is activated(Or whatever the night is...)
You only need 3 triggers to do it...
-
Ok, i am a complete idiot...lol ;D
I only went and had the fires still inflame true in their init fields didn't i ::)
Works fine know, thanx Artak :)