Jump to content
PSYKO_nz

add a daylight time restriction for an add action

Recommended Posts

hi there, 

 

I'm wanting to restrict m,y addaction to being only available during daylight, currently the player has to be within 6 meters for it to show up but I would like that to be restricted to the hours of 0600 - 1900 as well

 

in other words. the player can only activate it if it is daylight and they are close enough to the item

Share this post


Link to post
Share on other sites

add this simple condition (8th inner param of addAction):

sunOrMoon > 0.5

true for daylight. Transition (0 to 1) during dusk and dawn is quick. That's enough for a true/false condition.

Share this post


Link to post
Share on other sites

worked like a charm!

 

is there any way to fine tune it?

 

it's a little too dark when it starts/stops working at the moment 

Share this post


Link to post
Share on other sites

you can play with this boolean instead:

 

(dayTime > (date call BIS_fnc_sunriseSunsetTime) select 0) && (dayTime < (date call BIS_fnc_sunriseSunsetTime) select 1)

 

true for dayLight between the sunrise and sunset of the day. you can add some figures if needed, to modify the values.

Share this post


Link to post
Share on other sites

ok, so my add action looks like this...


this addAction["<t color='#ff9900'>Skydive Altis</t>", "ATM_airdrop\atm_airdrop.sqf",[],1,false,true,"","_this distance _target < 2, sunOrMoon > 0.5"];

where would the edited boolean code go?

Share this post


Link to post
Share on other sites

"_this distance _target < 2 && sunOrMoon > 0.5"

or

"_this distance _target < 2 && (dayTime > (date call BIS_fnc_sunriseSunsetTime) select 0) && (dayTime < (date call BIS_fnc_sunriseSunsetTime) select 1)"

 

Share this post


Link to post
Share on other sites

working great so far! please forgive me but what numbers should I change or add, I'm getting so close to this being spot on, how would I delay turning the addiction off by 30 mins for sunset and make it work 30 mins earlier for sunrise  (in-game time not real world)???

if it's not possible that's ok, 5 am to 7 pm is a good set of business hours for a local company haha

Share this post


Link to post
Share on other sites

Simple:

"_this distance _target < 2 && (dayTime > ((date call BIS_fnc_sunriseSunsetTime) select 0) - 0.5) && (dayTime < ((date call BIS_fnc_sunriseSunsetTime) select 1) + 0.5)"

Share this post


Link to post
Share on other sites

Oooooo I was so close!!

 

when I was trying it before i asked in the last post I was doing -0.5 instead of - 0.5!!

 

thank you so much for your help :)

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×