Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
  • Need help?

    Create a topic in the appropriate section
    Don't write everything in the chat!
  • Take a look at the marketplace

    There you can buy
    everything related to game servers
  • Don't want a ban?

    Please read our rules
    Don't disturb the order!
  • Sell or buy?

    Use services of the guarantor
    We will make your deal safe
  • 0
BigCrazyCat

Ключи и сейф / Пропажа машин / Хумка

1) Заметил интересный баг у себя - иногда пропадают ключи из сейфа, причина неизвестна.

2) Пропажа машин при покупке. Слышал от TheFirstNoob,что можно подрезать что-то в server_cleanup,но хотелось бы поподробнее.

3) Также заметил, что если не зайтм после смерти перед рестартом,то хумка может обнулиться.

Если есть идеи, напишите, буду рад:)

Share this post


Link to post
Share on other sites

16 answers to this question

Recommended Posts

  • 0

DynamicWeatherEffects.sqf

 

 

/* DynamicWeatherEffects.sqf version 1.01 by Engima of Ostgota Ops
 * Description:
 *   Script that generates dynamic (random) weather. Works in single player, multiplayer (hosted and dedicated), and is JIP compatible.
 * Arguments:
 *   [_initialFog]: Optional. Fog when mission starts. Must be between 0 and 1 where 0 = no fog, 1 = maximum fog. -1 = random fog.
 *   [_initialOvercast]: Optional. Overcast when mission starts. Must be between 0 and 1 where 0 = no overcast, 1 = maximum overcast. -1 = random overcast.
 *   [_initialRain]: Optional. Rain when mission starts. Must be between 0 and 1 where 0 = no rain, 1 = maximum rain. -1 = random rain. (Overcast must be greater than or equal to 0.75).
 *   [_initialWind]: Optional. Wind when mission starts. Must be an array of form [x, z], where x is one wind strength vector and z is the other. x and z must be greater than or equal to 0. [-1, -1] = random wind.
 *   [_debug]: Optional. true if debug text is to be shown, otherwise false.
 */

