[Tutorial] Snow added to Dynamic Weather

Discussion in 'Tutorials' started by Vampire, Nov 19, 2013.

  1. Vampire

    Vampire OpenDayZ Rockstar!

    Joined:
    Oct 22, 2013
    Messages:
    923
    Likes Received:
    136
    So I was wondering how to add snow to the dynamic weather like everyone else, and then realised that snow was dynamic on Namalsk. So I looked at how it was done, and seen that Namalsk uses a custom dynamic weather script with snow as a logic function. Thought I was crazy for trying but I managed to get it working on my Epoch server.

    [​IMG]
    All credits go to Sumrak (http://www.nightstalkers.cz/) for putting so much work into Namalsk.​
    All this code is his, I simply figured out how to port it from Namalsk to any map.​
    First create a folder in your mission.pbo called Weather, and put these two scripts in there:​
    Hit "RAW" next to download, to copy and paste.​
    First script: DynamicWeatherEffects.sqf​
    (You can modify the settings at the top, but it only snows if it's over .75 overcast)​

    Hit "RAW" next to download, to copy and paste.
    Second script: fn_dzn_snowfall.sqf
    (This script even takes into account if you are inside a building, so it doesn't snow inside)
    http://pastebin.com/nmmFrJyZ

    Then you need to open up your init.sqf (on Epoch) or custom compiles and point the dynamic weather location to your script instead.
    Like so:
    Code:
            //Start Dynamic Weather
        execVM "Weather\DynamicWeatherEffects.sqf";
    When the script wants it to snow, it calls the snow function, which runs the script. We need to add the snow function.

    Open your Description.ext
    Under the class RscPicture block of code, add this.
    Code:
    class CfgFunctions {
        class DZN {
            class Functions {
                class snowfall {
                    description = "Simple snowfall script";
                    file = "Weather\fn_dzn_snowfall.sqf";
                };
            };
        };
    };
    In the DynamicWeather I have Debug turned on. Turn it off if you don't want it logging the current weather to your .RPT.

    Enjoy everyone!
     
    Fox, SteveJ and SchwEde like this.
  2. Vampire

    Vampire OpenDayZ Rockstar!

    Joined:
    Oct 22, 2013
    Messages:
    923
    Likes Received:
    136
    If someone could modify the fn_dzn_snowfall.sqf to use the snow from the other snow script everyone is using, that would be great.

    The Namalsk snow is nice, but it's not dense enough for my liking.
     
  3. Andrew_S90

    Andrew_S90 Valued Member! Staff Member

    Joined:
    Jan 18, 2013
    Messages:
    292
    Likes Received:
    41
    Very cool! I like the snow idea, the idea of a winter chernarus would be awesome :p
     
  4. Vampire

    Vampire OpenDayZ Rockstar!

    Joined:
    Oct 22, 2013
    Messages:
    923
    Likes Received:
    136
    There is a classname for snow, but to cover your entire map in it would be too much. Maybe some code to spawn patches of it accross the map?
     
  5. Stuff and Junk

    Stuff and Junk Well-Known Member

    Joined:
    Nov 4, 2013
    Messages:
    266
    Likes Received:
    21
    Glad to see someone else figured this out. I just added the snow to my fixes folder and changed the line to call it. Didnt have to mess with anything else :/
     
  6. Stuff and Junk

    Stuff and Junk Well-Known Member

    Joined:
    Nov 4, 2013
    Messages:
    266
    Likes Received:
    21
    Also i dont know if u have this in your scripts but you can make the cold affect players temps and also put in warm clothing like we did.
     
  7. Hertizch

    Hertizch Well-Known Member

    Joined:
    Jun 22, 2013
    Messages:
    143
    Likes Received:
    13
    Great!
    Would be fun to get the groundfog to work dynamically as well, like when overcast is over 0.5 for example.
     
  8. Vampire

    Vampire OpenDayZ Rockstar!

    Joined:
    Oct 22, 2013
    Messages:
    923
    Likes Received:
    136
    You cant add new skins to a mod unless you make a new mod.
    You can adjust the tempurature by adjusting fn_temperatur.sqf
     
  9. Stuff and Junk

    Stuff and Junk Well-Known Member

    Joined:
    Nov 4, 2013
    Messages:
    266
    Likes Received:
    21
    i didnt add skins i defined existing ones as warm clothing.
     
  10. Vampire

    Vampire OpenDayZ Rockstar!

    Joined:
    Oct 22, 2013
    Messages:
    923
    Likes Received:
    136
    Oh I see.

    You would probably just code into fn_tempuratur.sqf that if the player model matches those in an array then the overall temperature is higher
     
  11. graeme bourne

    graeme bourne Member

    Joined:
    Jan 14, 2013
    Messages:
    96
    Likes Received:
    9
    Some info on that would be awesome, if your willing to share

    Thnx in advance
    Bags
     
  12. Hertizch

    Hertizch Well-Known Member

    Joined:
    Jun 22, 2013
    Messages:
    143
    Likes Received:
    13
    You need some new variables, for example:

    Factors:
    _warm_clothes = 10;

    And for posistive effects:
    if (((typeOf player) == "Sniper1_DZ")) then {
    _difference= _difference + _warm_clothes;
    };

    I guess that will work :)
     
    graeme bourne likes this.
  13. SteveJ

    SteveJ New Member

    Joined:
    Feb 5, 2013
    Messages:
    29
    Likes Received:
    1
    I think it's buggy. Wind is too hard o_O

     
  14. Hertizch

    Hertizch Well-Known Member

    Joined:
    Jun 22, 2013
    Messages:
    143
    Likes Received:
    13
    Hahaha! The storm is coming!
    You obviously messed up somewhere :p
     
  15. SteveJ

    SteveJ New Member

    Joined:
    Feb 5, 2013
    Messages:
    29
    Likes Received:
    1
    IDK, but I did everything as in the tutorial. The only thing I have added a script to clean weather at certain times of day. Like this in DynamicWeatherEffects.sqf

    Code:
    if(daytime<6||daytime>19)then {
            _currentOvercast = 0;
            _currentFog = 0;
            _currentRain = 0;
            _currentWeatherChange = _this select 3;
            _targetWeatherValue = _this select 4;
            _timeUntilCompletion = _this select 5;
            _currentWindX = _this select 6;
            _currentWindZ = _this select 7;
        }
        else {
        _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;
        };
     
  16. SteveJ

    SteveJ New Member

    Joined:
    Feb 5, 2013
    Messages:
    29
    Likes Received:
    1
    And there is error in RPT:
    "0:0 Debug: Starting script WeatherEffects.sqf..."

    Code:
    16:12:27 Error in expression <ndZ, true];
     
     
    if (_currentWeatherChange == "OVERCAST") then {
    _timeUntilCompleti>
    16:12:27  Error position: <== "OVERCAST") then {
    _timeUntilCompleti>
    16:12:27  Error Generic error in expression
    16:12:27 File mpmissions\dayz_1.Chernarus\Fixes\compile\DynamicWeatherEffects.sqf, line 191
     
  17. Hertizch

    Hertizch Well-Known Member

    Joined:
    Jun 22, 2013
    Messages:
    143
    Likes Received:
    13
    Yeah, have to be something with your own edits because for me it's working like it should, without hurricanes!
     
  18. DangerRuss

    DangerRuss OpenDayZ Rockstar!

    Joined:
    Jul 10, 2013
    Messages:
    1,258
    Likes Received:
    69
    Would there be away to make it so it only snows, never rains?
     
  19. Hertizch

    Hertizch Well-Known Member

    Joined:
    Jun 22, 2013
    Messages:
    143
    Likes Received:
    13
    Just set rain min and max to 0
     
  20. Vampire

    Vampire OpenDayZ Rockstar!

    Joined:
    Oct 22, 2013
    Messages:
    923
    Likes Received:
    136
    Don't change the amount, just change snow chance to 100% and rain to 0.
    These lines:
    Code:
    _rainIntervalRainProbability = 50;
    _snowIntervalSnowProbability = 50;
     

Share This Page