[Tutorial] Snow added to Dynamic Weather

No I haven't, but if you take a look at the snow script included and think you could do it, that would be great.
 
Snow works perfectly :) very nice script, thanks Vampire
Is there a way to change how much falls ? from a slight snow fall to a blizzard
 
Snow works perfectly :) very nice script, thanks Vampire
Is there a way to change how much falls ? from a slight snow fall to a blizzard

Just play with
_minimumSnow
and
_maximumSnow.

That's the best you're going to be able to do with what there is at the moment.
 
Working on getting the other snow to work with this and making progress.

I have the larger particles working, but its not quite right yet.
 
Thak you Vampire, very nice work and atmosphere weather script.
Working great.
I looking forward for update about cold effect added
 
so just heads up for anyone wondering.... the infinstar/blur antihack also interferes with setting custom temperature it seems. Also, if you're experiencing the crazy wind I think this is also caused by the antihack. What Ive noticed about the wind is its usually just one player or a couple players experiencing it. Relogging seems to correct the issue for anyone experiencing the issue.
 
Thak you Vampire, very nice work and atmosphere weather script.
Working great.
I looking forward for update about cold effect added
you can do this yourself by extracting fn_temperatur.sqf from your dayz code to your server and calling it in your custom compiles
 
I messed around with it a little bit, tried to merge the snow script everyone uses and couldn't get it to work. I increased the snow and added some color correction and film grain along with heavy fog and a shortened view distance when it snows tho. I've only tested it with snowchance set to 100% tho so I'll have to test how it looks when it changes to snowing.
aZpvvBq.png
 
inkko I actually prefer my snow on 100% of the time so if you release this Id be interested. Although my antihack does tend to interfere with my weather/temperature unfortunately.
 
This is what mine looks like right now
Code:
scriptName "fn_dzn_snowfall.sqf";
scriptName "fn_dzn_snowfall.sqf";
/*
File: fn_dzn_snowfall.sqf
Author: Sumrak
 
Description:
Simple snowfall script for Namalsk OR DayZ: Namalsk
 
Parameter(s):
_this select 0: Double - time (default 3.0)
_this select 1: Double - density (can be 0 - 1, default 0.5)
 
Returns:
Nice snow particle effect with a proper density and for the defined time.
*/
 
private["_dzn_snow_density", "_dzn_snow_pc", "_dzn_snow_timer", "_isinbuilding"];
 
if (isNil "_this") then {
_this = [];
};
if (count _this > 0) then {
_dzn_snow_timer = abs (_this select 0);
} else {
_dzn_snow_timer = 3;
};
if (count _this > 1) then {
if ((_this select 1) != -1) then {
_dzn_snow_density = abs ( 100 * (_this select 1));
} else {
_dzn_snow_density = 0;
};
} else {
_dzn_snow_density = 50;
};
//added more falling snow at different distances for heavier downfall
_d = 20;
_h = 15;
_h2 = 7;
_h3 = 4;
_h4 = 2;
_h5 = 10;
_density = 20000;
_dzn_snow_pc = 0;
snow = _dzn_snow_density / 100;
 