private ["_initialFog", "_initialOvercast", "_initialRain", "_initialWind", "_debug"];
private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_rainIntervalRainProbability", "_windChangeProbability"];
private ["_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumRain", "_maximumRain", "_minimumWind", "_maximumWind", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_forceRainToStopAfterOneRainInterval", "_maxWind"];

if (isNil "_this") then { _this = []; };
if (count _this > 0) then { _initialFog = _this select 0; } else { _initialFog = -1; };
if (count _this > 1) then { _initialOvercast = _this select 1; } else { _initialOvercast = -1; };
if (count _this > 2) then { _initialRain = _this select 2; } else { _initialRain = -1; };
if (count _this > 3) then { _initialWind = _this select 3; } else { _initialWind = [-1, -1]; };
if (count _this > 4) then { _debug = _this select 4; } else { _debug = false; };

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The following variables can be changed to tweak weather behaviour

// Minimum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to 1 and less than or equal to 
// _maxWeatherChangeTimeMin. When weather changes, it is fog OR overcast that changes, not both at the same time. (Suggested value: 10).
_minWeatherChangeTimeMin = 10;

// Maximum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to _minWeatherChangeTimeMin.
// (Suggested value: 20).
_maxWeatherChangeTimeMin = 20;

// Minimum time in minutes that weather (fog and overcast) stays constant between weather changes. Must be less than or equal to 0 and 
// greater than or equal to _minWeatherChangeTimeMin. (Suggested value: 5).
_minTimeBetweenWeatherChangesMin = 5;

// Maximum time in minutes that weather (fog and overcast) stays unchanged between weather changes. Must be greater than or equal to 
// _minWeatherChangeTimeMin. (Suggested value: 10).
_maxTimeBetweenWeatherChangesMin = 10;

// Fog intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumFog
// (0 = no fog, 1 = pea soup). (Suggested value: 0).
_minimumFog = 0;

// Fog intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumFog
// (0 = no fog, 1 = pea soup). (Suggested value: 0.8).
_maximumFog = 0;

// Overcast intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumOvercast
// (0 = no overcast, 1 = maximum overcast). (Suggested value: 0).
_minimumOvercast = 0;

// Overcast intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumOvercast
// (0 = no overcast, 1 = maximum overcast). (Suggested value: 1).
_maximumOvercast = 0;

// When raining, rain intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumRain
// (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0);
_minimumRain = 0;

// When raining, rain intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumRain
// (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0.8);
_maximumRain = 1;

// Wind vector strength never falls below this value. Must be greater or equal to 0 and less than or equal to _maximumWind.
// (Suggested value: 0);
_minimumWind = 0;

// Wind vector strength never exceeds this value. Must be greater or equal to 0 and greater than or equal to _minimumWind.
// (Suggested value: 8).
_maximumWind = 0;

// Probability in percent for wind to change when weather changes. If set to 0 then wind will never change. If set to 100 then rain will 
// change every time the weather (fog or overcast) start to change. (Suggested value: 25);
_windChangeProbability = 25;

// A "rain interval" is defined as "a time interval during which it may rain in any intensity (or it may not rain at all)". When overcast 
// goes above 0.75, a chain of rain intervals (defined below) is started. It cycles on until overcast falls below 0.75. At overcast 
// below 0.75 rain intervals never execute (thus it cannot rain).

// Probability in percent (0-100) for rain to start at every rain interval. Set this to 0 if you don't want rain at all. Set this to 100 
// if you want it to rain constantly when overcast is greater than 0.75. In short: if you think that it generally rains to often then 
// lower this value and vice versa. (Suggested value: 50).
_rainIntervalRainProbability = 50;

// Minimum time in minutes for rain intervals. Must be greater or equal to 0 and less than or equal to _maxRainIntervalTimeMin.
// (Suggested value: 0).
_minRainIntervalTimeMin = 0;

// Maximum time in minutes for rain intervals. Must be greater than or equal to _minRainIntervalTimeMin. (Suggested value:
// (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2).
_maxRainIntervalTimeMin = (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2;

// If set to true, then the rain is forced to stop after one rain interval during which it has rained (use this for example if you only want 
// small occational cloudbursts ). If set to false, then the rain may stop, but it may also just change intensity for an 
// immedeate new rain interval. (Suggested value: false).
_forceRainToStopAfterOneRainInterval = false;


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Don't touch anything beneath this line

drn_DynamicWeather_DebugTextEventArgs = []; // Empty

"drn_DynamicWeather_DebugTextEventArgs" addPublicVariableEventHandler {
    drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal;
};

/*
 * Summary: Shows debug text on local client.
 * Arguments:
 *   _text: Debug text.
 */
drn_fnc_DynamicWeather_ShowDebugTextLocal = {
    private ["_minutes", "_seconds"];
    
    if (!isNull player) then {
        player sideChat (_this select 0);
    };
    
    _minutes = floor (time / 60);
    _seconds = floor (time - (_minutes * 60));
    diag_log ((str _minutes + ":" + str _seconds) + " Debug: " + (_this select 0));
};

/*
 * Summary: Shows debug text on all clients.
 * Arguments:
 *   _text: Debug text.
 */
drn_fnc_DynamicWeather_ShowDebugTextAllClients = {
    drn_DynamicWeather_DebugTextEventArgs = _this;
    publicVariable "drn_DynamicWeather_DebugTextEventArgs";
    drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal;
};

if (_debug) then {
    ["Starting script WeatherEffects.sqf..."] call drn_fnc_DynamicWeather_ShowDebugTextLocal;
};

drn_DynamicWeatherEventArgs = []; // [current overcast, current fog, current rain, current weather change ("OVERCAST", "FOG" or ""), target weather value, time until weather completion (in seconds), current wind x, current wind z]
drn_AskServerDynamicWeatherEventArgs = []; // []

drn_fnc_DynamicWeather_SetWeatherLocal = {
    private ["_currentOvercast", "_currentFog", "_currentRain", "_currentWeatherChange", "_targetWeatherValue", "_timeUntilCompletion", "_currentWindX", "_currentWindZ"];

    _currentOvercast = _this select 0;
    _currentFog = _this select 1;
    _currentRain = _this select 2;
    _currentWeatherChange = _this select 3;
    _targetWeatherValue = _this select 4;
    _timeUntilCompletion = _this select 5;
    _currentWindX = _this select 6;
    _currentWindZ = _this select 7;
    
    // Set current weather values
    0 setOvercast _currentOvercast;
    0 setFog _currentFog;
    drn_var_DynamicWeather_Rain = _currentRain;
    setWind [_currentWindX, _currentWindZ, true];
    
    // Set forecast
    if (_currentWeatherChange == "OVERCAST") then {
        _timeUntilCompletion setOvercast _targetWeatherValue;
    };
    if (_currentWeatherChange == "FOG") then {
        _timeUntilCompletion setFog _targetWeatherValue;
    };
};

if (!isServer) then {
    "drn_DynamicWeatherEventArgs" addPublicVariableEventHandler {
        drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal;
    };

    waitUntil {!isNil "drn_var_DynamicWeather_ServerInitialized"};
    
    drn_AskServerDynamicWeatherEventArgs = [true];
    publicVariable "drn_AskServerDynamicWeatherEventArgs";
};

if (isServer) then {
    drn_fnc_DynamicWeather_SetWeatherAllClients = {
        private ["_timeUntilCompletion", "_currentWeatherChange"];
        
        _timeUntilCompletion = drn_DynamicWeather_WeatherChangeCompletedTime - drn_DynamicWeather_WeatherChangeStartedTime;
        if (_timeUntilCompletion > 0) then {
            _currentWeatherChange = drn_DynamicWeather_CurrentWeatherChange;
        }
        else {
            _currentWeatherChange = "";
        };
        
        drn_DynamicWeatherEventArgs = [overcast, fog, drn_var_DynamicWeather_Rain, _currentWeatherChange, drn_DynamicWeather_WeatherTargetValue, _timeUntilCompletion, drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ];
        publicVariable "drn_DynamicWeatherEventArgs";
        drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal;
    };
    
    "drn_AskServerDynamicWeatherEventArgs" addPublicVariableEventHandler {
        call drn_fnc_DynamicWeather_SetWeatherAllClients;
    };
    
    drn_DynamicWeather_CurrentWeatherChange = "";
    drn_DynamicWeather_WeatherTargetValue = 0;
    drn_DynamicWeather_WeatherChangeStartedTime = time;
    drn_DynamicWeather_WeatherChangeCompletedTime = time;
    drn_DynamicWeather_WindX = _initialWind select 0;
    drn_DynamicWeather_WindZ = _initialWind select 1;
    
    if (_initialFog == -1) then {
        _initialFog = (_minimumFog + random (_maximumFog - _minimumFog));
    }
    else {
        if (_initialFog < _minimumFog) then {
            _initialFog = _minimumFog;
        };
        if (_initialFog > _maximumFog) then {
            _initialFog = _maximumFog;
        };
    };
    
    0 setFog _initialFog;
    
    if (_initialOvercast == -1) then {
        _initialOvercast = (_minimumOvercast + random (_maximumOvercast - _minimumOvercast));
    }
    else {
        if (_initialOvercast < _minimumOvercast) then {
            _initialOvercast = _minimumOvercast;
        };
        if (_initialOvercast > _maximumOvercast) then {
            _initialOvercast = _maximumOvercast;
        };
    };
    
    0 setOvercast _initialOvercast;
    
    if (_initialOvercast >= 0.75) then {
        if (_initialRain == -1) then {
            _initialRain = (_minimumRain + random (_minimumRain - _minimumRain));
        }
        else {
            if (_initialRain < _minimumRain) then {
                _initialRain = _minimumRain;
            };
            if (_initialRain > _maximumRain) then {
                _initialRain = _maximumRain;
            };
        };
    }
    else {
        _initialRain = 0;
    };
    
    drn_var_DynamicWeather_Rain = _initialRain;
    0 setRain drn_var_DynamicWeather_Rain;
    
    _maxWind = _minimumWind + random (_maximumWind - _minimumWind);
    
    if (drn_DynamicWeather_WindX == -1) then {
        if (random 100 < 50) then {
            drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind);
        }
        else {
            drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind);
        };
    };
    
    if (drn_DynamicWeather_WindZ == -1) then {
        if (random 100 < 50) then {
            drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind);
        }
        else {
            drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind);
        };
    };
    
    setWind [drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ, true];
    
    sleep 0.05;
    
    publicVariable "drn_var_DynamicWeather_Rain";
    drn_var_DynamicWeather_ServerInitialized = true;
    publicVariable "drn_var_DynamicWeather_ServerInitialized";
    
    // Start weather thread
    [_minWeatherChangeTimeMin, _maxWeatherChangeTimeMin, _minTimeBetweenWeatherChangesMin, _maxTimeBetweenWeatherChangesMin, _minimumFog, _maximumFog, _minimumOvercast, _maximumOvercast, _minimumWind, _maximumWind, _windChangeProbability, _debug] spawn {
        private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumWind", "_maximumWind", "_windChangeProbability", "_debug"];
        private ["_weatherType", "_fogLevel", "_overcastLevel", "_oldFogLevel", "_oldOvercastLevel", "_weatherChangeTimeSek"];
        
        _minWeatherChangeTimeMin = _this select 0;
        _maxWeatherChangeTimeMin = _this select 1;
        _minTimeBetweenWeatherChangesMin = _this select 2;
        _maxTimeBetweenWeatherChangesMin = _this select 3;
        _minimumFog = _this select 4;
        _maximumFog = _this select 5;
        _minimumOvercast = _this select 6;
        _maximumOvercast = _this select 7;
        _minimumWind = _this select 8;
        _maximumWind = _this select 9;
        _windChangeProbability = _this select 10;
        _debug = _this select 11;
        
        // Set initial fog level
        _fogLevel = 2;
        _overcastLevel = 2;
        
        while {true} do {
            // Sleep a while until next weather change
            sleep floor (_minTimeBetweenWeatherChangesMin * 60 + random ((_maxTimeBetweenWeatherChangesMin - _minTimeBetweenWeatherChangesMin) * 60));
            
            if (_minimumFog == _maximumFog && _minimumOvercast != _maximumOvercast) then {
                _weatherType = "OVERCAST";
            };
            if (_minimumFog != _maximumFog && _minimumOvercast == _maximumOvercast) then {
                _weatherType = "FOG";
            };
            if (_minimumFog != _maximumFog && _minimumOvercast != _maximumOvercast) then {
                
                // Select type of weather to change
                if ((random 100) < 50) then {
                    _weatherType = "OVERCAST";
                }
                else {
                    _weatherType = "FOG";
                };
            };
            
            // DEBUG
            //_weatherType = "OVERCAST";
            
            if (_weatherType == "FOG") then {
                
                drn_DynamicWeather_CurrentWeatherChange = "FOG";
                
                // Select a new fog level
                _oldFogLevel = _fogLevel;
                _fogLevel = floor ((random 100) / 25);
                
                while {_fogLevel == _oldFogLevel} do {
                    _fogLevel = floor ((random 100) / 25);
                };
                
                if (_fogLevel == 0) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * random 0.05;
                };
                if (_fogLevel == 1) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.05 + random 0.2);
                };
                if (_fogLevel == 2) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.25 + random 0.3);
                };
                if (_fogLevel == 3) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.55 + random 0.45);
                };
                
                drn_DynamicWeather_WeatherChangeStartedTime = time;
                _weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60);
                drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek;
                
                if (_debug) then {
                    ["Weather forecast: Fog " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                };
            };
            
            if (_weatherType == "OVERCAST") then {
                
                drn_DynamicWeather_CurrentWeatherChange = "OVERCAST";
                
                // Select a new overcast level
                _oldOvercastLevel = _overcastLevel;
                //_overcastLevel = floor ((random 100) / 25);
                _overcastLevel = 3;
                
                while {_overcastLevel == _oldOvercastLevel} do {
                    _overcastLevel = floor ((random 100) / 25);
                };
                
                if (_overcastLevel == 0) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * random 0.05;
                };
                if (_overcastLevel == 1) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.05 + random 0.3);
                };
                if (_overcastLevel == 2) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.35 + random 0.35);
                };
                if (_overcastLevel == 3) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.7 + random 0.3);
                };
                
                // DEBUG
                /*
                if (overcast > 0.8) then {
                    drn_DynamicWeather_WeatherTargetValue = 0.5;
                }
                else {
                    drn_DynamicWeather_WeatherTargetValue = 0.85;
                };
                */
                
                drn_DynamicWeather_WeatherChangeStartedTime = time;
                _weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60);
                drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek;
                
                if (_debug) then {
                    ["Weather forecast: Overcast " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                };
            };
            
            // On average every one fourth of weather changes, change wind too
            if (random 100 < _windChangeProbability) then {
                private ["_maxWind"];
                
                _maxWind = _minimumWind + random (_maximumWind - _minimumWind);
                
                if (random 100 < 50) then {
                    drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind);
                }
                else {
                    drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind);
                };
                if (random 100 < 50) then {
                    drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind);
                }
                else {
                    drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind);
                };
                
                if (_debug) then {
                    ["Wind changes: [" + str drn_DynamicWeather_WindX + ", " + str drn_DynamicWeather_WindZ + "]."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                };
            };
            
            call drn_fnc_DynamicWeather_SetWeatherAllClients;
            
            sleep _weatherChangeTimeSek;
        };
    };
    
    // Start rain thread
    if (_rainIntervalRainProbability > 0) then {
        [_minimumRain, _maximumRain, _forceRainToStopAfterOneRainInterval, _minRainIntervalTimeMin, _maxRainIntervalTimeMin, _rainIntervalRainProbability, _debug] spawn {
            private ["_minimumRain", "_maximumRain", "_forceRainToStopAfterOneRainInterval", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_rainIntervalRainProbability", "_debug"];
            private ["_nextRainEventTime", "_forceStop"];
            
            _minimumRain = _this select 0;
            _maximumRain = _this select 1;
            _forceRainToStopAfterOneRainInterval = _this select 2;
            _minRainIntervalTimeMin = _this select 3;
            _maxRainIntervalTimeMin = _this select 4;
            _rainIntervalRainProbability = _this select 5;
            _debug = _this select 6;
            
            if (rain > 0) then {
                drn_var_DynamicWeather_Rain = rain;
                publicVariable "drn_var_DynamicWeather_Rain";
            };
            
            _nextRainEventTime = time;
            _forceStop = false;
            
            while {true} do {
                
                if (overcast > 0.75) then {
                    
                    if (time >= _nextRainEventTime) then {
                        private ["_rainTimeSec"];
                        
                        // At every rain event time, start or stop rain with 50% probability
                        if (random 100 < _rainIntervalRainProbability && !_forceStop) then {
                            drn_var_DynamicWeather_rain = _minimumRain + random (_maximumRain - _minimumRain);
                            publicVariable "drn_var_DynamicWeather_rain";
                            
                            _forceStop = _forceRainToStopAfterOneRainInterval;
                        }
                        else {
                            drn_var_DynamicWeather_rain = 0;
                            publicVariable "drn_var_DynamicWeather_rain";
                            
                            _forceStop = false;
                        };
                        
                        // Pick a time for next rain change
                        _rainTimeSec = _minRainIntervalTimeMin * 60 + random ((_maxRainIntervalTimeMin - _minRainIntervalTimeMin) * 60);
                        _nextRainEventTime = time + _rainTimeSec;
                        
                        if (_debug) then {
                            ["Rain set to " + str drn_var_DynamicWeather_rain + " for " + str (_rainTimeSec / 60) + " minutes"] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                        };
                    };
                }
                else {
                    if (drn_var_DynamicWeather_rain != 0) then {
                        drn_var_DynamicWeather_rain = 0;
                        publicVariable "drn_var_DynamicWeather_rain";
                        
                        if (_debug) then {
                            ["Rain stops due to low overcast."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                        };
                    };
                    
                    _nextRainEventTime = time;
                    _forceStop = false;
                };
                
                if (_debug) then {
                    sleep 1;
                }
                else {
                    sleep 10;
                };
            };
        };
    };
};

[_rainIntervalRainProbability, _debug] spawn {
    private ["_rainIntervalRainProbability", "_debug"];
    private ["_rain", "_rainPerSecond"];
    
    _rainIntervalRainProbability = _this select 0;
    _debug = _this select 1;
    
    if (_debug) then {
        _rainPerSecond = 0.2;
    }
    else {
        _rainPerSecond = 0.03;
    };
    
    if (_rainIntervalRainProbability > 0) then {
        _rain = drn_var_DynamicWeather_Rain;
    }
    else {
        _rain = 0;
    };
    
    0 setRain _rain;
    sleep 0.1;
    
    while {true} do {
        if (_rainIntervalRainProbability > 0) then {
            if (_rain < drn_var_DynamicWeather_Rain) then {
                _rain = _rain + _rainPerSecond;
                if (_rain > 1) then { _rain = 1; };
            };
            if (_rain > drn_var_DynamicWeather_Rain) then {
                _rain = _rain - _rainPerSecond;
                if (_rain < 0) then { _rain = 0; };
            };
        }
        else {
            _rain = 0;
        };
        
        3 setRain _rain;
        
        sleep 3;
    };
};

 

 

 

 

В init.sqf 
Найти:
DZE_TRADER_SPAWNMODE = false;
Заменить на:
DZE_TRADER_SPAWNMODE = true;

 

P.S Те погодные эфекты дальность делают норм , если не хватает дальность задай вручную дальность в init.sqf

Edited by Dimitri (see edit history)

Share this post


Link to post
Share on other sites







  • 0

2)Сделай спавн на парашюте когда покупаешь и отключи ветер чтоб не унесло и не будут пропадать если не смогут подойти 

