Random snow effect

This is looking really good. If you could almost essentially recreate a basic dynamic weather script including snow, I would use it on my server.
 
I am creating a separate script which updates public variables used in the dynamic weather script. I will make it snow if there is +70 % chance. Then it turns into a real blizzard with 100m visibility and overcast at max and fog at 50%

Afterwards I gradually restore the environment to the original values (visibility 1600m, no rain, 70% overcast, 10% fog).

And I am now working on adding a cold effect. Outdoors it will get very cold and players will need heatpacks during the blizzard.
 
Just make the variables in your script global and adjust fn_tempuratur to use the current setting.

Although I'm not sure of fn_tempuratur loops to update dynamically or if it's static.

Also, try out this as a map filter. It's what Namalsk uses on their map.
Code:
// COLD COLORIZE FOR NIGHTSTALKERS: Shadow of Namalsk modification, created by Sumrak, 2010
 
ns_col_cold = ppEffectCreate ["colorCorrections", 1503];
ns_col_cold ppEffectEnable true;
ns_col_cold ppEffectAdjust [1.0, 1.0, 0.0,[0.2, 0.2, 1.0, 0.0],[0.4, 0.75, 1.0, 0.60],[0.5,0.3,1.0,-0.1]];
ns_col_cold ppEffectCommit 0;
 
Just make the variables in your script global and adjust fn_tempuratur to use the current setting.

Although I'm not sure of fn_tempuratur loops to update dynamically or if it's static.

Also, try out this as a map filter. It's what Namalsk uses on their map.
Code:
// COLD COLORIZE FOR NIGHTSTALKERS: Shadow of Namalsk modification, created by Sumrak, 2010
 
ns_col_cold = ppEffectCreate ["colorCorrections", 1503];
ns_col_cold ppEffectEnable true;
ns_col_cold ppEffectAdjust [1.0, 1.0, 0.0,[0.2, 0.2, 1.0, 0.0],[0.4, 0.75, 1.0, 0.60],[0.5,0.3,1.0,-0.1]];
ns_col_cold ppEffectCommit 0;


It has to loop trough the script. Because there is a if rain then statement in there. The variables changes when it is raining. I am going to alter the temperature script in a minute.

Can I leave the script inside dayz_code.pbo, or must I place it in the missions pbo?
 
Ok I will post it :). One problem I still have is that is also snows inside buildings. Need to fix that.

PS: the temperature change works fine! When it is snowing the temperature is now -25.
 
Axeman talked about the snowing in buildings thing before. You would need to map out all the buildings on the map and put them in the script as locations.

Another option you could maybe do is what fn_temperatur does to detect if people are indoors to warm them up.

Code:
    //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;
    };

Just modify the code so that if they are in a building, kill the snow effect.
 
Cool, lol... I'd like to get something like thhis on my server as well, if you release it


Bags

p.s. Or is the script in the OP the one your using/been updated
 
I have it running on my main server now. You can see the script in action on: 213.19.146.30:2312.

I will post the script tonight.
 
Random snow V1

This is the first release of the random snow script.

Create a file called snow.sqf in the directory custom in your missions.pbo.
Code:
_snowrun = true;
snow = nil;
 
while {_snowrun} do {
        _snowchance = random 100;
        if (_snowchance > 75) then {
                if (isNil "snow") then {
                        snow = [] execvm "custom\spawn_snow.sqf";
                };
        }
        else {
                if (!isNil "snow") then {
                        terminate snow;
                        snow = nil;
                        sleep 20;
                        setviewdistance 1600;
                        0 setfog 0.3;
                        0 setovercast 0.6;
                };
        };
sleep 900;
};

Copy the following file and rename it to spawn_snow.sqf and place it in the same folder.
Not created by me, credits: Audio Rejectz

http://opendayz.net/threads/adding-snow-to-your-server.12523/

Code:
//Snow Storm
//Modified by Audio Rejectz, all credits go to original creators JW - Snow script / BI - Wind & Dust particles
"filmGrain" ppEffectEnable true;
"filmGrain" ppEffectAdjust [0.02, 1, 1, 0.1, 1, false];
"filmGrain" ppEffectCommit 5;
 
setviewdistance 900;
bis_fog = 0.8;
 
setviewdistance 900;
0 setovercast 0.9;
0 setrain 1;
//0 setfog 0.8;
0 setfog bis_fog;
 
