Difference between revisions of "setDate"

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "\|x([0-9]) *= * <code>([^<]*)<\/code>" to "|x$1= <sqf>$2</sqf>")
m (Some wiki formatting)
 
(2 intermediate revisions by the same user not shown)
Line 28: Line 28:
  
 
|mp= {{Feature|arma3 |Clients' local date is [[Multiplayer Scripting#Join In Progress|automatically and periodically synchronised]] with the server date.<br>
 
|mp= {{Feature|arma3 |Clients' local date is [[Multiplayer Scripting#Join In Progress|automatically and periodically synchronised]] with the server date.<br>
In order to change the date without waiting for automatic synchronisation, use remote execution: {{ic|[<nowiki/>[2001,6,22,12,0]] [[remoteExec]] ["setDate"];}}}}
+
In order to change the date without waiting for automatic synchronisation, use remote execution: <sqf inline>[[2001,6,22,12,0]] remoteExec ["setDate"];</sqf>.}}
{{Feature | Warning | While the game creates February 29th in a leap year, it removes December 31st. For example [[setDate]] [1980,12,31,12,0] will result in game jumping to [1981,1,1,12,0] as 1980 is a leap year.}}
+
{{Feature|warning|While the game creates February 29th in a leap year, it removes December 31st. For example <sqf inline>setDate [1980,12,31,12,0]</sqf> will result in game jumping to [1981,1,1,12,0] as 1980 is a leap year.}}
  
 
|s1= [[setDate]] date
 
|s1= [[setDate]] date
  
|p1= date: [[Date]] - format [year, month, day, hour, minute]
+
|p1= date: [[Array]] format [[Date]]
  
 
|r1= [[Nothing]]
 
|r1= [[Nothing]]
Line 39: Line 39:
 
|x1= <sqf>setDate [1986, 2, 25, 16, 0]; // 4:00pm February 25, 1986</sqf>
 
|x1= <sqf>setDate [1986, 2, 25, 16, 0]; // 4:00pm February 25, 1986</sqf>
  
|x2= <sqf>// Set the real date (MP only):// postInit {{= 1;}}
+
|x2= <sqf>
 +
// postInit = 1;
 +
// Set the real date (MP only):
 
if (isServer) then
 
if (isServer) then
 
{
 
{
waitUntil {time > 0};
+
waitUntil { time > 0 };
[missionStart select [0,5]] remoteExec ["setDate"];
+
[missionStart select [0, 5]] remoteExec ["setDate"];
};</sqf>
+
};
 +
</sqf>
  
 
|seealso= [[date]] [[skipTime]] [[numberToDate]] [[dateToNumber]]
 
|seealso= [[date]] [[skipTime]] [[numberToDate]] [[dateToNumber]]
 
}}
 
}}
  
<dl class="command_description">
+
{{Note
 +
|user= Alpha
 +
|timestamp= 20121207111000
 +
|text= This command sets the date for the southern hemisphere only, i.e. when the map is in northern hemisphere a date [2010,12,7,17,0] is in day light and and date [2010,6,7,17,0] is in darkness.
 +
}}
  
<dt><dt>
+
{{Note
<dd class="notedate">10:00, 7/12/2010 (BST)
+
|user= Osmo
<dt class="note">[[User:Alpha|Alpha]]</dt>
+
|timestamp= 20111031210700
<dd class="note">This command sets the date for the southern hemisphere only, i.e. when the map is in northern hemisphere a date [2010,12,7,17,0] is in day light and and date [2010,6,7,17,0] is in darkness.
+
|text= In multiplayer, the effect of this command is local, not global. The date from the server is synchronized with clients when they join the game (including start of the mission and joining in progress). E.g. if this command is executed on server in the init.sqf before the mission starts, every client will be synchronized with server as mission is started. However, if you run this command in the middle of the mission, effect is local.
<dt><dt>
+
}}
<dd class="notedate">21:35, 31 October 2011 (EET)
 
<dt class="note">[[User:Osmo|Osmo]]</dt>
 