Share this post


Link to post
Share on other sites
  • 0

1) Заметил интересный баг у себя - иногда пропадают ключи из сейфа, причина неизвестна.

2) Пропажа машин при покупке. Слышал от TheFirstNoob,что можно подрезать что-то в server_cleanup,но хотелось бы поподробнее.

3) Также заметил, что если не зайтм после смерти перед рестартом,то хумка может обнулиться.

Если есть идеи, напишите, буду рад :)

По третьему пункту, если у тебя в SQL включены функции то вероятнее всего ошибка кроется вот тут. 

#remove dead players
 DELETE 
  FROM character_data
  WHERE Alive=0;
   AND DATE(LastLogin) < CURDATE() - INTERVAL 7 DAY;
#remove old players
 DELETE 
  FROM character_data
  WHERE Alive=1
   AND DATE(LastLogin) < CURDATE() - INTERVAL 30 DAY;
Edited by TS_Miha (see edit history)

Share this post


Link to post
Share on other sites
  • 0

 

По третьему пункту, если у тебя в SQL включены функции то вероятнее всего ошибка кроется вот тут. 

#remove dead players
 DELETE 
  FROM character_data
  WHERE Alive=0;
   AND DATE(LastLogin) < CURDATE() - INTERVAL 7 DAY;
#remove old players
 DELETE 
  FROM character_data
  WHERE Alive=1
   AND DATE(LastLogin) < CURDATE() - INTERVAL 30 DAY;

Есть такое дело.Попробую.

Share this post


Link to post
Share on other sites
  • 0

 

2)Сделай спавн на парашюте когда покупаешь и отключи ветер чтоб не унесло и не будут пропадать если не смогут подойти

Вписать значения переменным paraSpawn = true и setWind = 0 в ините? Первая не будеи стыковатся с выбором места спавна, вторая, я думаю, будет автоматом менятся, когда игроки выбирают день и ночь сервере.

Share this post


Link to post
Share on other sites
  • 0

Вписать значения переменным paraSpawn = true и setWind = 0 в ините? Первая не будеи стыковатся с выбором места спавна, вторая, я думаю, будет автоматом менятся, когда игроки выбирают день и ночь сервере.

Как дома буду после обеда дам погоду без ветер и переменную для спавн на парашюте

Share this post


Link to post
Share on other sites
  • 0

 

Как дома буду после обеда дам погоду без ветер и переменную для спавн на парашюте

Я знаю о каком вы файле говорите. Но я его не юзаю, так есть проблема с изменением дальности видимости.

Share this post


Link to post
Share on other sites
  • 0

DynamicWeatherEffects.sqf

 

 

/* DynamicWeatherEffects.sqf version 1.01 by Engima of Ostgota Ops
 * Description:
 *   Script that generates dynamic (random) weather. Works in single player, multiplayer (hosted and dedicated), and is JIP compatible.
 * Arguments:
 *   [_initialFog]: Optional. Fog when mission starts. Must be between 0 and 1 where 0 = no fog, 1 = maximum fog. -1 = random fog.
 *   [_initialOvercast]: Optional. Overcast when mission starts. Must be between 0 and 1 where 0 = no overcast, 1 = maximum overcast. -1 = random overcast.
 *   [_initialRain]: Optional. Rain when mission starts. Must be between 0 and 1 where 0 = no rain, 1 = maximum rain. -1 = random rain. (Overcast must be greater than or equal to 0.75).
 *   [_initialWind]: Optional. Wind when mission starts. Must be an array of form [x, z], where x is one wind strength vector and z is the other. x and z must be greater than or equal to 0. [-1, -1] = random wind.
 *   [_debug]: Optional. true if debug text is to be shown, otherwise false.
 */

