Jump to content
  • 0

Custom day/night trigger for script


HeroeZGaming

Question

I'm working on a map addition for Chernarus that will be rubble during the day, and complete buildings at night.  I should hopefully have everything settled by tomorrow on the location and loot setup, but I'm looking for a trigger that will switch from the rubble city when the server restarts to night time to the complete buildings.  

 

ie, server is in daytime, and it's calling the rubble portion of the file/rubble file.  After the last daytime server restart, it will call the non rubble version with the loot and ai.  Is this even possible to link with day/night?  Any help, even pointing out other scripts using something similar would be much appreciated.   If TS works better, I'm on HeroeZGaming.Teamspeak3.com all day. 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Found a couple pieces of code within dayz_code that may help me.   Just not sure how to get them to help call script depending on day or night.

 

In compiles.sqf

world_isDay =                 {if ((daytime < (24 - dayz_sunRise)) && (daytime > dayz_sunRise)) then {true} else {false}};

 

if(world_isDay) then......   else{   I'm terrible at this, still learning.

 

This is the fn_curTimeStr.sqf

private ["_hrStr","_minStr","_curDate","_hr","_min","_strTime"];
_curDate = date;
_hr = _curDate select 3;
_min = _curDate select 4;
_hrStr = "";
_minStr = "";

if (_hr < 10) then {_hrStr = format["0%1",_hr]} else {_hrStr = format["%1",_hr]};
if (_hr == 0) then {_hrStr = "00"};
if (_min < 10) then {_minStr = format["0%1",_min]} else {_minStr = format["%1",_min]};
if (_min == 0) then {_minStr = "00"};
_strTime = format["%1%2 hrs",_hrStr,_minStr];
_strTime;

 

Found this baby in the local_lights_init.sqf

    //Detect Dusk && Dawn
    _sunrise = call world_sunRise;
    _fnHr =  _sunrise + 0.5;
    _stHr =  (24 - _sunrise) - 0.5;
    if(_rndLights>75)then{_rndLights=75;};//Max allowed
    //axeDiagLog = format["IL:LIGHTS STARTED: _stHr:%1 | _fnHr:%2 | time:%3 | for:%4",_stHr,_fnHr, dayTime, vehicle player];
    //publicVariable "axeDiagLog";
                
    while {alive player}do{
        if(daytime<_fnHr||daytime>_stHr)then{
        _plyr = vehicle player;
            //if(_plyPos distance _plyr > 6)then{//Only run if player moves
            _lightTrig = _plyr;

 

I understand I need to place something at the beginning of the script to check if it's daylight, or to only start at specific times, just not sure how to put it together. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...