Home   Help Search Login Register  

Author Topic: setting time on a dedicated server [solved]  (Read 1266 times)

0 Members and 1 Guest are viewing this topic.

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
setting time on a dedicated server [solved]
« on: 19 May 2008, 04:57:32 »
greetings,

i have a MP mission i want to run on a dedicated server. at the beginning the time is 1400hrs... after a trigger is fired..a blackout occurs and the time fast forwards to 0200hrs.. np.. the problem is all JiP persons see the map at the beginning mission set time.. how do i change the time so it affects the dedicated servers time for all?

global time? only after the trigger is fired... JiP

thanks
« Last Edit: 19 May 2008, 11:14:05 by loki72 »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: setting time on a dedicated server
« Reply #1 on: 19 May 2008, 09:56:28 »
The following code publish date, overcast and fog levels to any player connecting.
Code: [Select]
// init.sqf
wantsinfo = objNull;
currentdate = 0;
currentovercast = -1;
currentfog = -1;

if (isServer) then
{
   currentovercast = random 0.5;
   0 setOverCast currentovercast;

   [] spawn
   {
      while {true} do
      {
         waitUntil {!isNull wantsinfo};
         wantsinfo = objNull;
         currentdate = daytime;         
         publicVariable "currentdate";
         currentovercast = overcast;
         publicVariable "currentovercast";
         currentfog = fog;         
         publicVariable "currentfog";
      };
   };
}
else
{
   waitUntil {alive player};
   wantsinfo = player;   
   publicVariable "wantsinfo";

   waitUntil {currentdate > 0};
   skipTime (currentdate - daytime);
   waitUntil {currentovercast != -1};
   0 setOverCast currentovercast;
   Sleep 1;
   waitUntil {currentfog != -1};
   0 setFog currentfog;
};

Offline loki72

  • Former Staff
  • ****
    • Loki's Nightmare
Re: setting time on a dedicated server [solved]
« Reply #2 on: 19 May 2008, 11:13:40 »
 :D
i don't know which is funnier.. i am starting to see why what you wrote works.. or that you are a scripting master.

it works perfect!

i sure hope you are on the ArmA 2 team...

thank you