private ["_initialFog", "_initialOvercast", "_initialRain", "_initialWind", "_debug"];
private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_rainIntervalRainProbability", "_windChangeProbability"];
private ["_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumRain", "_maximumRain", "_minimumWind", "_maximumWind", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_forceRainToStopAfterOneRainInterval", "_maxWind"];

if (isNil "_this") then { _this = []; };
if (count _this > 0) then { _initialFog = _this select 0; } else { _initialFog = -1; };
if (count _this > 1) then { _initialOvercast = _this select 1; } else { _initialOvercast = -1; };
if (count _this > 2) then { _initialRain = _this select 2; } else { _initialRain = -1; };
if (count _this > 3) then { _initialWind = _this select 3; } else { _initialWind = [-1, -1]; };
if (count _this > 4) then { _debug = _this select 4; } else { _debug = false; };

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The following variables can be changed to tweak weather behaviour

// Minimum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to 1 and less than or equal to 
// _maxWeatherChangeTimeMin. When weather changes, it is fog OR overcast that changes, not both at the same time. (Suggested value: 10).
_minWeatherChangeTimeMin = 10;

// Maximum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to _minWeatherChangeTimeMin.
// (Suggested value: 20).
_maxWeatherChangeTimeMin = 20;

// Minimum time in minutes that weather (fog and overcast) stays constant between weather changes. Must be less than or equal to 0 and 
// greater than or equal to _minWeatherChangeTimeMin. (Suggested value: 5).
_minTimeBetweenWeatherChangesMin = 5;

// Maximum time in minutes that weather (fog and overcast) stays unchanged between weather changes. Must be greater than or equal to 
// _minWeatherChangeTimeMin. (Suggested value: 10).
_maxTimeBetweenWeatherChangesMin = 10;

// Fog intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumFog
// (0 = no fog, 1 = pea soup). (Suggested value: 0).
_minimumFog = 0;

// Fog intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumFog
// (0 = no fog, 1 = pea soup). (Suggested value: 0.8).
_maximumFog = 0;

// Overcast intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumOvercast
// (0 = no overcast, 1 = maximum overcast). (Suggested value: 0).
_minimumOvercast = 0;

// Overcast intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumOvercast
// (0 = no overcast, 1 = maximum overcast). (Suggested value: 1).
_maximumOvercast = 0;

// When raining, rain intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumRain
// (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0);
_minimumRain = 0;

// When raining, rain intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumRain
// (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0.8);
_maximumRain = 1;

// Wind vector strength never falls below this value. Must be greater or equal to 0 and less than or equal to _maximumWind.
// (Suggested value: 0);
_minimumWind = 0;

// Wind vector strength never exceeds this value. Must be greater or equal to 0 and greater than or equal to _minimumWind.
// (Suggested value: 8).
_maximumWind = 0;

// Probability in percent for wind to change when weather changes. If set to 0 then wind will never change. If set to 100 then rain will 
// change every time the weather (fog or overcast) start to change. (Suggested value: 25);
_windChangeProbability = 25;

// A "rain interval" is defined as "a time interval during which it may rain in any intensity (or it may not rain at all)". When overcast 
// goes above 0.75, a chain of rain intervals (defined below) is started. It cycles on until overcast falls below 0.75. At overcast 
// below 0.75 rain intervals never execute (thus it cannot rain).

// Probability in percent (0-100) for rain to start at every rain interval. Set this to 0 if you don't want rain at all. Set this to 100 
// if you want it to rain constantly when overcast is greater than 0.75. In short: if you think that it generally rains to often then 
// lower this value and vice versa. (Suggested value: 50).
_rainIntervalRainProbability = 50;

// Minimum time in minutes for rain intervals. Must be greater or equal to 0 and less than or equal to _maxRainIntervalTimeMin.
// (Suggested value: 0).
_minRainIntervalTimeMin = 0;

// Maximum time in minutes for rain intervals. Must be greater than or equal to _minRainIntervalTimeMin. (Suggested value:
// (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2).
_maxRainIntervalTimeMin = (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2;

// If set to true, then the rain is forced to stop after one rain interval during which it has rained (use this for example if you only want 
// small occational cloudbursts ). If set to false, then the rain may stop, but it may also just change intensity for an 
// immedeate new rain interval. (Suggested value: false).
_forceRainToStopAfterOneRainInterval = false;


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Don't touch anything beneath this line

drn_DynamicWeather_DebugTextEventArgs = []; // Empty

"drn_DynamicWeather_DebugTextEventArgs" addPublicVariableEventHandler {
    drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal;
};

/*
 * Summary: Shows debug text on local client.
 * Arguments:
 *   _text: Debug text.
 */
drn_fnc_DynamicWeather_ShowDebugTextLocal = {
    private ["_minutes", "_seconds"];
    
    if (!isNull player) then {
        player sideChat (_this select 0);
    };
    
    _minutes = floor (time / 60);
    _seconds = floor (time - (_minutes * 60));
    diag_log ((str _minutes + ":" + str _seconds) + " Debug: " + (_this select 0));
};

/*
 * Summary: Shows debug text on all clients.
 * Arguments:
 *   _text: Debug text.
 */
drn_fnc_DynamicWeather_ShowDebugTextAllClients = {
    drn_DynamicWeather_DebugTextEventArgs = _this;
    publicVariable "drn_DynamicWeather_DebugTextEventArgs";
    drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal;
};

if (_debug) then {
    ["Starting script WeatherEffects.sqf..."] call drn_fnc_DynamicWeather_ShowDebugTextLocal;
};

drn_DynamicWeatherEventArgs = []; // [current overcast, current fog, current rain, current weather change ("OVERCAST", "FOG" or ""), target weather value, time until weather completion (in seconds), current wind x, current wind z]
drn_AskServerDynamicWeatherEventArgs = []; // []

drn_fnc_DynamicWeather_SetWeatherLocal = {
    private ["_currentOvercast", "_currentFog", "_currentRain", "_currentWeatherChange", "_targetWeatherValue", "_timeUntilCompletion", "_currentWindX", "_currentWindZ"];

    _currentOvercast = _this select 0;
    _currentFog = _this select 1;
    _currentRain = _this select 2;
    _currentWeatherChange = _this select 3;
    _targetWeatherValue = _this select 4;
    _timeUntilCompletion = _this select 5;
    _currentWindX = _this select 6;
    _currentWindZ = _this select 7;
    
    // Set current weather values
    0 setOvercast _currentOvercast;
    0 setFog _currentFog;
    drn_var_DynamicWeather_Rain = _currentRain;
    setWind [_currentWindX, _currentWindZ, true];
    
    // Set forecast
    if (_currentWeatherChange == "OVERCAST") then {
        _timeUntilCompletion setOvercast _targetWeatherValue;
    };
    if (_currentWeatherChange == "FOG") then {
        _timeUntilCompletion setFog _targetWeatherValue;
    };
};

if (!isServer) then {
    "drn_DynamicWeatherEventArgs" addPublicVariableEventHandler {
        drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal;
    };

    waitUntil {!isNil "drn_var_DynamicWeather_ServerInitialized"};
    
    drn_AskServerDynamicWeatherEventArgs = [true];
    publicVariable "drn_AskServerDynamicWeatherEventArgs";
};

if (isServer) then {
    drn_fnc_DynamicWeather_SetWeatherAllClients = {
        private ["_timeUntilCompletion", "_currentWeatherChange"];
        
        _timeUntilCompletion = drn_DynamicWeather_WeatherChangeCompletedTime - drn_DynamicWeather_WeatherChangeStartedTime;
        if (_timeUntilCompletion > 0) then {
            _currentWeatherChange = drn_DynamicWeather_CurrentWeatherChange;
        }
        else {
            _currentWeatherChange = "";
        };
        
        drn_DynamicWeatherEventArgs = [overcast, fog, drn_var_DynamicWeather_Rain, _currentWeatherChange, drn_DynamicWeather_WeatherTargetValue, _timeUntilCompletion, drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ];
        publicVariable "drn_DynamicWeatherEventArgs";
        drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal;
    };
    
    "drn_AskServerDynamicWeatherEventArgs" addPublicVariableEventHandler {
        call drn_fnc_DynamicWeather_SetWeatherAllClients;
    };
    
    drn_DynamicWeather_CurrentWeatherChange = "";
    drn_DynamicWeather_WeatherTargetValue = 0;
    drn_DynamicWeather_WeatherChangeStartedTime = time;
    drn_DynamicWeather_WeatherChangeCompletedTime = time;
    drn_DynamicWeather_WindX = _initialWind select 0;
    drn_DynamicWeather_WindZ = _initialWind select 1;
    
    if (_initialFog == -1) then {
        _initialFog = (_minimumFog + random (_maximumFog - _minimumFog));
    }
    else {
        if (_initialFog < _minimumFog) then {
            _initialFog = _minimumFog;
        };
        if (_initialFog > _maximumFog) then {
            _initialFog = _maximumFog;
        };
    };
    
    0 setFog _initialFog;
    
    if (_initialOvercast == -1) then {
        _initialOvercast = (_minimumOvercast + random (_maximumOvercast - _minimumOvercast));
    }
    else {
        if (_initialOvercast < _minimumOvercast) then {
            _initialOvercast = _minimumOvercast;
        };
        if (_initialOvercast > _maximumOvercast) then {
            _initialOvercast = _maximumOvercast;
        };
    };
    
    0 setOvercast _initialOvercast;
    
    if (_initialOvercast >= 0.75) then {
        if (_initialRain == -1) then {
            _initialRain = (_minimumRain + random (_minimumRain - _minimumRain));
        }
        else {
            if (_initialRain < _minimumRain) then {
                _initialRain = _minimumRain;
            };
            if (_initialRain > _maximumRain) then {
                _initialRain = _maximumRain;
            };
        };
    }
    else {
        _initialRain = 0;
    };
    
    drn_var_DynamicWeather_Rain = _initialRain;
    0 setRain drn_var_DynamicWeather_Rain;
    
    _maxWind = _minimumWind + random (_maximumWind - _minimumWind);
    
    if (drn_DynamicWeather_WindX == -1) then {
        if (random 100 < 50) then {
            drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind);
        }
        else {
            drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind);
        };
    };
    
    if (drn_DynamicWeather_WindZ == -1) then {
        if (random 100 < 50) then {
            drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind);
        }
        else {
            drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind);
        };
    };
    
    setWind [drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ, true];
    
    sleep 0.05;
    
    publicVariable "drn_var_DynamicWeather_Rain";
    drn_var_DynamicWeather_ServerInitialized = true;
    publicVariable "drn_var_DynamicWeather_ServerInitialized";
    
    // Start weather thread
    [_minWeatherChangeTimeMin, _maxWeatherChangeTimeMin, _minTimeBetweenWeatherChangesMin, _maxTimeBetweenWeatherChangesMin, _minimumFog, _maximumFog, _minimumOvercast, _maximumOvercast, _minimumWind, _maximumWind, _windChangeProbability, _debug] spawn {
        private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumWind", "_maximumWind", "_windChangeProbability", "_debug"];
        private ["_weatherType", "_fogLevel", "_overcastLevel", "_oldFogLevel", "_oldOvercastLevel", "_weatherChangeTimeSek"];
        
        _minWeatherChangeTimeMin = _this select 0;
        _maxWeatherChangeTimeMin = _this select 1;
        _minTimeBetweenWeatherChangesMin = _this select 2;
        _maxTimeBetweenWeatherChangesMin = _this select 3;
        _minimumFog = _this select 4;
        _maximumFog = _this select 5;
        _minimumOvercast = _this select 6;
        _maximumOvercast = _this select 7;
        _minimumWind = _this select 8;
        _maximumWind = _this select 9;
        _windChangeProbability = _this select 10;
        _debug = _this select 11;
        
        // Set initial fog level
        _fogLevel = 2;
        _overcastLevel = 2;
        
        while {true} do {
            // Sleep a while until next weather change
            sleep floor (_minTimeBetweenWeatherChangesMin * 60 + random ((_maxTimeBetweenWeatherChangesMin - _minTimeBetweenWeatherChangesMin) * 60));
            
            if (_minimumFog == _maximumFog && _minimumOvercast != _maximumOvercast) then {
                _weatherType = "OVERCAST";
            };
            if (_minimumFog != _maximumFog && _minimumOvercast == _maximumOvercast) then {
                _weatherType = "FOG";
            };
            if (_minimumFog != _maximumFog && _minimumOvercast != _maximumOvercast) then {
                
                // Select type of weather to change
                if ((random 100) < 50) then {
                    _weatherType = "OVERCAST";
                }
                else {
                    _weatherType = "FOG";
                };
            };
            
            // DEBUG
            //_weatherType = "OVERCAST";
            
            if (_weatherType == "FOG") then {
                
                drn_DynamicWeather_CurrentWeatherChange = "FOG";
                
                // Select a new fog level
                _oldFogLevel = _fogLevel;
                _fogLevel = floor ((random 100) / 25);
                
                while {_fogLevel == _oldFogLevel} do {
                    _fogLevel = floor ((random 100) / 25);
                };
                
                if (_fogLevel == 0) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * random 0.05;
                };
                if (_fogLevel == 1) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.05 + random 0.2);
                };
                if (_fogLevel == 2) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.25 + random 0.3);
                };
                if (_fogLevel == 3) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.55 + random 0.45);
                };
                
                drn_DynamicWeather_WeatherChangeStartedTime = time;
                _weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60);
                drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek;
                
                if (_debug) then {
                    ["Weather forecast: Fog " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                };
            };
            
            if (_weatherType == "OVERCAST") then {
                
                drn_DynamicWeather_CurrentWeatherChange = "OVERCAST";
                
                // Select a new overcast level
                _oldOvercastLevel = _overcastLevel;
                //_overcastLevel = floor ((random 100) / 25);
                _overcastLevel = 3;
                
                while {_overcastLevel == _oldOvercastLevel} do {
                    _overcastLevel = floor ((random 100) / 25);
                };
                
                if (_overcastLevel == 0) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * random 0.05;
                };
                if (_overcastLevel == 1) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.05 + random 0.3);
                };
                if (_overcastLevel == 2) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.35 + random 0.35);
                };
                if (_overcastLevel == 3) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.7 + random 0.3);
                };
                
                // DEBUG
                /*
                if (overcast > 0.8) then {
                    drn_DynamicWeather_WeatherTargetValue = 0.5;
                }
                else {
                    drn_DynamicWeather_WeatherTargetValue = 0.85;
                };
                */
                
                drn_DynamicWeather_WeatherChangeStartedTime = time;
                _weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60);
                drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek;
                
                if (_debug) then {
                    ["Weather forecast: Overcast " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                };
            };
            
            // On average every one fourth of weather changes, change wind too
            if (random 100 < _windChangeProbability) then {
                private ["_maxWind"];
                
                _maxWind = _minimumWind + random (_maximumWind - _minimumWind);
                
                if (random 100 < 50) then {
                    drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind);
                }
                else {
                    drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind);
                };
                if (random 100 < 50) then {
                    drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind);
                }
                else {
                    drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind);
                };
                
                if (_debug) then {
                    ["Wind changes: [" + str drn_DynamicWeather_WindX + ", " + str drn_DynamicWeather_WindZ + "]."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                };
            };
            
            call drn_fnc_DynamicWeather_SetWeatherAllClients;
            
            sleep _weatherChangeTimeSek;
        };
    };
    
    // Start rain thread
    if (_rainIntervalRainProbability > 0) then {
        [_minimumRain, _maximumRain, _forceRainToStopAfterOneRainInterval, _minRainIntervalTimeMin, _maxRainIntervalTimeMin, _rainIntervalRainProbability, _debug] spawn {
            private ["_minimumRain", "_maximumRain", "_forceRainToStopAfterOneRainInterval", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_rainIntervalRainProbability", "_debug"];
            private ["_nextRainEventTime", "_forceStop"];
            
            _minimumRain = _this select 0;
            _maximumRain = _this select 1;
            _forceRainToStopAfterOneRainInterval = _this select 2;
            _minRainIntervalTimeMin = _this select 3;
            _maxRainIntervalTimeMin = _this select 4;
            _rainIntervalRainProbability = _this select 5;
            _debug = _this select 6;
            
            if (rain > 0) then {
                drn_var_DynamicWeather_Rain = rain;
                publicVariable "drn_var_DynamicWeather_Rain";
            };
            
            _nextRainEventTime = time;
            _forceStop = false;
            
            while {true} do {
                
                if (overcast > 0.75) then {
                    
                    if (time >= _nextRainEventTime) then {
                        private ["_rainTimeSec"];
                        
                        // At every rain event time, start or stop rain with 50% probability
                        if (random 100 < _rainIntervalRainProbability && !_forceStop) then {
                            drn_var_DynamicWeather_rain = _minimumRain + random (_maximumRain - _minimumRain);
                            publicVariable "drn_var_DynamicWeather_rain";
                            
                            _forceStop = _forceRainToStopAfterOneRainInterval;
                        }
                        else {
                            drn_var_DynamicWeather_rain = 0;
                            publicVariable "drn_var_DynamicWeather_rain";
                            
                            _forceStop = false;
                        };
                        
                        // Pick a time for next rain change
                        _rainTimeSec = _minRainIntervalTimeMin * 60 + random ((_maxRainIntervalTimeMin - _minRainIntervalTimeMin) * 60);
                        _nextRainEventTime = time + _rainTimeSec;
                        
                        if (_debug) then {
                            ["Rain set to " + str drn_var_DynamicWeather_rain + " for " + str (_rainTimeSec / 60) + " minutes"] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                        };
                    };
                }
                else {
                    if (drn_var_DynamicWeather_rain != 0) then {
                        drn_var_DynamicWeather_rain = 0;
                        publicVariable "drn_var_DynamicWeather_rain";
                        
                        if (_debug) then {
                            ["Rain stops due to low overcast."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                        };
                    };
                    
                    _nextRainEventTime = time;
                    _forceStop = false;
                };
                
                if (_debug) then {
                    sleep 1;
                }
                else {
                    sleep 10;
                };
            };
        };
    };
};

[_rainIntervalRainProbability, _debug] spawn {
    private ["_rainIntervalRainProbability", "_debug"];
    private ["_rain", "_rainPerSecond"];
    
    _rainIntervalRainProbability = _this select 0;
    _debug = _this select 1;
    
    if (_debug) then {
        _rainPerSecond = 0.2;
    }
    else {
        _rainPerSecond = 0.03;
    };
    
    if (_rainIntervalRainProbability > 0) then {
        _rain = drn_var_DynamicWeather_Rain;
    }
    else {
        _rain = 0;
    };
    
    0 setRain _rain;
    sleep 0.1;
    
    while {true} do {
        if (_rainIntervalRainProbability > 0) then {
            if (_rain < drn_var_DynamicWeather_Rain) then {
                _rain = _rain + _rainPerSecond;
                if (_rain > 1) then { _rain = 1; };
            };
            if (_rain > drn_var_DynamicWeather_Rain) then {
                _rain = _rain - _rainPerSecond;
                if (_rain < 0) then { _rain = 0; };
            };
        }
        else {
            _rain = 0;
        };
        
        3 setRain _rain;
        
        sleep 3;
    };
};

 

 

 

 

В init.sqf 

Найти:

DZE_TRADER_SPAWNMODE = false;

Заменить на:

DZE_TRADER_SPAWNMODE = true;

 

P.S Те погодные эфекты дальность делают норм , если не хватает дальность задай вручную дальность в init.sqf

Дальность то норм,но каждый ее настраивает под себя и когда подключен этот файл,после изменения она сбрасывается через несколько секунд. Мб оставить только ветер?

Share this post


Link to post
Share on other sites
  • 0

Дальность то норм,но каждый ее настраивает под себя и когда подключен этот файл,после изменения она сбрасывается через несколько секунд. Мб оставить только ветер?

Ну пробуй поменять ток переменную с false на true если все норм не уносит можешь не подключать мой файл 

Edited by Dimitri (see edit history)

Share this post


Link to post
Share on other sites
  • 0

Ну пробуй поменять ток переменную с false на true если все норм не уносит можешь не подключать мой файл 

Попробовал - улёт! :thumbsup:  Спасибо.

Share this post


Link to post
Share on other sites
  • 0

На счет ключей в сейф не в курсе но думаю дело и за SC 3.0 , хотя ошибок в рпт оч мало . У меня тоже были такие заварушки что пропадали из сейф но редко , часто и локбоксы

Edited by Dimitri (see edit history)

Share this post


Link to post
Share on other sites
  • 0

DynamicWeatherEffects.sqf

 

 

/* DynamicWeatherEffects.sqf version 1.01 by Engima of Ostgota Ops
 * Description:
 *   Script that generates dynamic (random) weather. Works in single player, multiplayer (hosted and dedicated), and is JIP compatible.
 * Arguments:
 *   [_initialFog]: Optional. Fog when mission starts. Must be between 0 and 1 where 0 = no fog, 1 = maximum fog. -1 = random fog.
 *   [_initialOvercast]: Optional. Overcast when mission starts. Must be between 0 and 1 where 0 = no overcast, 1 = maximum overcast. -1 = random overcast.
 *   [_initialRain]: Optional. Rain when mission starts. Must be between 0 and 1 where 0 = no rain, 1 = maximum rain. -1 = random rain. (Overcast must be greater than or equal to 0.75).
 *   [_initialWind]: Optional. Wind when mission starts. Must be an array of form [x, z], where x is one wind strength vector and z is the other. x and z must be greater than or equal to 0. [-1, -1] = random wind.
 *   [_debug]: Optional. true if debug text is to be shown, otherwise false.
 */

private ["_initialFog", "_initialOvercast", "_initialRain", "_initialWind", "_debug"];
private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_rainIntervalRainProbability", "_windChangeProbability"];
private ["_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumRain", "_maximumRain", "_minimumWind", "_maximumWind", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_forceRainToStopAfterOneRainInterval", "_maxWind"];

if (isNil "_this") then { _this = []; };
if (count _this > 0) then { _initialFog = _this select 0; } else { _initialFog = -1; };
if (count _this > 1) then { _initialOvercast = _this select 1; } else { _initialOvercast = -1; };
if (count _this > 2) then { _initialRain = _this select 2; } else { _initialRain = -1; };
if (count _this > 3) then { _initialWind = _this select 3; } else { _initialWind = [-1, -1]; };
if (count _this > 4) then { _debug = _this select 4; } else { _debug = false; };

///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// The following variables can be changed to tweak weather behaviour

// Minimum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to 1 and less than or equal to 
// _maxWeatherChangeTimeMin. When weather changes, it is fog OR overcast that changes, not both at the same time. (Suggested value: 10).
_minWeatherChangeTimeMin = 10;

// Maximum time in minutes for the weather (fog and overcast) to change. Must be greater than or equal to _minWeatherChangeTimeMin.
// (Suggested value: 20).
_maxWeatherChangeTimeMin = 20;

// Minimum time in minutes that weather (fog and overcast) stays constant between weather changes. Must be less than or equal to 0 and 
// greater than or equal to _minWeatherChangeTimeMin. (Suggested value: 5).
_minTimeBetweenWeatherChangesMin = 5;

// Maximum time in minutes that weather (fog and overcast) stays unchanged between weather changes. Must be greater than or equal to 
// _minWeatherChangeTimeMin. (Suggested value: 10).
_maxTimeBetweenWeatherChangesMin = 10;

// Fog intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumFog
// (0 = no fog, 1 = pea soup). (Suggested value: 0).
_minimumFog = 0;

// Fog intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumFog
// (0 = no fog, 1 = pea soup). (Suggested value: 0.8).
_maximumFog = 0;

// Overcast intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumOvercast
// (0 = no overcast, 1 = maximum overcast). (Suggested value: 0).
_minimumOvercast = 0;

// Overcast intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumOvercast
// (0 = no overcast, 1 = maximum overcast). (Suggested value: 1).
_maximumOvercast = 0;

// When raining, rain intensity never falls below this value. Must be between 0 and 1 and less than or equal to _maximumRain
// (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0);
_minimumRain = 0;

// When raining, rain intensity never exceeds this value. Must be between 0 and 1 and greater than or equal to _minimumRain
// (0 = no rain, 1 = maximum rain intensity). (Suggested value: 0.8);
_maximumRain = 1;

// Wind vector strength never falls below this value. Must be greater or equal to 0 and less than or equal to _maximumWind.
// (Suggested value: 0);
_minimumWind = 0;

// Wind vector strength never exceeds this value. Must be greater or equal to 0 and greater than or equal to _minimumWind.
// (Suggested value: 8).
_maximumWind = 0;

// Probability in percent for wind to change when weather changes. If set to 0 then wind will never change. If set to 100 then rain will 
// change every time the weather (fog or overcast) start to change. (Suggested value: 25);
_windChangeProbability = 25;

// A "rain interval" is defined as "a time interval during which it may rain in any intensity (or it may not rain at all)". When overcast 
// goes above 0.75, a chain of rain intervals (defined below) is started. It cycles on until overcast falls below 0.75. At overcast 
// below 0.75 rain intervals never execute (thus it cannot rain).

// Probability in percent (0-100) for rain to start at every rain interval. Set this to 0 if you don't want rain at all. Set this to 100 
// if you want it to rain constantly when overcast is greater than 0.75. In short: if you think that it generally rains to often then 
// lower this value and vice versa. (Suggested value: 50).
_rainIntervalRainProbability = 50;

// Minimum time in minutes for rain intervals. Must be greater or equal to 0 and less than or equal to _maxRainIntervalTimeMin.
// (Suggested value: 0).
_minRainIntervalTimeMin = 0;

// Maximum time in minutes for rain intervals. Must be greater than or equal to _minRainIntervalTimeMin. (Suggested value:
// (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2).
_maxRainIntervalTimeMin = (_maxWeatherChangeTimeMin + _maxTimeBetweenWeatherChangesMin) / 2;

// If set to true, then the rain is forced to stop after one rain interval during which it has rained (use this for example if you only want 
// small occational cloudbursts ). If set to false, then the rain may stop, but it may also just change intensity for an 
// immedeate new rain interval. (Suggested value: false).
_forceRainToStopAfterOneRainInterval = false;


///////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Don't touch anything beneath this line

drn_DynamicWeather_DebugTextEventArgs = []; // Empty

"drn_DynamicWeather_DebugTextEventArgs" addPublicVariableEventHandler {
    drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal;
};

/*
 * Summary: Shows debug text on local client.
 * Arguments:
 *   _text: Debug text.
 */
drn_fnc_DynamicWeather_ShowDebugTextLocal = {
    private ["_minutes", "_seconds"];
    
    if (!isNull player) then {
        player sideChat (_this select 0);
    };
    
    _minutes = floor (time / 60);
    _seconds = floor (time - (_minutes * 60));
    diag_log ((str _minutes + ":" + str _seconds) + " Debug: " + (_this select 0));
};

/*
 * Summary: Shows debug text on all clients.
 * Arguments:
 *   _text: Debug text.
 */
drn_fnc_DynamicWeather_ShowDebugTextAllClients = {
    drn_DynamicWeather_DebugTextEventArgs = _this;
    publicVariable "drn_DynamicWeather_DebugTextEventArgs";
    drn_DynamicWeather_DebugTextEventArgs call drn_fnc_DynamicWeather_ShowDebugTextLocal;
};

if (_debug) then {
    ["Starting script WeatherEffects.sqf..."] call drn_fnc_DynamicWeather_ShowDebugTextLocal;
};

drn_DynamicWeatherEventArgs = []; // [current overcast, current fog, current rain, current weather change ("OVERCAST", "FOG" or ""), target weather value, time until weather completion (in seconds), current wind x, current wind z]
drn_AskServerDynamicWeatherEventArgs = []; // []

drn_fnc_DynamicWeather_SetWeatherLocal = {
    private ["_currentOvercast", "_currentFog", "_currentRain", "_currentWeatherChange", "_targetWeatherValue", "_timeUntilCompletion", "_currentWindX", "_currentWindZ"];

    _currentOvercast = _this select 0;
    _currentFog = _this select 1;
    _currentRain = _this select 2;
    _currentWeatherChange = _this select 3;
    _targetWeatherValue = _this select 4;
    _timeUntilCompletion = _this select 5;
    _currentWindX = _this select 6;
    _currentWindZ = _this select 7;
    
    // Set current weather values
    0 setOvercast _currentOvercast;
    0 setFog _currentFog;
    drn_var_DynamicWeather_Rain = _currentRain;
    setWind [_currentWindX, _currentWindZ, true];
    
    // Set forecast
    if (_currentWeatherChange == "OVERCAST") then {
        _timeUntilCompletion setOvercast _targetWeatherValue;
    };
    if (_currentWeatherChange == "FOG") then {
        _timeUntilCompletion setFog _targetWeatherValue;
    };
};

if (!isServer) then {
    "drn_DynamicWeatherEventArgs" addPublicVariableEventHandler {
        drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal;
    };

    waitUntil {!isNil "drn_var_DynamicWeather_ServerInitialized"};
    
    drn_AskServerDynamicWeatherEventArgs = [true];
    publicVariable "drn_AskServerDynamicWeatherEventArgs";
};

if (isServer) then {
    drn_fnc_DynamicWeather_SetWeatherAllClients = {
        private ["_timeUntilCompletion", "_currentWeatherChange"];
        
        _timeUntilCompletion = drn_DynamicWeather_WeatherChangeCompletedTime - drn_DynamicWeather_WeatherChangeStartedTime;
        if (_timeUntilCompletion > 0) then {
            _currentWeatherChange = drn_DynamicWeather_CurrentWeatherChange;
        }
        else {
            _currentWeatherChange = "";
        };
        
        drn_DynamicWeatherEventArgs = [overcast, fog, drn_var_DynamicWeather_Rain, _currentWeatherChange, drn_DynamicWeather_WeatherTargetValue, _timeUntilCompletion, drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ];
        publicVariable "drn_DynamicWeatherEventArgs";
        drn_DynamicWeatherEventArgs call drn_fnc_DynamicWeather_SetWeatherLocal;
    };
    
    "drn_AskServerDynamicWeatherEventArgs" addPublicVariableEventHandler {
        call drn_fnc_DynamicWeather_SetWeatherAllClients;
    };
    
    drn_DynamicWeather_CurrentWeatherChange = "";
    drn_DynamicWeather_WeatherTargetValue = 0;
    drn_DynamicWeather_WeatherChangeStartedTime = time;
    drn_DynamicWeather_WeatherChangeCompletedTime = time;
    drn_DynamicWeather_WindX = _initialWind select 0;
    drn_DynamicWeather_WindZ = _initialWind select 1;
    
    if (_initialFog == -1) then {
        _initialFog = (_minimumFog + random (_maximumFog - _minimumFog));
    }
    else {
        if (_initialFog < _minimumFog) then {
            _initialFog = _minimumFog;
        };
        if (_initialFog > _maximumFog) then {
            _initialFog = _maximumFog;
        };
    };
    
    0 setFog _initialFog;
    
    if (_initialOvercast == -1) then {
        _initialOvercast = (_minimumOvercast + random (_maximumOvercast - _minimumOvercast));
    }
    else {
        if (_initialOvercast < _minimumOvercast) then {
            _initialOvercast = _minimumOvercast;
        };
        if (_initialOvercast > _maximumOvercast) then {
            _initialOvercast = _maximumOvercast;
        };
    };
    
    0 setOvercast _initialOvercast;
    
    if (_initialOvercast >= 0.75) then {
        if (_initialRain == -1) then {
            _initialRain = (_minimumRain + random (_minimumRain - _minimumRain));
        }
        else {
            if (_initialRain < _minimumRain) then {
                _initialRain = _minimumRain;
            };
            if (_initialRain > _maximumRain) then {
                _initialRain = _maximumRain;
            };
        };
    }
    else {
        _initialRain = 0;
    };
    
    drn_var_DynamicWeather_Rain = _initialRain;
    0 setRain drn_var_DynamicWeather_Rain;
    
    _maxWind = _minimumWind + random (_maximumWind - _minimumWind);
    
    if (drn_DynamicWeather_WindX == -1) then {
        if (random 100 < 50) then {
            drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind);
        }
        else {
            drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind);
        };
    };
    
    if (drn_DynamicWeather_WindZ == -1) then {
        if (random 100 < 50) then {
            drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind);
        }
        else {
            drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind);
        };
    };
    
    setWind [drn_DynamicWeather_WindX, drn_DynamicWeather_WindZ, true];
    
    sleep 0.05;
    
    publicVariable "drn_var_DynamicWeather_Rain";
    drn_var_DynamicWeather_ServerInitialized = true;
    publicVariable "drn_var_DynamicWeather_ServerInitialized";
    
    // Start weather thread
    [_minWeatherChangeTimeMin, _maxWeatherChangeTimeMin, _minTimeBetweenWeatherChangesMin, _maxTimeBetweenWeatherChangesMin, _minimumFog, _maximumFog, _minimumOvercast, _maximumOvercast, _minimumWind, _maximumWind, _windChangeProbability, _debug] spawn {
        private ["_minWeatherChangeTimeMin", "_maxWeatherChangeTimeMin", "_minTimeBetweenWeatherChangesMin", "_maxTimeBetweenWeatherChangesMin", "_minimumFog", "_maximumFog", "_minimumOvercast", "_maximumOvercast", "_minimumWind", "_maximumWind", "_windChangeProbability", "_debug"];
        private ["_weatherType", "_fogLevel", "_overcastLevel", "_oldFogLevel", "_oldOvercastLevel", "_weatherChangeTimeSek"];
        
        _minWeatherChangeTimeMin = _this select 0;
        _maxWeatherChangeTimeMin = _this select 1;
        _minTimeBetweenWeatherChangesMin = _this select 2;
        _maxTimeBetweenWeatherChangesMin = _this select 3;
        _minimumFog = _this select 4;
        _maximumFog = _this select 5;
        _minimumOvercast = _this select 6;
        _maximumOvercast = _this select 7;
        _minimumWind = _this select 8;
        _maximumWind = _this select 9;
        _windChangeProbability = _this select 10;
        _debug = _this select 11;
        
        // Set initial fog level
        _fogLevel = 2;
        _overcastLevel = 2;
        
        while {true} do {
            // Sleep a while until next weather change
            sleep floor (_minTimeBetweenWeatherChangesMin * 60 + random ((_maxTimeBetweenWeatherChangesMin - _minTimeBetweenWeatherChangesMin) * 60));
            
            if (_minimumFog == _maximumFog && _minimumOvercast != _maximumOvercast) then {
                _weatherType = "OVERCAST";
            };
            if (_minimumFog != _maximumFog && _minimumOvercast == _maximumOvercast) then {
                _weatherType = "FOG";
            };
            if (_minimumFog != _maximumFog && _minimumOvercast != _maximumOvercast) then {
                
                // Select type of weather to change
                if ((random 100) < 50) then {
                    _weatherType = "OVERCAST";
                }
                else {
                    _weatherType = "FOG";
                };
            };
            
            // DEBUG
            //_weatherType = "OVERCAST";
            
            if (_weatherType == "FOG") then {
                
                drn_DynamicWeather_CurrentWeatherChange = "FOG";
                
                // Select a new fog level
                _oldFogLevel = _fogLevel;
                _fogLevel = floor ((random 100) / 25);
                
                while {_fogLevel == _oldFogLevel} do {
                    _fogLevel = floor ((random 100) / 25);
                };
                
                if (_fogLevel == 0) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * random 0.05;
                };
                if (_fogLevel == 1) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.05 + random 0.2);
                };
                if (_fogLevel == 2) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.25 + random 0.3);
                };
                if (_fogLevel == 3) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumFog + (_maximumFog - _minimumFog) * (0.55 + random 0.45);
                };
                
                drn_DynamicWeather_WeatherChangeStartedTime = time;
                _weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60);
                drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek;
                
                if (_debug) then {
                    ["Weather forecast: Fog " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                };
            };
            
            if (_weatherType == "OVERCAST") then {
                
                drn_DynamicWeather_CurrentWeatherChange = "OVERCAST";
                
                // Select a new overcast level
                _oldOvercastLevel = _overcastLevel;
                //_overcastLevel = floor ((random 100) / 25);
                _overcastLevel = 3;
                
                while {_overcastLevel == _oldOvercastLevel} do {
                    _overcastLevel = floor ((random 100) / 25);
                };
                
                if (_overcastLevel == 0) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * random 0.05;
                };
                if (_overcastLevel == 1) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.05 + random 0.3);
                };
                if (_overcastLevel == 2) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.35 + random 0.35);
                };
                if (_overcastLevel == 3) then {
                    drn_DynamicWeather_WeatherTargetValue = _minimumOvercast + (_maximumOvercast - _minimumOvercast) * (0.7 + random 0.3);
                };
                
                // DEBUG
                /*
                if (overcast > 0.8) then {
                    drn_DynamicWeather_WeatherTargetValue = 0.5;
                }
                else {
                    drn_DynamicWeather_WeatherTargetValue = 0.85;
                };
                */
                
                drn_DynamicWeather_WeatherChangeStartedTime = time;
                _weatherChangeTimeSek = _minWeatherChangeTimeMin * 60 + random ((_maxWeatherChangeTimeMin - _minWeatherChangeTimeMin) * 60);
                drn_DynamicWeather_WeatherChangeCompletedTime = time + _weatherChangeTimeSek;
                
                if (_debug) then {
                    ["Weather forecast: Overcast " + str drn_DynamicWeather_WeatherTargetValue + " in " + str round (_weatherChangeTimeSek / 60) + " minutes."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                };
            };
            
            // On average every one fourth of weather changes, change wind too
            if (random 100 < _windChangeProbability) then {
                private ["_maxWind"];
                
                _maxWind = _minimumWind + random (_maximumWind - _minimumWind);
                
                if (random 100 < 50) then {
                    drn_DynamicWeather_WindX = -_minimumWind - random (_maxWind - _minimumWind);
                }
                else {
                    drn_DynamicWeather_WindX = _minimumWind + random (_maxWind - _minimumWind);
                };
                if (random 100 < 50) then {
                    drn_DynamicWeather_WindZ = -_minimumWind - random (_maxWind - _minimumWind);
                }
                else {
                    drn_DynamicWeather_WindZ = _minimumWind + random (_maxWind - _minimumWind);
                };
                
                if (_debug) then {
                    ["Wind changes: [" + str drn_DynamicWeather_WindX + ", " + str drn_DynamicWeather_WindZ + "]."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                };
            };
            
            call drn_fnc_DynamicWeather_SetWeatherAllClients;
            
            sleep _weatherChangeTimeSek;
        };
    };
    
    // Start rain thread
    if (_rainIntervalRainProbability > 0) then {
        [_minimumRain, _maximumRain, _forceRainToStopAfterOneRainInterval, _minRainIntervalTimeMin, _maxRainIntervalTimeMin, _rainIntervalRainProbability, _debug] spawn {
            private ["_minimumRain", "_maximumRain", "_forceRainToStopAfterOneRainInterval", "_minRainIntervalTimeMin", "_maxRainIntervalTimeMin", "_rainIntervalRainProbability", "_debug"];
            private ["_nextRainEventTime", "_forceStop"];
            
            _minimumRain = _this select 0;
            _maximumRain = _this select 1;
            _forceRainToStopAfterOneRainInterval = _this select 2;
            _minRainIntervalTimeMin = _this select 3;
            _maxRainIntervalTimeMin = _this select 4;
            _rainIntervalRainProbability = _this select 5;
            _debug = _this select 6;
            
            if (rain > 0) then {
                drn_var_DynamicWeather_Rain = rain;
                publicVariable "drn_var_DynamicWeather_Rain";
            };
            
            _nextRainEventTime = time;
            _forceStop = false;
            
            while {true} do {
                
                if (overcast > 0.75) then {
                    
                    if (time >= _nextRainEventTime) then {
                        private ["_rainTimeSec"];
                        
                        // At every rain event time, start or stop rain with 50% probability
                        if (random 100 < _rainIntervalRainProbability && !_forceStop) then {
                            drn_var_DynamicWeather_rain = _minimumRain + random (_maximumRain - _minimumRain);
                            publicVariable "drn_var_DynamicWeather_rain";
                            
                            _forceStop = _forceRainToStopAfterOneRainInterval;
                        }
                        else {
                            drn_var_DynamicWeather_rain = 0;
                            publicVariable "drn_var_DynamicWeather_rain";
                            
                            _forceStop = false;
                        };
                        
                        // Pick a time for next rain change
                        _rainTimeSec = _minRainIntervalTimeMin * 60 + random ((_maxRainIntervalTimeMin - _minRainIntervalTimeMin) * 60);
                        _nextRainEventTime = time + _rainTimeSec;
                        
                        if (_debug) then {
                            ["Rain set to " + str drn_var_DynamicWeather_rain + " for " + str (_rainTimeSec / 60) + " minutes"] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                        };
                    };
                }
                else {
                    if (drn_var_DynamicWeather_rain != 0) then {
                        drn_var_DynamicWeather_rain = 0;
                        publicVariable "drn_var_DynamicWeather_rain";
                        
                        if (_debug) then {
                            ["Rain stops due to low overcast."] call drn_fnc_DynamicWeather_ShowDebugTextAllClients;
                        };
                    };
                    
                    _nextRainEventTime = time;
                    _forceStop = false;
                };
                
                if (_debug) then {
                    sleep 1;
                }
                else {
                    sleep 10;
                };
            };
        };
    };
};