[] spawn {
    _delay = 3;
    sleep 0.01;
    while {true} do {
        _delay  setovercast 0.9;
        _delay  setrain 1;
        _delay  setfog bis_fog;
        sleep _delay ;
    };
};
 
//--- Wind & Dust
[] spawn {
    waituntil {isplayer player};
    setwind [0.201112,0.204166,true];
    while {true} do {
        _ran = ceil random 5;
        playsound format ["wind_%1",_ran];
        _obj = vehicle player;
        _pos = position _obj;
 
        //--- Dust
            setwind [0.201112*2,0.204166*2,false];
        _velocity = [random 10,random 10,-1];
        _color = [1.0, 0.9, 0.8];
        _alpha = 0.02 + random 0.02;
        _ps = "#particlesource" createVehicleLocal _pos;
        _ps setParticleParams [["\Ca\Data\ParticleEffects\Universal\universal.p3d", 16, 12, 8], "", "Billboard", 1, 3, [0, 0, -6], _velocity, 1, 1.275, 1, 0, [9], [_color + [0], _color + [_alpha], _color + [0]], [1000], 1, 0, "", "", _obj];
        _ps setParticleRandom [3, [30, 30, 0], [0, 0, 0], 1, 0, [0, 0, 0, 0.01], 0, 0];
        _ps setParticleCircle [0.1, [0, 0, 0]];
        _ps setDropInterval 0.01;
 
        sleep (random 1);
        deletevehicle _ps;
        _delay = 10 + random 20;
        sleep _delay;
 
    };
};
 
//Snow script
 
setWind [0, -5, true];
 
_obj = player;
 
_pos = position (vehicle _obj);
 
_d  = 15;
_h  = 12;
_h1 = 8;
_h2 = 4;
_density = 20000;
 
 
 
_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;
 
 
while {true} do
{
_a = 0;
while { _a < _density } do
{
_pos = position player;
_fog1 setpos _pos;
_fog2 setpos _pos;
_fog3 setpos _pos;
0 setRain 0;
 
_dpos = [((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 2) + _h)];
drop ["\ca\data\cl_water", "", "Billboard", 1, 7, _dpos, [0,0,-1], 1, 0.0000001, 0.000, 0.7, [0.07], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];    _a = _a + 1;
 
 
_dpos = [((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 2) + _h1)];
drop ["\ca\data\cl_water", "", "Billboard", 1, 7, _dpos, [0,0,-1], 1, 0.0000001, 0.000, 0.7, [0.07], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];
 
 
_dpos = [((_pos select 0) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 1) + (_d - (random (2*_d))) + ((velocity vehicle player select 0)*1)),((_pos select 2) + _h2)];
drop ["\ca\data\cl_water", "", "Billboard", 1, 7, _dpos, [0,0,-1], 1, 0.0000001, 0.000, 0.7, [0.07], [[1,1,1,0], [1,1,1,1], [1,1,1,1], [1,1,1,1]], [0,0], 0.2, 1.2, "", "", ""];
 
};
sleep 0.2;
};

In your init.sqf add to following to the bottom of the file:
Code:
if (!isDedicated) then {
[] execvm "custom\snow.sqf";
};

Now copy the fn_temperatur.sqf from your dayz_code.pbo into the custom folder. Edit your compiles.sqf to make it execute "custom\fn_temperatur.sqf".

Add the following to your fn_temperatur.sqf.

After
Code:
        _water_factor          =      -35;
        _rain_factor            =      -8;
        _night_factor          =      -4.5;
        _wind_factor            =      -1;

Add
Code:
        _snow_factor            =      -20;

And after
Code:
        //rain
        if(_raining && !_isinvehicle && !_isinbuilding) then {
                _difference = _difference + (rain * _rain_factor);
        };

Add
Code:
        //snow
        if (!isNil "snow" && !_isinvehicle && !_isinbuilding) then {
                _difference = _difference + _snow_factor;
        };

This way every 15 minutes there is a 25% chance of snow. When it snows the temperature will drop fast. If the player is inside a house of a car, the regular values are used. When outside the snow_factor is used.

Goodluck :).
 
This doesn't send any PVs so the effect is local on each client with a separate chance, thus ending up with players in the same time, having different effect.
 
Back
Top