Jump to content
Sign in to follow this  
satexas69

Mission time - increase "time" speed

Recommended Posts

In a mission I'm making, it starts out at night, and it's a long mission. I'd like it to "cycle" not just "day to night" or "night to day", but a full cycle of night-day-night-day....

Is there a function to have the clock run "abnormally fast" while the mission is running? I can't seem to find one, and it seems like I played some old OFP maps that used to do that.

Share this post


Link to post
Share on other sites

Here is some SQF code for you:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">sleep 5;

setDate [2007,6,21,0,startminute];

for [{_i=0},{_i<1},{_i=_i}] do

{

sleep 5;

startminute = startminute + 1;

if (startminute >= 1440) then

{

startminute = startminute -1440;

};

setDate [2007,6,21,0,startminute];

};

A day will be 2 real hours. Note that the date will be always the same though (june 21). With a small tweak, you can have that changed.

I used setDate, because it doesn't calculate the cloud formations unlike skiptime. Looks really odd if the clouds are jumping around everytime the time is skipped.

You have to set the variable startminute in your init.sqf. 0 for midnight, 720 for noon.

Share this post


Link to post
Share on other sites

Tigga,

Thanks, that's exactly what I'm after. After I made the SQF file (say, time.sqf) and put it in my missions directory, how do I "call it" active into the mission itself?

When you speak of the setminute variable, I assume for midnight it would be:

startminute = 0;

COLSanders: I author MP maps for dedi servers, not SP.. but thanks.

Share this post


Link to post
Share on other sites

Just write this in the init.sqf or sqs:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">startminute = 0; //Or whatever you want

_timescript = [] execVM "time.sqf";

If you want to make it JIP-Ready , write your init.sqf like this:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (local server) then

{

startminute = 0;

publicvariable "startminute";

};

_timescript = [] execVM "time.sqf";

onplayerconnected "publicvariable ""startminute""";

Now you need a gamelogic called server on your map and your ready to go.

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
Sign in to follow this  

×