[_rainIntervalRainProbability, _debug] spawn {
    private ["_rainIntervalRainProbability", "_debug"];
    private ["_rain", "_rainPerSecond"];
    
    _rainIntervalRainProbability = _this select 0;
    _debug = _this select 1;
    
    if (_debug) then {
        _rainPerSecond = 0.2;
    }
    else {
        _rainPerSecond = 0.03;
    };
    
    if (_rainIntervalRainProbability > 0) then {
        _rain = drn_var_DynamicWeather_Rain;
    }
    else {
        _rain = 0;
    };
    
    0 setRain _rain;
    sleep 0.1;
    
    while {true} do {
        if (_rainIntervalRainProbability > 0) then {
            if (_rain < drn_var_DynamicWeather_Rain) then {
                _rain = _rain + _rainPerSecond;
                if (_rain > 1) then { _rain = 1; };
            };
            if (_rain > drn_var_DynamicWeather_Rain) then {
                _rain = _rain - _rainPerSecond;
                if (_rain < 0) then { _rain = 0; };
            };
        }
        else {
            _rain = 0;
        };
        
        3 setRain _rain;
        
        sleep 3;
    };
};

 

 

 

 

В init.sqf 

Найти:

DZE_TRADER_SPAWNMODE = false;

Заменить на:

