moonPhase: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
(corrected example)
mNo edit summary
Line 23: Line 23:
[[private]] _waxing = [[false]];
[[private]] _waxing = [[false]];
[[private]] _fullMoonDates = [];
[[private]] _fullMoonDates = [];
[[for]] "_i" [[from]] [[dateToNumber]] [2016, 1, 1, 0, 0] [[to]] [[dateToNumber]] [_year, 12, 31, 23, 59] [[step]] 1 / 365 [[do]]
[[for]] "_i" [[from]] [[dateToNumber]] [_year, 1, 1, 0, 0] [[to]] [[dateToNumber]] [_year, 12, 31, 23, 59] [[step]] 1 / 365 [[do]]
{
{
_date = [[numberToDate]] [_year, _i];
_date = [[numberToDate]] [_year, _i];

Revision as of 13:17, 6 March 2017

-wrong parameter ("A3") defined!-[[:Category:Introduced with A3 version 1.58|1.58]]
Hover & click on the images for description

Description

Description:
Returns the phase of the in-game Moon on the given date in range 0...1, where 0 - new Moon, 1 - full Moon. According to this command the fullest Moon in Arma 3 at midnight is on setDate [4804,7,13,0,0]; Use Moon Phase Utility to find out date for a mission with desired moon.
Groups:
Uncategorised

Syntax

Syntax:
moonPhase date
Parameters:
date: Array - required date in date format
Return Value:
Number

Examples

Example 1:
_currentMoonPhase = moonPhase date;
Example 2:
// Returns array of dates for given year when moon is at its fullest fnc_fullMoonDates = { private _year = param [0, 2035]; private ["_date", "_phase", "_fullMoonDate"]; private _fullMoonPhase = 1; private _waxing = false; private _fullMoonDates = []; for "_i" from dateToNumber [_year, 1, 1, 0, 0] to dateToNumber [_year, 12, 31, 23, 59] step 1 / 365 do { _date = numberToDate [_year, _i]; _phase = moonPhase _date; call { if (_phase > _fullMoonPhase) exitWith { _waxing = true; _fullMoonDate = _date; }; if (_waxing) exitWith { _waxing = false; _fullMoonDates pushBack _fullMoonDate; }; }; _fullMoonPhase = _phase; }; _fullMoonDates }; //set random full moon date in year 1970 setDate selectRandom (1970 call fnc_fullMoonDates);

Additional Information

See also:
moonIntensitysunOrMoon

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

[[Category:Introduced with A3 version 1.58]][[ Category: A3: New Scripting Commands | MOONPHASE]][[ Category: A3: Scripting Commands | MOONPHASE]]

Notes

Bottom Section