Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Title: NUP_fnc_initEnvironment
- //File: NUP\NUP_flagCapture\functions\fn_initEnvironment.sqf
- //Author: Dapperstache
- //Purpose: called on mission start to alter mission environment
- //Usage: [] spawn DAP_fnc_initEnvironment;
- // Define variables
- private["_OBR_time", "_OBR_weather", "_OBR_fogAmt", "_OBR_rain", "_OBR_windStr", "_OBR_windFrc", "_OBR_windGst", "_OBR_lightnings", "_OBR_waveInt", "_systemTime", "_year", "_month", "_day", "_hour", "_minute"];
- // Get values from Description.ext
- _OBR_time = "OBR_timeOfDay" call BIS_fnc_getParamValue;
- _OBR_weather = "OBR_overcast" call BIS_fnc_getParamValue;
- _OBR_fogAmt = "OBR_fog" call BIS_fnc_getParamValue;
- _OBR_rain = "OBR_rain" call BIS_fnc_getParamValue;
- _OBR_windStr = "OBR_windStrength" call BIS_fnc_getParamValue;
- _OBR_windFrc = "OBR_windForce" call BIS_fnc_getParamValue;
- _OBR_windGst = "OBR_windGusts" call BIS_fnc_getParamValue;
- _OBR_lightnings = "OBR_lightning" call BIS_fnc_getParamValue;
- _OBR_waveInt = "OBR_waves" call BIS_fnc_getParamValue;
- diag_log format ["_OBR_weather fetched from description.ext: %1", _OBR_weather];
- // Get current system time
- _systemTime = systemTime;
- _year = _systemTime select 0;
- _month = _systemTime select 1;
- _day = _systemTime select 2;
- _hour = (_systemTime select 3) + 1;
- _minute = _systemTime select 4;
- // Handle Weather parameter
- if (_OBR_weather == 2) then {
- _randomWeather = [0, 0.25, 0.50, 0.75, 1] call BIS_fnc_selectRandom;
- skipTime -24;
- 86400 setOvercast _randomWeather;
- skipTime 24;
- 0 = [] spawn { sleep 0.1; simulWeatherSync;};
- [_randomWeather] call BIS_fnc_paramWeather;
- [_randomWeather] remoteExec ["setOvercast", 0];
- } else {
- [_OBR_weather] call BIS_fnc_paramWeather;
- skipTime -24;
- 86400 setOvercast _OBR_weather;
- skipTime 24;
- 0 = [] spawn { sleep 0.1; simulWeatherSync;};
- [_OBR_weather] remoteExec ["setOvercast", 0];
- };
- // Handle Fog parameter
- if (_OBR_fogAmt == 2) then {
- _randomFog = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.5, 0.10, 0.25, 0.50, 0.65, 0.75] call BIS_fnc_selectRandom;
- 0 setFog _randomFog;
- 999999 setFog _randomFog;
- [0, [_randomFog]] remoteExec ["setFog", 2];
- [999999, [_randomFog]] remoteExec ["setFog", 2];
- } else {
- 0 setFog _OBR_fogAmt;
- 999999 setFog _OBR_fogAmt;
- [0, _OBR_fogAmt] remoteExec ["setFog", 2];
- [999999, _OBR_fogAmt] remoteExec ["setFog", 2];
- };
- // Handle Rain parameter
- switch (_OBR_rain) do {
- case 2: {
- _randomRain = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0.25, 0.50, 0.75, 1] call BIS_fnc_selectRandom;
- 0 setRain _randomRain;
- setHumidity _randomRain;
- [0, _randomRain] remoteExec ["setRain", 2];
- [_randomRain] remoteExec ["setHumidity", 2];
- skipTime 1; skipTime -1;
- forceWeatherChange;
- };
- default {
- 0 setRain _OBR_rain;
- setHumidity _OBR_rain;
- [0, _OBR_rain] remoteExec ["setRain", 2];
- [_OBR_rain] remoteExec ["setHumidity", 2];
- skipTime 1; skipTime -1;
- skipTime 1; skipTime -1;
- forceWeatherChange;
- };
- case 3: {
- 0 setRain 1;
- 0 setFog 0.1;
- setHumidity 0.9;
- enableEnvironment [false, true];
- forceWeatherChange;
- [
- "a3\data_f\snowflake4_ca.paa",
- 4,
- 0.01,
- 25,
- 0.05,
- 2.5,
- 0.5,
- 0.5,
- 0.07,
- 0.07,
- [1, 1, 1, 0.5],
- 0.0,
- 0.2,
- 0.5,
- 0.5,
- true,
- false
- ] call BIS_fnc_setRain;
- };
- };
- // Handle Wind Strength parameter
- if (_OBR_windStr == 2) then {
- _randomwindStr = [0, 0, 0, 0, 0.25, 0.50, 0.75, 1] call BIS_fnc_selectRandom;
- 0 setWindStr _randomWindStr;
- [0, _randomWindStr] remoteExec ["setWindStr"];
- } else {
- 0 setWindStr _OBR_windStr;
- [0, _OBR_windStr] remoteExec ["setWindStr"];
- };
- // Handle Wind Force parameter
- if (_OBR_windFrc == 2) then {
- _randomWindFrc = [0, 0, 0, 0, 0.25, 0.50, 0.75, 1] call BIS_fnc_selectRandom;
- 0 setWindForce _randomWindFrc;
- [0, _randomWindFrc] remoteExec ["setWindForce"];
- } else {
- 0 setWindForce _OBR_windFrc;
- [0, _OBR_windFrc] remoteExec ["setWindForce"];
- };
- // Handle Wind Gusts parameter
- if (_OBR_windGst == 2) then {
- _randomWindGst = [0, 0, 0, 0, 0.25, 0.50, 0.75, 1] call BIS_fnc_selectRandom;
- 0 setGusts _randomWindGst;
- [0, _randomWindGst] remoteExec ["setGusts"];
- } else {
- 0 setGusts _OBR_windGst;
- [0, _OBR_windGst] remoteExec ["setGusts"];
- };
- // Handle Lightnings parameter
- if (_OBR_lightnings == 2) then {
- _randomLightnings = [0, 0, 0, 0, 0.25, 0.50, 0.75, 1] call BIS_fnc_selectRandom;
- 0 setLightnings _randomLightnings;
- [0, _randomLightnings] remoteExec ["setLightnings"];
- } else {
- 0 setLightnings _OBR_lightnings;
- [0, _OBR_lightnings] remoteExec ["setLightnings"];
- };
- // Handle Wave Intensity parameter
- if (_OBR_waveInt == 2) then {
- _randomWaves = [0, 0, 0, 0, 0.25, 0.50, 0.75, 1] call BIS_fnc_selectRandom;
- 0 setWaves _randomWaves;
- [0, _randomWaves] remoteExec ["setWaves"];
- } else {
- 0 setWaves _OBR_waveInt;
- [0, _OBR_waveInt] remoteExec ["setWaves"];
- };
- // Set Time
- switch (_OBR_time) do {
- case 101: {
- setDate [_year, _month, _day, _hour, _minute];
- };
- case 0: {
- _randomTime = [4, 8, 12, 16, 18, 20, 24, 12, 16, 18] call BIS_fnc_selectRandom;
- setDate [_year, _month, _day, _randomTime, 0];
- [[_year, _month, _day, _randomTime, 0]] remoteExec ["setDate"];
- };
- case 4: {
- setDate [_year, _month, _day, 4, 0];
- [[_year, _month, _day, 4, 0]] remoteExec ["setDate"];
- };
- case 8: {
- setDate [_year, _month, _day, 8, 0];
- [[_year, _month, _day, 8, 0]] remoteExec ["setDate"];
- };
- case 12: {
- setDate [_year, _month, _day, 12, 0];
- [[_year, _month, _day, 12, 0]] remoteExec ["setDate"];
- };
- case 16: {
- setDate [_year, _month, _day, 16, 0];
- [[_year, _month, _day, 16, 0]] remoteExec ["setDate"];
- };
- case 18: {
- setDate [_year, _month, _day, 18, 0];
- [[_year, _month, _day, 18, 0]] remoteExec ["setDate"];
- };
- case 20: {
- setDate [_year, _month, _day, 20, 0];
- [[_year, _month, _day, 20, 0]] remoteExec ["setDate"];
- };
- case 24: { setDate [_year, _month, _day, 24, 0];
- [[_year, _month, _day, 24, 0]] remoteExec ["setDate"];
- };
- };
- // Log Weather and Time Initialization
- diag_log "// === Weather & Time Initialization Complete ===//";
- diag_log "Selected Settings";
- diag_log format ["Overcast: %1 ", _OBR_weather];
- diag_log format ["Fog: %1 ", _OBR_fogAmt];
- diag_log format ["Rain: %1 ", _OBR_rain];
- diag_log format ["Wind Strength: %1 ", _OBR_windStr];
- diag_log format ["Snow: %1", rainparams select 15];
- diag_log format ["Wind Force: %1 ", _OBR_windFrc];
- diag_log format ["Wind Gusts: %1 ", _OBR_windGst];
- diag_log format ["Lightning: %1 ", _OBR_lightnings];
- diag_log format ["Wave Intensity: %1 ", _OBR_waveInt];
- diag_log format ["Time: %1", _OBR_time];
- diag_log "Results:";
- diag_log format ["Overcast: %1 ", overcast];
- diag_log format ["Fog: %1 ", fog];
- diag_log format ["Rain: %1 ", rain];
- diag_log format ["Wind Strength: %1 ", windStr];
- diag_log format ["Snow: %1", rainparams select 15];
- diag_log format ["Wind Force: %1 ", Wind];
- diag_log format ["Wind Gusts: %1 ", gusts];
- diag_log format ["Lightning: %1 ", lightnings];
- diag_log format ["Wave Intensity: %1 ", waves];
- diag_log format ["Time: %1", systemTime];
- diag_log "// ======================================//";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement