Jump to content
Sign in to follow this  
warleader6

mission starts with random time of day?

Recommended Posts

does anyone have a a method or script that you can add to your mission so each start has a radom time of day? thanks

Share this post


Link to post
Share on other sites

Untested, maybe works maybe not :)

Add to init.sqf:

if (isServer) then
{
myNewTime = random 24;
publicVariable "myNewTime";
};
waitUntil{not isNil "myNewTime"};
skipTime myNewTime;

Edited by Fincuan

Share this post


Link to post
Share on other sites

Fincuan thank you it works brilliant, :yay: the random day and night has given my first mission the feel I was looking for. Nice to have guys like around you that help noobs like me. :)

Share this post


Link to post
Share on other sites

Yep, shows that you've played like 20 hours etc. :D

Share this post


Link to post
Share on other sites

a little help needed.

for some reason it did not work for me. I copied the exact lines you provided into my init file. I put it at the top because right now my init file has the configurations in it for SecOP Module. These files are placed in my mission folder. I start the game go to multiplayer and create. I make a room and chose a player then start and it is always the default time. any help is appreciated. The one thing I wonder is.....when I save my mission in the editor. I chose export to multiplayer. It seems to not create any folder in my documents/arma II/other profiles/MPmissions. it is updated in my missions folder, yet is stil available in multiplayer. Could this be the problem? do I need to physically copy and paste the mission folder into the MP mission folder? thanks for any help

Share this post


Link to post
Share on other sites

I think the 'export' options write it to a .pbo in the 'Missions' or 'MPMissions' folder under the game installation directory, rather than in your specific player profile directory.

Share this post


Link to post
Share on other sites

I see no reason why the above snippet wouldn't work in multiplayer, especially if you are the host. Weird things normally happen if you're a client on a dedicated- or player-server, but if you're the host things should work exactly the same as in singleplayer 99% of the time.

Share this post


Link to post
Share on other sites

Does setDate work in multiplayer? There's nothing about locality in the wiki. If you're worried about the mission saying it took 20 hours to complete etc., it might be worth looking at. Maybe you could synchronise a variable from the server to all clients to have them set their local time, assuming the game doesn't sync the time from setDate automatically.

Share this post


Link to post
Share on other sites

setDate does work in MP and is local as far as I know. The above snippet could easily be adapted to use setDate:

if (isServer) then
{
_date = date;
_t = random 24;
_hours = floor _t;
_minutes = (_t - _hours)*60;
newDate = [_date select 0, _date select 1, _date select 2, _hours, _minutes];
publicVariable "newDate";
};
waitUntil{not isNil "newDate"};
//Add time passed since mission start to accomodate JIP players
setDate [newDate select 0, newDate select 1, newDate select 2, newDate select 3, (newDate select 4)+(time/60)];

Share this post


Link to post
Share on other sites

Is there a way of keeping time the same time of day, say 18:30 hours of constant time.

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  

×