Jump to content
Sign in to follow this  
Bigus Dickus

problem with night to day script

Recommended Posts

ok ive made a CTF map abit liek a old map in ofp where it will go night to day in the mission over 30 mins.

now it all works fine apqart from 1 thing. in ofp it wud work fine but done to jip it means that the script works but people see night an day different times dow nt ot the tiem they join.

heres my script

Quote[/b] ]

_i = 0

#loop

_i = _i + 1

skipTime 0.005

~0.1

? _i > 100000 : goto "konec"

goto "loop"

#konec

i probably got to make a toally diufferent script where the server updates wot time it is and sends to any playets joing but can anyone help ?.

Share this post


Link to post
Share on other sites

I dont know about the synchronization of the players time.

I used a script to 'skiptime'. I had 50x speed, and after a few minutes of real time, days would pass in ArmA. However, at the end of the mission, each player reported that the game lasted different lenghts of time. The difference was random, and many hours. One guy reported 60, another 80, and yet we all started the map together. Quite strange.

the script was found here in the editing section. I forget the title, so I will just post the code. It is not what you are asking for, I know, but I wished to share my experience.

time.sqs

Quote[/b] ];Skips Daytime and Nighttime at different intervals (to raise fun a bit)

;Day and Night will last X hours each

;X is skiptime value in hours

~1

timephase = ""

#timeloop

~0.1

;Daycycle

?((daytime >= 5.5) AND (daytime <= 18.5)): goto "dayskip"

;Nightcycle

?((daytime > 18.5) OR (daytime < 5.5)): goto "nightskip"

goto "timeloop"

#dayskip

skiptime 0.020

timephase = "Day"

goto "timeloop"

#nightskip

skiptime 0.020

timephase = "Night"

goto "timeloop"

Share this post


Link to post
Share on other sites

cheeres ye think this script cus jip is guna b abit tricky.

my script ran really nice maybe abit to fast as it went from day to night and back to morning in 10 mins kinda ok for ctf as that means u should get day night 3 times a map. Anytway i gues wot where looking for is some sort of script that sends off things server side to make this happen. i mena i cant make a time thing skip timeevery 5mins as if the script is done and someone joins they may not b in that time zone and there for for 5 mins to the nextscript it may mean some c light some dark. i guess what i need is not something that accels time but something that says go to different times .dunno how that wu act on the server but wud prolly have to update every 10 seconds.

Share this post


Link to post
Share on other sites

It works. I have written that little script for my mission "Wine Wars". Just don't forget to modify your init.sqf/sqs.

Share this post


Link to post
Share on other sites

JIP players dont start synchronised to the following

daytime, if skiptime has been used

all weather types, setfog etc

Share this post


Link to post
Share on other sites

That's why I have this little variable, which is published when a new player connects. smile_o.gif

Share this post


Link to post
Share on other sites
That's why I have this little variable, which is published when a new player connects. smile_o.gif

sorry not to sounda noob but can u post the script in this thread as the other 1 has about 5 scripts in it and im not sure wot 1 i need. the idea is its a CTF map for only 30 mins. I want to see my map go from day to night then bk to day within the 30 mins. The prob i have is the script rusn fine the sky looks ok and the shadows as time passes is brilliant iu can see the sun move from north to east and then darkness. does yourr script make it light then suddenyl go dark isntantly or does it flow smooth ?. i jsut need some way to make my script server side sending out wot time it is for the entire 30 mins so it runs that way. just with jip if a player joins 10 misn in hes at the start of my script then has to wait about 5 mins for it to go dark. this script as i see it looks like when people join it starts for them at midnight then goes so im abit confused.

Share this post


Link to post
Share on other sites

skiptime.sqf:

<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];

};

init.sqf:

<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=480;

publicvariable "startminute";

};

onplayerconnected "publicvariable ""startminute""";

_script=[] execVM "skiptime.sqf";

You also need a game logic called "server" on the map.

the variable startminute to another value. For 1 am, you need to set it to 60. For 2 am, you need to set it 120 etc.

In order to increase the acceleration, just play around with the sleep value in the for loop.

Share this post


Link to post
Share on other sites

aa thx now it works lol i was doign itwrong.. i thoguht the mins time was liek if u wanted it to work at 2 u did 1400 so no wonder it never worked lol. cheers smile_o.gif now i know its for mins so if i want it to go to dark in 15 mins i jsut type 15 biggrin_o.gif cool.

ps anyway to make the time change smoother ? in my script if u wnt to try it just ad it into the init file u will c shadows move and it runs soo nice smile_o.gif.

o ps im also getting a pool error somewhere i dont get to read it thou and also as its arma i have to use SQS right nto SQF ?

thisi s my current init as i had to ad stuff for CTF too maybe spacing is wrong is wy i get errors ?.

Quote[/b] ]

setviewdistance 600

?param1 > 10 and param1 < 10000 : estimatedTimeLeft param1

flagreturndelay = 60

?!local server:goto "skip"

WScore=0

publicvariable "WScore"

EScore=0

publicvariable "EScore"

WBonus=0

publicvariable "WBonus"

EBonus=0

publicvariable "EBonus"

ownerW=objnull

publicvariable "ownerW"

ownerE=objnull

publicvariable "ownerE"

WFlagTaken=false

publicvariable "WFlagTaken"

EFlagTaken=false

publicvariable "EFlagTaken"

TimeEnd=0

publicvariable "TimeEnd"

outro=0

publicvariable "outro"

};

#skip

WScore=WScore

EScore=EScore

ownerW=ownerW

ownerE=ownerE

WFlagTaken=WFlagTaken

EFlagTaken=EFlagTaken

TimeEnd=TimeEnd

~0.001

[] exec "intro.sqs"

[] exec "anticheat.sqs"

if (local server) then

{

startminute=15;

publicvariable "startminute";

};

onplayerconnected "publicvariable ""startminute""";

_script=[] execVM "time.sqs";

exit

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  

×