Home   Help Search Login Register  

Author Topic: Night or day?  (Read 571 times)

0 Members and 1 Guest are viewing this topic.

KyleSarnik

  • Guest
Night or day?
« on: 19 Oct 2003, 23:54:52 »
Well... how would I detect the time in my script, like whether its night time or day time, basicly the same times that the streetlights and AI vehicle lights and AI NVGs go by...

KyleSarnik

  • Guest
Re:Night or day?
« Reply #1 on: 20 Oct 2003, 01:18:42 »
buy AI vehicle lights and AI NVGs I mean when the AI detects its the right time to use all of that stuff and when its the right time to stop using it...

thanks in advance  ;)

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Night or day?
« Reply #2 on: 20 Oct 2003, 01:39:29 »
From the command reference:

time
Type of returned value:
    Number
Description:
    time elapsed since mission start (in seconds)

As the editor, you set the time of day when the mission starts, so using that and this command, you can tell what time it is.
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!

KyleSarnik

  • Guest
Re:Night or day?
« Reply #3 on: 20 Oct 2003, 01:51:42 »
erm, sorry barron but thats not what im looking for. Basicly all I really need to do is detect if it is between two set times... like 17:00 and 6:00 (or whatever time lights go off in the morning).

Offline Sui

  • Former Staff
  • ****
    • OFPEC
Re:Night or day?
« Reply #4 on: 20 Oct 2003, 02:25:47 »
Try the:

daytime

command.

What this does is return the hour of day as a single number. So 1700 would be 17. 0600 would be 6.

However when you use it, don't ever use ==. Use less than and greater than instead, as it's not an integer. OFP uses the decimal to keep track of the minutes/seconds. So an actual value ends up being something like:

17.5567295

which would be about 1734 ;)

KyleSarnik

  • Guest
Re:Night or day?
« Reply #5 on: 20 Oct 2003, 02:57:49 »
thx Sui but im sorry to say that your just a little too late, I just finsihed perfecting that script now... But thanks for the help anyways... when I release my addon be sure to look for it...  ;) :thumbsup:

Offline General Barron

  • Former Staff
  • ****
  • Semper Fi!
Re:Night or day?
« Reply #6 on: 20 Oct 2003, 20:31:06 »
Okay, now I'm curious. What does your script do?
HANDSIGNALS COMMAND SYSTEM-- A realistic squad-control modification for OFP
kexp.org-- The best radio station in the world, right here at home! Listen to John Richards!