<dd class="note">In multiplayer, the effect of this command is local, not global. The date from the server is synchronized with clients when they join the game (including start of the mission and joining in progress). E.g. if this command is executed on server in the init.sqf before the mission starts, every client will be synchronized with server as mission is started. However, if you run this command in the middle of the mission, effect is local.
 
  
<dt><dt>
+
{{Note
<dd class="notedate">Posted on October 4, 2014 - 17:43 (UTC)</dd>
+
|user= MulleDK13
<dt class="note">[[User:MulleDK13|MulleDK13]]</dt>
+
|timestamp= 20141004174300
<dd class="note">
+
|text= Since an unknown version of {{arma3}}, this command now has global effect when executed on the server.
Since an unknown version of {{arma3}}, this command now has global effect when executed on the server.
+
}}
</dd>
 
  
<dt><dt>
+
{{Note
<dd class="notedate">Posted on April 23, 2017 - 02:58 (UTC)</dd>
+
|user= OOKexOo
<dt class="note">[[User:OOKexOo|OOKexOo]]</dt>
+
|timestamp= 20170423025800
<dd class="note">
+
|text= Regarding execution in the middle of a session, the post of [[User:MulleDK13|MulleDK13]] is not entirely true. If you don't change the year, you are perfectly fine when executing the command on the server only. However, the server does not sync the year. Hence, if you do change the year, you have to execute the command on the server, clients and JIP to account for the missing sync. e.g.
Regarding execution in the middle of a session, the post of [[User:MulleDK13|MulleDK13]] is not entirely true. If you don't change the year, you are perfectly fine when executing the command on the server only. However, the server does not sync the year. Hence, if you do change the year, you have to execute the command on the server, clients and JIP to account for the missing sync. e.g.
+
<sqf>[[], { setDate [1986, 2, 25, 16, 0] }] remoteExec ["call", 0, "JIP_id_setDate"];</sqf>  
<code>[[], {setDate [1986, 2, 25, 16, 0]}] remoteExec ["call",0,"JIP_id_setDate"];</code>  
+
}}
</dd>
 
 
 
</dl>
 

Latest revision as of 17:26, 25 July 2022

Hover & click on the images for description

Description

Description:
Sets mission date and time. Players joining after mission start will get the current server date including the year.
Multiplayer:
Arma 3
Clients' local date is automatically and periodically synchronised with the server date.
In order to change the date without waiting for automatic synchronisation, use remote execution: [[2001,6,22,12,0]] remoteExec ["setDate"];.
While the game creates February 29th in a leap year, it removes December 31st. For example setDate [1980,12,31,12,0] will result in game jumping to [1981,1,1,12,0] as 1980 is a leap year.
Groups:
Mission InformationEnvironment

Syntax

Syntax:
setDate date
Parameters:
date: Array format Date
Return Value:
Nothing

Examples

Example 1:
setDate [1986, 2, 25, 16, 0]; // 4:00pm February 25, 1986
Example 2:
// postInit = 1; // Set the real date (MP only): if (isServer) then { waitUntil { time > 0 }; [missionStart select [0, 5]] remoteExec ["setDate"]; };

Additional Information

See also:
date skipTime numberToDate dateToNumber

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
Alpha
Posted on Dec 07, 2012 - 11:10 (UTC)
This command sets the date for the southern hemisphere only, i.e. when the map is in northern hemisphere a date [2010,12,7,17,0] is in day light and and date [2010,6,7,17,0] is in darkness.
Osmo
Posted on Oct 31, 2011 - 21:07 (UTC)
In multiplayer, the effect of this command is local, not global. The date from the server is synchronized with clients when they join the game (including start of the mission and joining in progress). E.g. if this command is executed on server in the init.sqf before the mission starts, every client will be synchronized with server as mission is started. However, if you run this command in the middle of the mission, effect is local.
MulleDK13
Posted on Oct 04, 2014 - 17:43 (UTC)
Since an unknown version of Arma 3, this command now has global effect when executed on the server.
OOKexOo
Posted on Apr 23, 2017 - 02:58 (UTC)
Regarding execution in the middle of a session, the post of MulleDK13 is not entirely true. If you don't change the year, you are perfectly fine when executing the command on the server only. However, the server does not sync the year. Hence, if you do change the year, you have to execute the command on the server, clients and JIP to account for the missing sync. e.g.
[[], { setDate [1986, 2, 25, 16, 0] }] remoteExec ["call", 0, "JIP_id_setDate"];