OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: bedges on 13 Aug 2005, 14:04:58
-
m'kay. flashpoint being as complex and real-worldish as it is, the sun sets at different times depending on the time of year.
what i need is some way of detecting when it's dark. the daytime command is not all that useful here, for the reason outlined above. the only way i can think of is to catch a streetlight and find out if it's lit or not...
but what about islands without lights?
EDIT - and checking the streetlight doesn't seem to work. they return "auto" rather than 'on'...
-
a number of half-wit ideas :P:
maybe you could have a AI unit like a chopper or jeep on safe mode and check if its lights are on (can that be done?) because the AI tend to put them on when its dark. - you never know, it could work.
beyond that, the game itself must have some way for the street lights to know whether its dark or not which could be buried deep in the config. the ECP guys might know a thing or two about this.
make a script which will do this by comparing daytime to the date and such like. it would be dull but i think it could be done.
other that I can't think of anything....
-
mhmm, a few of those crrrazy ideas went through my mind also ;)
detecting a vehicle unit's lights is also not possible it seems.
as far as i know there's no 'date' command, otherwise i could possibly script something which approximates the sunset time... bah humbug!
i may well ask someone in the ecp team, that seems a good bet.
cheers anyways 8)
-
Have you done a search? I recall reading a thread about a script that calculates sunrise and sun set times based on the date. It was a few months ago now.
-
:-[ ach min - anyone ever tell you you're brillant?
found what i'm after here (http://www.ofpec.com/forum/index.php?topic=19123;start=0). idiot me for not searching properly...
-
this would make a nifty function. that way all we'd have to do was call daylight.sqf.
*makes suggestion in function requests*
-
only problem being it doesn't work.... at least not in SP as it relies on missionstart.
-
put it in the init.sqs maybe? or does missionstart give the date??
-
My thought on this is that you'd have to open up mission editor and go to the Longest day 6-21/22 shortest 12-21/22 as well as March and Sept 21/22 write down the times of sunrise and sunset. Using no cloud cover on the Selections as to see clear Sunsets.(standing by a town and sea watching lights truning On and Off)
Do the math and write a script.
A little of trial and error and a little of Caculations here.
Not Fancy or really fast but should get the Job done. :P
-
that part of it is pretty simple. the difficulty is finding out what date it is... :P
-
Oh well, not knowing what I'm talking about never stops me 8)
vehicle actions to turn headlights on / off, are removed during 'daylight'. Since you can andd and delete actions, can you test for their presence also?
-
interesting idea... i wonder. hmmmm.....
-
I won't give up on the idea of math solving this and the "angle' of Island with no lights.
Count the days as in Jan. 1 = 1 to Dec. 31 = 365
So Feb 28 = 59
So for a Script to check which day it is, a person using it would have to type it in.
Is there a way to check the INTEL window date in a script or such?? If so then can it be transferred to numbers easily.
Where my idea is going?? I have no Idea ???
Just some thoughts here.
By the way you may Know this, Jan 1 in the game starts on a Tuesday.
-
OK I'll admitt it. Math won't slove this True Sensor problem :'(.
If you are looking for a Light sensor that works all the time then Mikero's Idea is probably the right track to go on.
I set up a little test Jan 1 @ 7:30 am.
Me as a Player Officer and a Jeep with it's reg. loons inside. All of us on the east side fo Malden beach watching the sun come up.
Test 1. Early Morning at default clouds and the like. One could see the sun coming up and the surrounding area seem bright enough. However the jeep turned off it's Lights at 7:47.~20sec.
Next: Did the same on everything else and except made it as clear as I possible could. The Jeeps lights went off at 7:33 and about ~10 sec.
3rd one was a fog one and it turned off the lights around 7:38.~25sec.
So for a True Light Sensor, Mikero's idea!!
And I'll, just Shut-Up about this :-X
Sharkyjoe
-
excellent :) now all i need to do is find out how to interrogate a jeep's driver to see if he has the lights on or off... :-\
-
what about a soldier with NVG's if he has them on its dark and you might be able to do it with hasweapon just another though if you cant do the jeep one
-
ah.....cleverr......
;)
-
Nah, what's clever is a genius like me coming up with the solution without having to actually find out how to make it work! Now, that's clever 8) ;D
-
Clever indeed,
I searched this thread for your solution, and it seems what is clever is "a genius like you coming up with a solution, without actually having to come up with a solution, OR make it work" - nice one! :P ;)
-
off-topic gentlemen, as your posts freely admit. tsktsk... :hmm:
anyways, at present there seems no way to interrogate loons with nvgoggles or loons in jeeps with lights. no way to get at the number of actions in a vehicle, no way to tell if the nvgoggles are on or off. hasweapon simpy states that nvgoggles exist.
temporary solution is to include a dialog for the player to manually enter the date, or a field in the init.sqs file.
thanks for the help anyways 8)
-
Turn the missioneditor to advanged.
Turn on ID's
Find the ID of a streetlamp (74632 (made that one up))
#Loop
~60
? (74632 inflame false) : GOTO #Loop
Execute my code here
exit
Thats my suggestion.
-
One problem is.... standard streetlights are not affected by inflame. Its an action switch like auto, on, off. ;)
off-topic gentlemen, as your posts freely admit. tsktsk... Hmmm.....
Can never have fun when its the mod's thread. ::) ;D
-
>off-topic gentlemen, as your posts freely admit. tsktsk...
ooo, you know how much I like it when you whip me.
---
Umm, is this far fetched?
could you make a small addon that overrides the action of a 'standard' streetlamp. Such that when it is told to fire up it destroys itself (setdamage=1.0)
that way you could test for it right?
I know you can override the action with an inflame type of script, but I don't know if it's 'automatically' used by the engine.
maybe i should shut up.
-
all help is appreciated, mikero, you don't need to shut up. i like hearing you yelp :P
the question is moot. i'd rather not get into anything overly complicated - all i wanted was a generic way of finding out when it gets dark in any mission, without explicitly knowing beforehand, but it seems unlikely to happen using any of the traditional means.
thanks to all contributors 8)