while {_dzn_snow_timer >= 0} do {
_position = getPos player;
if ([player] call fnc_isInsideBuilding) then {
_isinbuilding= true;
} else {
_isinbuilding= false;
};
 
while {(_dzn_snow_pc < _dzn_snow_density) && !_isinbuilding} do {
 
setWind [0, -2, true];
// supossedly fixes issuer where ground fog doesn't follow cars.
//-- ground fog --
_inVehicle = (vehicle player != player);
        if (_inVehicle) then {
            _obj = (vehicle player);
        } else {
            _obj = player;
        };
 
        _pos = position _obj;
_pos = position (vehicle _obj);
 
_fog1 = "#particlesource" createVehicleLocal _pos;
_fog1 setParticleParams [
["\Ca\Data\ParticleEffects\Universal\universal.p3d" , 16, 12, 13, 0], "", "Billboard", 1, 10,
[0, 0, -6], [0, 0, 0], 1, 1.275, 1, 0,
[7,6], [[1, 1, 1, 0], [1, 1, 1, 0.04], [1, 1, 1, 0]], [1000], 1, 0, "", "", _obj
];
_fog1 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog1 setParticleCircle [0.001, [0, 0, -0.12]];
_fog1 setDropInterval 0.01;
 
_fog2 = "#particlesource" createVehicleLocal _pos;
_fog2 setParticleParams [
["\Ca\Data\ParticleEffects\Universal\universal.p3d" , 16, 12, 13, 0], "", "Billboard", 1, 10,
[0, 0, -6], [0, 0, 0], 1, 1.275, 1, 0,
[7,6], [[1, 1, 1, 0], [1, 1, 1, 0.04], [1, 1, 1, 0]], [1000], 1, 0, "", "", _obj
];
_fog2 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog2 setParticleCircle [0.001, [0, 0, -0.12]];
_fog2 setDropInterval 0.01;
 
_fog3 = "#particlesource" createVehicleLocal _pos;
_fog3 setParticleParams [
["\Ca\Data\ParticleEffects\Universal\universal.p3d" , 16, 12, 13, 0], "", "Billboard", 1, 10,
[0, 0, -6], [0, 0, 0], 1, 1.275, 1, 0,
[7,6], [[1, 1, 1, 0], [1, 1, 1, 0.04], [1, 1, 1, 0]], [1000], 1, 0, "", "", _obj
];
_fog3 setParticleRandom [3, [55, 55, 0.2], [0, 0, -0.1], 2, 0.45, [0, 0, 0, 0.1], 0, 0];
_fog3 setParticleCircle [0.001, [0, 0, -0.12]];
_fog3 setDropInterval 0.01;
//-- ground fog end --
// uncomment and set value for desired fog, or leave commented out for randomized fog.
//bis_fog = .9;
//0 setfog bis_fog;
 
// filmgrain, seems a little too grainy at the moment
"filmGrain" ppEffectEnable true;
"filmGrain" ppEffectAdjust [0.02, 1, 1, 0.1, 1, false];
"filmGrain" ppEffectCommit 5;
 
_dpos = [((_position select 0) + (_d - (random (2 * _d))) + ((velocity vehicle player select 0) * 6)), ((_position select 1) + (_d - (random (2 * _d))) + ((velocity vehicle player select 1) * 6)), ((_position select 2) + _h)];
drop ["\ca\data\cl_water", "", "Billboard", 1, 8, _dpos, wind, 1, 0.0001, 0.0, 0.5, [0.05, 0.05, 0.05], [[1, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], [0, 0], 0.2, 1.2, "", "", ""];
 
_dpos = [((_position select 0) + (_d - (random (2 * _d))) + ((velocity vehicle player select 0) * 6)), ((_position select 1) + (_d - (random (2 * _d))) + ((velocity vehicle player select 1) * 6)), ((_position select 2) + _h2)];
drop ["\ca\data\cl_water", "", "Billboard", 1, 8, _dpos, wind, 1, 0.0001, 0.0, 0.5, [0.05, 0.05, 0.05], [[1, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], [0, 0], 0.2, 1.2, "", "", ""];
 
_dpos = [((_position select 0) + (_d - (random (2 * _d))) + ((velocity vehicle player select 0) * 6)), ((_position select 1) + (_d - (random (2 * _d))) + ((velocity vehicle player select 1) * 6)), ((_position select 2) + _h3)];
drop ["\ca\data\cl_water", "", "Billboard", 1, 8, _dpos, wind, 1, 0.0001, 0.0, 0.5, [0.05, 0.05, 0.05], [[1, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], [0, 0], 0.2, 1.2, "", "", ""];
 
_dpos = [((_position select 0) + (_d - (random (2 * _d))) + ((velocity vehicle player select 0) * 6)), ((_position select 1) + (_d - (random (2 * _d))) + ((velocity vehicle player select 1) * 6)), ((_position select 2) + _h4)];
drop ["\ca\data\cl_water", "", "Billboard", 1, 8, _dpos, wind, 1, 0.0001, 0.0, 0.5, [0.05, 0.05, 0.05], [[1, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], [0, 0], 0.2, 1.2, "", "", ""];
 
_dpos = [((_position select 0) + (_d - (random (2 * _d))) + ((velocity vehicle player select 0) * 6)), ((_position select 1) + (_d - (random (2 * _d))) + ((velocity vehicle player select 1) * 6)), ((_position select 2) + _h5)];
drop ["\ca\data\cl_water", "", "Billboard", 1, 8, _dpos, wind, 1, 0.0001, 0.0, 0.5, [0.05, 0.05, 0.05], [[1, 1, 1, 0], [1, 1, 1, 1], [1, 1, 1, 1], [1, 1, 1, 1]], [0, 0], 0.2, 1.2, "", "", ""];
 
_dzn_snow_pc = _dzn_snow_pc + 1;
};
 
sleep 0.1;
_dzn_snow_timer = _dzn_snow_timer - 0.1;
_dzn_snow_pc = 0;
};
snow = 0;
 
works nicely but the fog is way too thick for my pvp server. I like the idea though, scarier and all that. Just no visibility so you can't really engage AI or players.
 
works nicely but the fog is way too thick for my pvp server. I like the idea though, scarier and all that. Just no visibility so you can't really engage AI or players.

You can lower the amount of fog, I got the ground fog from the other snow script working as well, but after it finishes snowing its stuck on. Plus when it changes to snowing its like a flash of darkness when it switches to color correction and the game fog instantly fills your view. I updated my above post with changes I've made for just snow, it needs work on transitioning between different types of weather.
 
Roger that, calling the fn_temperatur.sqf

But i suppose i have to edit it to add snow and fog effect isnt it?

Code:
/*
Author: TeeTime
 
Does: Manages the body temperatur of a Player
 
Possible Problems:
    =>  Balancing
 
Missing:
    Save Functions
   
    Should Effects Sum Up?
   
    Math Functions for Water
   
    Player Update GUI Colours need to be checked
   
    Shivering Function need improments
*/
 
 
    private ["_looptime","_sun_factor","_building_factor","_vehicle_factor","_fire_factor","_water_factor","_rain_factor","_night_factor","_wind_factor","_height_mod","_difference","_isinbuilding","_isinvehicle","_raining","_sunrise","_building","_fireplaces","_daytime","_temp","_moving_factor"];
 
    _looptime             = _this;
   
    //Factors are equal to win/loss of factor*basic value
    //All Values can be seen as x of 100: 100 / x = minutes from min temperetaure to max temperature (without other effects)
    _vehicle_factor        =    4;
    _moving_factor         =      7;
    _fire_factor        =    15;    //Should be always:  _rain_factor + _night_factor + _wind_factor OR higher !
    _building_factor     =      7;
    _sun_factor            =     4;    //max sunfactor linear over the day. highest value in the middle of the day
 
   
    _fog_factor       =     -4; 
    _snow_factor       =     -8;  
     _water_factor        =     -8;
    _rain_factor        =    -3;
    _night_factor        =     -1.5;
    _wind_factor        =    -1;
   
    _difference     = 0;
    // _hasfireffect    = false;
    _isinbuilding    = false;
    _isinvehicle    = false;
   
    _raining         = if(rain > 0) then {true} else {false};
    _sunrise        = call world_sunRise;
   
    //POSITIV EFFECTS
   
    //vehicle
    if((vehicle player) != player) then {
        _difference     = _difference + _vehicle_factor;
        _isinvehicle     = true;
    } else {
        //speed factor
        private["_vel","_speed"];
        _vel =         velocity player;
        _speed =     round((_vel distance [0,0,0]) * 3.5);
        _difference = (_moving_factor * (_speed / 20)) min 7;
    };
   
    //fire
    private ["_fireplaces"];
    _fireplaces = nearestObjects [player, ["Land_Fire","Land_Campfire"], 8];
    if(({inflamed _x} count _fireplaces) > 0 && !_isinvehicle ) then {
        //Math: factor * 1 / (0.5*(distance max 1)^2)         0.5 = 12.5% of the factor effect in a distance o 4 meters
        _difference     = _difference + (_fire_factor /(0.5*((player distance (_fireplaces select 0)) max 1)^2));
        //_hasfireffect     = true;
    };
   
    //building
    _building = nearestObject [player, "HouseBase"];
    if(!isNull _building) then {
        if([player,_building] call fnc_isInsideBuilding) then {
            //Make sure thate Fire and Building Effect can only appear single        Not used at the moment
            //if(!_hasfireffect && _fire_factor > _building_factor) then {
                _difference = _difference + _building_factor;
            //};
            _isinbuilding    = true;
            dayz_inside     = true;
        } else {
            dayz_inside     = false;
        };
    } else {
        dayz_inside     = false;
    };
   
   
    //sun
    if(daytime > _sunrise && daytime < (24 - _sunrise) && !_raining && overcast <= 0.6 && !_isinbuilding) then {
       
        /*Mathematic Basic
       
        t = temperature effect
       
        a = calcfactor
        f = sunfactor
        s = sunrise
        d = daytime
       
        I:    a = f / (12 - s)�
        II:    t = -a * (d - 12)� + f
       
        I + II =>
       
        t = -(f / (12 - s)�) * (d - 12)� + f
       
        Parabel with highest Point( greatest Effect == _sun_factor) always at 12.00
        Zero Points are always at sunrise and sunset -> Only Positiv Values Possible
        */
       
        _difference = _difference + (-((_sun_factor / (12 - _sunrise)^2)) * ((daytime - 12)^2) + _sun_factor);   
    };
   
 
 
 
    //NEGATIVE  EFFECTS
   
    //water
    if(surfaceIsWater getPosATL player || dayz_isSwimming) then {
        _difference = _difference + _water_factor;
    };
   
    //rain
    if(_raining && !_isinvehicle && !_isinbuilding) then {
        _difference = _difference + (rain * _rain_factor);
    };
   
    //night
    private ["_daytime"];
    if((daytime < _sunrise || daytime > (24 - _sunrise)) && !_isinvehicle) then {
        _daytime     = if(daytime < 12) then {daytime + 24} else {daytime};
        if(_isinbuilding) then {
            _difference = _difference + ((((_night_factor * -1) / (_sunrise^2)) * ((_daytime - 24)^2) + _night_factor)) / 2;
        } else {
        _difference = _difference + (((_night_factor * -1) / (_sunrise^2)) * ((_daytime - 24)^2) + _night_factor);
    };
    };
   
    //wind
    if(((wind select 0) > 4 || (wind select 1) > 4) && !_isinvehicle && !_isinbuilding ) then {
        _difference = _difference + _wind_factor;
    };
   
    //height
    if (!_isinvehicle && overcast >= 0.6) then {
        _height_mod = ((getPosASL player select 2) / 100) / 2;
        _difference = _difference - _height_mod;
    };
   
    //Calculate Change Value            Basic Factor            Looptime Correction            Adjust Value to current used temperatur scala
    _difference = _difference * SleepTemperatur / (60 / _looptime)        * ((dayz_temperaturmax - dayz_temperaturmin) / 100);
   
    //Change Temperatur                                                             Should be moved in a own Function to allow adding of Items which increase the Temp like "hot tea"
    dayz_temperatur = (((dayz_temperatur + _difference) max dayz_temperaturmin) min dayz_temperaturmax);
   
    //Add Shivering
    //                        Percent when the Shivering will start
    if(dayz_temperatur <= (0.125 * (dayz_temperaturmax - dayz_temperaturmin) + dayz_temperaturmin)) then {
        //CamShake as linear Function Maximum reached when Temp is at temp minimum. First Entry = Max Value
        _temp = 0.6 * (dayz_temperaturmin / dayz_temperatur );
        addCamShake [_temp,(_looptime + 1),30];    //[0.5,looptime,6] -> Maximum is 25% of the Pain Effect   
    } else {
        addCamShake [0,0,0];            //Not needed at the Moment, but will be necesarry for possible Items
    };

adding snow and fog facor isnt enought i guess, what more to add?
 
No, you don't need to add anything.

You just need to adjust the moving and fire factor down a point or two until you're happy with the effects in game.
 
Thank you mate.

I place the file into the server/compile and i call it from server_function.sqf like that?

fn_temperatur = compile preprocessFileLineNumbers "\z\addons\dayz_server\compile\fn_temperatur.sqf";

? is it right, i'm not sure
 
I imagine if its like the dynamic weather you place it in a folder named whatever you want to call it (we'll call it custom), and in your compiles.sqf you call it something like this
Code:
execVM "custom\fn_temperatur.sqf";
initialized = true;

Of course you'd need to change your init.sqf to point to this custom folder and compiles.sqf
 
i used it in the test server.

I added it into the complie folder of the server and called like i wrote ^^^^^^

It seem working correctly

I will try to test trought the client side and call it like you do
 
Im gonna try and get it to work on my server as well.. I think my antihack prevents it from working though... we'll see

It's not my antihack blocking it because I tried it after disabling the antihack. Maybe Im doing it wrong because its not working and its actually blocking my snow script from working as well.

Another interesting bit, even though I have the rained turned off in the dynamic weather, it definitely rains.
 
Last edited:
Back
Top