setDate: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "[[Category:Scripting Commands ArmA|" to "[[Category:Scripting Commands Armed Assault|")
(Use Date format)
Line 7: Line 7:


|eff= local |Multiplayer Effects=
|eff= local |Multiplayer Effects=
____________________________________________________________________________________________


____________________________________________________________________________________________
| Sets mission date and time. This command is fully JIP compatible (as of Arma 3 v1.93.145588). Players joining after mission start will get the current server [[date]] including the year.
 
{{Feature arma3 | Clients' local date is [[Multiplayer Scripting#Join In Progress|automatically and periodically synchronised]] with the server date.}} |DESCRIPTION=


| Sets mission date and time. This command is fully JIP compatible (as of Arma 3 v1.93.145588). Players joining after mission start will get the current server [[date]] including the year. <br><br>
|mp= In order to change the date without waiting for automatic synchronisation, use remote execution:
{{Informative | While it seems that when [[setDate]] is executed on the server it propagates to clients, this could be the result of other synchronizations performed by the engine. The command has [[local]] effect and this hasn't changed. In order to globally change the date in the middle of the mission, use remote execution:<br><tt><nowiki>[</nowiki>[2001,6,22,12,0]] [[remoteExec]] ["setDate"]</tt>}} |DESCRIPTION=
{{Inline code|[<nowiki/>[2001,6,22,12,0]] [[remoteExec]] ["setDate"];}} |MP BEHAVIOUR=
____________________________________________________________________________________________
____________________________________________________________________________________________


| '''setDate''' [year, month, day, hour, minute] |SYNTAX=
| [[setDate]] date |SYNTAX=


|p1= [year, month, day, hour, minute]: [[Array]] |PARAMETER1=
|p1= date: [[Date]] - format [year, month, day, hour, minute] |PARAMETER1=


| [[Nothing]] |RETURNVALUE=
| [[Nothing]] |RETURNVALUE=
____________________________________________________________________________________________
____________________________________________________________________________________________
   
   
|x1= <code>[[setDate]] [1986, 2, 25, 16, 0]; //(4:00pm February 25, 1986)</code> |EXAMPLE1=
|x1= <code>[[setDate]] [1986, 2, 25, 16, 0]; {{cc|4:00pm February 25, 1986}}</code> |EXAMPLE1=
|x2= Set real date: <code>//postInit = 1;
 
[[if]] ([[isServer]]) [[then]]  
|x2= Set the real date (MP only):
<code>{{cc|postInit {{=}} 1;}}
[[if]] ([[isServer]]) [[then]]
{
{
[[waitUntil]] {[[time]] > 0};
[[waitUntil]] {[[time]] > 0};
<nowiki>[</nowiki>[[missionStart]] [[select]] [0,5]] [[remoteExec]] ["setDate"];
[<nowiki/>[[missionStart]] [[select]] [0,5]] [[remoteExec]] ["setDate"];
};</code> |EXAMPLE2=
};</code> |EXAMPLE2=
____________________________________________________________________________________________
____________________________________________________________________________________________


| [[date]], [[skipTime]], [[numberToDate]], [[dateToNumber]] |SEEALSO=
| [[date]], [[skipTime]], [[numberToDate]], [[dateToNumber]] |SEEALSO=
}}
}}


Line 46: Line 50:
<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.
<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.


<!-- Note Section END -->
</dl>
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|SETDATE]]
[[Category:Scripting Commands OFP Elite |SETDATE]]
[[Category:Scripting Commands Armed Assault|SETDATE]]
[[Category:Command_Group:_Mission_Information|SETDATE]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]


<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on October 4, 2014 - 17:43 (UTC)</dd>
<dd class="notedate">Posted on October 4, 2014 - 17:43 (UTC)</dd>
<dt class="note">[[User:MulleDK13|MulleDK13]]</dt>
<dt class="note">[[User:MulleDK13|MulleDK13]]</dt>
<dd class="note">
<dd class="note">
Since an unknown version of ARMA 3, 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>
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on February 5, 2015 - 06:38 (UTC)</dd>
<dd class="notedate">Posted on February 5, 2015 - 06:38 (UTC)</dd>
<dt class="note">[[User:Ozdeadmeat|Ozdeadmeat]]</dt>
<dt class="note">[[User:Ozdeadmeat|Ozdeadmeat]]</dt>
Line 75: Line 62:
Arma 3 1.38.128937- Leapyear BUG - setdate [2016,12,31,23,59] yields an ingame date of the 1st of January 2017. If left to tick over from the 30th of December it ticks to 1st January skipping the 31st of December entirely.
Arma 3 1.38.128937- Leapyear BUG - setdate [2016,12,31,23,59] yields an ingame date of the 1st of January 2017. If left to tick over from the 30th of December it ticks to 1st January skipping the 31st of December entirely.
</dd>
</dd>
</dl>
<!-- DISCONTINUE Notes -->


<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on April 23, 2017 - 02:58 (UTC)</dd>
<dd class="notedate">Posted on April 23, 2017 - 02:58 (UTC)</dd>
<dt class="note">[[User:OOKexOo|OOKexOo]]</dt>
<dt class="note">[[User:OOKexOo|OOKexOo]]</dt>
Line 86: Line 69:
<code>[[], {[[setDate]] [1986, 2, 25, 16, 0]}] [[remoteExec]] ["[[call]]",0,"JIP_id_setDate"];</code>  
<code>[[], {[[setDate]] [1986, 2, 25, 16, 0]}] [[remoteExec]] ["[[call]]",0,"JIP_id_setDate"];</code>  
</dd>
</dd>
<!-- Note Section END -->
</dl>
</dl>
<!-- DISCONTINUE Notes -->
 
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands OFP Elite |{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Armed Assault|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 2|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Arma 3|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting Commands Take On Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Command Group: Mission Information|{{uc:{{PAGENAME}}}}]]

Revision as of 22:47, 30 June 2020

-wrong parameter ("Arma") defined!-1.00
Hover & click on the images for description

Description

Description:
Sets mission date and time. This command is fully JIP compatible (as of Arma 3 v1.93.145588). Players joining after mission start will get the current server date including the year.
Arma 3
Clients' local date is automatically and periodically synchronised with the server date.
Multiplayer:
In order to change the date without waiting for automatic synchronisation, use remote execution: [[2001,6,22,12,0]] remoteExec ["setDate"];
Groups:
Uncategorised

Syntax

Syntax:
setDate date
Parameters:
date: Date - format [year, month, day, hour, minute]
Return Value:
Nothing

Examples

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

Additional Information

See also:
dateskipTimenumberToDatedateToNumber

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

Notes

10:00, 7/12/2010 (BST)
Alpha
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.
21:35, 31 October 2011 (EET)
Osmo
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.
Posted on October 4, 2014 - 17:43 (UTC)
MulleDK13
Since an unknown version of Arma 3, this command now has global effect when executed on the server.
Posted on February 5, 2015 - 06:38 (UTC)
Ozdeadmeat
Arma 3 1.38.128937- Leapyear BUG - setdate [2016,12,31,23,59] yields an ingame date of the 1st of January 2017. If left to tick over from the 30th of December it ticks to 1st January skipping the 31st of December entirely.
Posted on April 23, 2017 - 02:58 (UTC)
OOKexOo
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"];

Bottom Section