DZE_TRADER_SPAWNMODE = true;

 

P.S Те погодные эфекты дальность делают норм , если не хватает дальность задай вручную дальность в init.sqf

Была та же проблема с пропажей при покупке. Включил парашут с машинами все ништяк, а вот верты падая взрываются. Как поправить?

Share this post


Link to post
Share on other sites
  • 0

У меня в init.sqf нет такой строчки DZE_TRADER_SPAWNMODE , не подскажете где она должна стоять ?

Share this post


Link to post
Share on other sites
  • 0

Где и остальные настройки. Выше эвентов короче.

Ок понял щас попробую спс!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By Sancezz063
      Пропадают машины, люди говорят до рестарта оставляют машину, а после она просто пропадает, может ли на это влиять админка ? 
      Машины пропадают которые собирают на сервере
    • By ownness
      Ребят, подскажите, можно ли добавить цвета/текстуры на автомобили, чтобы при покупке выбирать?
       
      вот кусок кода Config_Vehicles.hpp... в нем две телеги, у первой есть цвета (так и не понял, откуда они тянутся), у второй - нет. есть варианты реализации?
      class madsa_hummer_h2 { realname="Hummer H2"; buyPrice=344000; inventory=85; side="CIV"; insurance=0; disableOwnerInfos=1; licenses[]={"rebelle_1"}; fuel="SP95"; fuelCapacity=121; colors[]= { "madsa_hummer_h2_black_F", "madsa_hummer_h2_blue_F", "madsa_hummer_h2_gold_F", "madsa_hummer_h2_green_F", "madsa_hummer_h2_pink_F", "madsa_hummer_h2_purple_F", "madsa_hummer_h2_red_F", "madsa_hummer_h2_silver_F", "madsa_hummer_h2_white_F", "madsa_hummer_h2_yellow_F" }; }; class madsa_hummer_h2_black_F: madsa_hummer_h2 {}; class madsa_hummer_h2_blue_F: madsa_hummer_h2 {}; class madsa_hummer_h2_gold_F: madsa_hummer_h2 {}; class madsa_hummer_h2_green_F: madsa_hummer_h2 {}; class madsa_hummer_h2_pink_F: madsa_hummer_h2 {}; class madsa_hummer_h2_purple_F: madsa_hummer_h2 {}; class madsa_hummer_h2_red_F: madsa_hummer_h2 {}; class madsa_hummer_h2_silver_F: madsa_hummer_h2 {}; class madsa_hummer_h2_white_F: madsa_hummer_h2 {}; class madsa_hummer_h2_yellow_F: madsa_hummer_h2 {}; class madsa_zl1_f { realname="Chevrolet zl1f"; buyprice=260000; inventory=20; side="CIV"; insurance=1; licence[]={"driver"}; fuel="SP98"; fuelCapacity=67; colors[]={}; };  
    • By BorizzK
      //AUTHOR: BORIZZ.K //Version 20.12.2018.0011 void PlaceAllCarsToGround() { array<Object> nearest_objects = new array<Object>; array<CargoBase> proxy_cargos = new array<CargoBase>; Object object; string className; int objectcount = 0; vector mapcenter = "7500 0 7500"; int radius = 20000; vector foundcar_pos; mapcenter[1] = GetGame().SurfaceY( mapcenter[0], mapcenter[2] ); GetGame().GetObjectsAtPosition(mapcenter, radius, nearest_objects, proxy_cargos); for ( int i = 0; i < nearest_objects.Count(); i++ ) { object = nearest_objects.Get(i); className = object.GetType(); if ( GetGame().IsKindOf(className, "Car" ) ) //if ( className == "OffroadHatchback" || className == "V3SVehicle" || className == "V3SChassis" || className == "CivilianSedan") { EntityAI objectEnt = EntityAI.Cast(object); if (objectEnt) { foundcar_pos = objectEnt.GetPosition(); Print("::: PlaceAllCarsToGround() ::: Found car: " + className + ", objectEnt: " + objectEnt + ", Position: " + foundcar_pos.ToString() + ", SurfaceGetNormal: " + GetGame().SurfaceGetNormal(foundcar_pos[0], foundcar_pos[2]).ToString()); //Check surface under car /* string surface_type; int liquidType; GetGame().SurfaceUnderObject(object, surface_type, liquidType); Print("::: PlaceAllCarsToGround() ::: Found car: " + className + ", objectEnt: " + objectEnt + ", surface_type: " + surface_type + ", liquidType: " + liquidType); */ if ( foundcar_pos[1] < (GetGame().SurfaceY(foundcar_pos[0], foundcar_pos[2])) - 0.1 || foundcar_pos[1] > (GetGame().SurfaceY(foundcar_pos[0], foundcar_pos[2])) + 0.1 ) { foundcar_pos[1] = GetGame().SurfaceY(foundcar_pos[0], foundcar_pos[2]); objectEnt.SetPosition(foundcar_pos); objectEnt.SetOrientation(objectEnt .GetOrientation()); objectEnt.SetDirection(objectEnt .GetDirection()); Print("::: PlaceAllCarsToGround() ::: Position changed for car : " + className + ", objectEnt: " + objectEnt + ", Position: " + foundcar_pos.ToString()); } else { Print("::: PlaceAllCarsToGround() ::: No position change required for car : " + className + ", objectEnt: " + objectEnt); } } } } } Добавить код в init.c (ВНЕ КЛАССА)
      Вызывать в конце функции main()
      Просто вставив в конце
      PlaceAllCarsToGround();
       
      P.S. Поправил код, + учел рекомендации Ультимы
      У меня на сервере с машинами все ок
       
    • By BorizzK
      Накрапал функций (по мотивам того что делали для 0.62 когда-то)
      Проверяем сколько машин на сервере (кстати, кому известны координаты центра Черноруси и макс полезный радиус от центра где могут располагаться объекты?)
      Если машин данного типа достаточно на карте, не спавним
      Если не хватает, перед спавном проверяем нет ли машины рядом (что бы не заспавнить внутрь другой)
      Если все норм, спавним
       
      int CheckNearObjects(vector pos, int radius, string objectClass) //Проверка обьектов поблизости { array<Object> nearest_objects = new array<Object>; array<CargoBase> proxy_cargos = new array<CargoBase>; Object object; string className; int objectcount = 0; GetGame().GetObjectsAtPosition(pos, radius, nearest_objects, proxy_cargos); Print("::: SpawnCars.c ::: CheckNearObjects (EntityAI m_Object, int radius) ::: Radius: " + radius.ToString() + ", all nearest_objects: " + nearest_objects.Count().ToString()); for ( int i = 0; i < nearest_objects.Count(); i++ ) { object = nearest_objects.Get(i); className = object.GetType(); if ( className == objectClass ) { objectcount++; Print( "::: SpawnCars.c ::: CheckNearestObjects: found object " + objectcount.ToString() + ": " + object.ToString() + ", Type/Class: " + className + " !!!"); } } return objectcount; } int SpawnCar(string m_Car_Class, TVectorArray spawn_Points, int max_Car_Count, float min_Car_Health, float max_Car_Health, bool damageallow) //Спавн машины по заданным параметрам { Print("::: SpawnCars.c ::: SpawnCar(" + m_Car_Class + ", " + spawn_Points.ToString() + ") :::"); vector m_Car_Pos; EntityAI m_Car; int n_Car_Count = 0; int all_Car_Count = 0; int s_Car_Count = 0; array<string> m_Car_Equip_Array = new array<string>; if (m_Car_Class == "OffroadHatchback") { /* Так то же можно m_Car_Equip_Array.Insert("HatchbackWheel"); m_Car_Equip_Array.Insert("HatchbackWheel"); m_Car_Equip_Array.Insert("HatchbackWheel"); m_Car_Equip_Array.Insert("HatchbackWheel"); m_Car_Equip_Array.Insert("CarBattery"); m_Car_Equip_Array.Insert("SparkPlug"); m_Car_Equip_Array.Insert("EngineBelt"); m_Car_Equip_Array.Insert("CarRadiator"); m_Car_Equip_Array.Insert("HatchbackDoors_Driver"); m_Car_Equip_Array.Insert("HatchbackDoors_CoDriver"); m_Car_Equip_Array.Insert("HatchbackHood"); m_Car_Equip_Array.Insert("HatchbackTrunk"); */ //И так можно m_Car_Equip_Array = {"HatchbackWheel","HatchbackWheel","HatchbackWheel","HatchbackWheel","CarBattery","SparkPlug","SparkPlug","EngineBelt","CarRadiator","HatchbackDoors_Driver","HatchbackDoors_CoDriver","HatchbackHood","HatchbackTrunk"}; //Проверяем m_Car_Equip_Array.Debug(); } /* else if (m_Car_Class == "M3S") { //Тут заполняем массив комплектующими M3S } */ else { Print("::: SpawnCars.c ::: SpawnCar() ::: NO CAR / WRONG CLASS SPECIFIED :::"); return s_Car_Count; } all_Car_Count = CheckNearObjects("7000 0 7000", 20000, m_Car_Class); //Можно отключить если сервер глючит при старте, тогда присовойте all_Car_Count значение - all_Car_Count = 1; (см ниже) //all_Car_Count = 1; for ( int i = 0; i < spawn_Points.Count(); i++ ) { m_Car_Pos = spawn_Points.Get(i); n_Car_Count = CheckNearObjects(m_Car_Pos, 10, m_Car_Class); Print("::: SpawnCars.c ::: n_Car_Count = " + n_Car_Count.ToString()); if (s_Car_Count + all_Car_Count < max_Car_Count) { if (n_Car_Count < 1) { m_Car = EntityAI.Cast(GetGame().CreateObject(m_Car_Class, m_Car_Pos, false, true)); for ( int e = 0; e < m_Car_Equip_Array.Count(); e++ ) { m_Car.GetInventory().CreateAttachment( m_Car_Equip_Array.Get(e) ); } m_Car.SetAllowDamage(damageallow); m_Car.SetHealth("","",Math.RandomInt(min_Car_Health,max_Car_Health)); Print("::: SpawnCars.c ::: Spawned car: " + m_Car.ToString() + ", Position: " + m_Car.GetPosition().ToString()); if (m_Car) { s_Car_Count++; } } else { Print("::: SpawnCars.c ::: Car spawn not allowed at position: " + m_Car_Pos.ToString() + ", becouse nearest car with same class " + m_Car_Class + " found."); } } else { Print("::: SpawnCars.c ::: Car spawn not allowed becouse cars with same class " + m_Car_Class + " >= " + max_Car_Count.ToString()); } } return s_Car_Count; }  
      Подключение
       
      Правим по своему вкусу
      Помещаем код в файл и размещаем в папке доступной серверу
       
      В самом начале init.c
      #include "$CurrentDir:\\путь\\путь\\имя файла с кодом.c
       
      Далее в функции main вызываем спавн
       
      TVectorArray spawn_Points_Niva = {"6063 0 7871"}; //array with positions, for more cars write more positios in to array int SpawnCarsCarsCount = SpawnCar("OffroadHatchback", spawn_Points_Niva, 32, 100, 100, false); //Class, Positions, Max count, min health, max health, damage allow - true/false Print("::: SpawnCars.c ::: SpawnCars() ::: Spawned cars: " + SpawnCarsCarsCount.ToString()); //это просто каммент  
      Или просто
      int SpawnCarsCarsCount;
      SpawnCarsCarsCount = SpawnCar("M3S", {"6000 0 6000", "7000 0 8000"}, 44, 100, 100, false);
       
      Но для M3S нужно прописать комплектуху в SpawnCar() в массив m_Car_Equip_Array
       
      Ну вобщем разберетесь )))
       
       
      Добавлено:
      Альтернативный вариант от комьюнити:
       
  • Our picks

×
×
  • Create New...

Important Information

By using this site, you automaticly agree to our Guidelines and Privacy Policy.
We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.