Page 1 of 3 123 LastLast
Results 1 to 10 of 26

Thread: Rain/Snow

  1. #1

    Default Rain/Snow

    I'm trying to figure out how to add snow fall to my map, but all my searches are turning up nothing. I've looked in to the MOh stock maps and was only able find they used the rain texture and func_rain. I played around with them two things but still can't get it too work for me..any suggestions?

  2. #2

    Default

    Can you copy-paste here your code? Chrissstrahl used this to make snow work properly in m6 levels of coop, these can be found also in SDK Documentation:


    level.rain_speed = "32"
    level.rain_speed_vary = "16"
    //level.rain_length = "2" //chrissstrahl
    level.rain_length = "1" //chrissstrahl
    level.rain_width = "1"
    //level.rain_density = ".2" //chrissstrahl
    level.rain_density = ".5" //chrissstrahl
    level.rain_slant = "250"//chrissstrahl
    level.rain_min_dist = "1800"//chrissstrahl
    level.rain_numshaders = 12
    //level.rain_shader = "textures/snow0" //chrissstrahl
    level.rain_shader = "textures/snow" //chrissstrahl - this way it works in BT
    Last edited by Criminal; February 13th, 2019 at 01:57 PM.
    Github - Steam - .Crimewavez#5285

  3. #3

    Default

    Yep, you need func_rain brushes where you want the snow to fall.

    m6l1a (snowy forest) uses:


    level.rain_speed = "32"
    level.rain_speed_vary = "16"
    level.rain_length = "2"
    level.rain_width = "1"
    level.rain_density = ".2"
    level.rain_slant = "250"
    level.rain_min_dist = "1800"
    level.rain_numshaders = 12
    level.rain_shader = "textures/snow0"


    So not much different to what Criminal posted. Setting it to snow0 and having numshaders as 12 means it randomly selects between 12 snowflake textures in the textures/weather folder.

    Engine code is:

    r = rand();
    if ( cg.rain.numshaders ) {
    shadername = &cg.rain.shader[r % cg.rain.numshaders][0];
    } else {
    shadername = &cg.rain.shader[0][0];
    }
    Last edited by 1337Smithy; February 13th, 2019 at 02:25 PM.

  4. #4

    Default

    I haven’t been using any script at the moment. One of my friends mentioned something about a map .scr file but I don’t know what I would need to change in it to make weather. Would it be the lines you listed above? If so where would I put them. Would I also have to do anything In radiant still? Sorry for all these questions I’m just really lost here.

  5. #5

    Default

    After level waittil spawn, e.g:


    level waittill spawn

    level.rain_speed = "32"
    level.rain_speed_vary = "16"
    level.rain_length = "2"
    level.rain_width = "1"
    level.rain_density = ".2"
    level.rain_slant = "250"
    level.rain_min_dist = "1800"
    level.rain_numshaders = 12
    level.rain_shader = "textures/snow0"


    You just need to make sure some func_rain brushes are placed in your level where you want the snow to fall, and then add those level.rain lines somewhere after level waittill spawn in your map.scr.
    Last edited by 1337Smithy; February 13th, 2019 at 02:33 PM.

  6. #6

    Default

    For example, here is the script for mohdm1 with it added:


    // SOUTHERN FRANCE
    // ARCHITECTURE: SENN
    // SCRIPTING: POWZER

    main:

    // set scoreboard messages
    setcvar "g_obj_alliedtext1" "Southern France"
    setcvar "g_obj_alliedtext2" ""
    setcvar "g_obj_alliedtext3" ""
    setcvar "g_obj_axistext1" ""
    setcvar "g_obj_axistext2" ""
    setcvar "g_obj_axistext3" ""

    setcvar "g_scoreboardpic" "mohdm1"

    // call additional stuff for playing this map round based is needed
    if(level.roundbased)
    thread roundbasedthread

    level waitTill prespawn

    //*** Precache Dm Stuff
    exec global/DMprecache.scr

    level.script = maps/dm/mohdm1.scr
    exec global/ambient.scr mohdm1

    //exec global/ambient.scr mohdm2

    //$world farplane 5000
    //$world farplane_color (.333 .333 .329)

    level waittill spawn

    level.rain_speed = "32"
    level.rain_speed_vary = "16"
    level.rain_length = "2"
    level.rain_width = "1"
    level.rain_density = ".2"
    level.rain_slant = "250"
    level.rain_min_dist = "1800"
    level.rain_numshaders = 12
    level.rain_shader = "textures/snow0"

    end

    //-----------------------------------------------------------------------------

    roundbasedthread:

    // Can specify different scoreboard messages for round based games here.

    level waitTill prespawn

    level waittill spawn

    // set the parameters for this round based match
    level.dmrespawning = 0 // 1 or 0
    level.dmroundlimit = 5 // round time limit in minutes
    level.clockside = kills // set to axis, allies, kills, or draw

    level waittill roundstart

    end


    But obviously your map script would be your_map_name.scr

    By all means play around with some of the numbers to change the snow slant, speed, density etc...
    Last edited by 1337Smithy; February 13th, 2019 at 02:49 PM.

  7. #7
    Developer Todesengel's Avatar
    Join Date
    Dec 2013
    Location
    St. Louis, Missouri, USA
    Posts
    276

    Default

    There is an 'advanced weather' mod in the mohaa database. I haven't used it yet, but just started skimming through it a few weeks ago with an idea to incorporate into my base system for all maps. It does not seem to integrate snow.... so I suspect this can be merged into it. Thanks!

  8. #8

    Default

    There's also a "Snow Mod" made by the same person, which may be of use to you as well .

  9. #9

    Default

    Guys, it looks like he is new to the ground and we should avoid charging him with partial scripting codes

    Quote Originally Posted by <T|F|B>The Beaver View Post
    I haven’t been using any script at the moment. One of my friends mentioned something about a map .scr file but I don’t know what I would need to change in it to make weather. Would it be the lines you listed above? If so where would I put them. Would I also have to do anything In radiant still? Sorry for all these questions I’m just really lost here.
    You have to create a file having the same name as your map, ending with the .scr extension (i.e: "mohdm5.scr"), then copy the code below and paste it inside your newly created file :


    main:
    // set scoreboard messages
    setcvar "g_obj_alliedtext1" "Map name"
    setcvar "g_obj_alliedtext2" ""
    setcvar "g_obj_alliedtext3" ""
    setcvar "g_obj_axistext1" ""
    setcvar "g_obj_axistext2" ""
    setcvar "g_obj_axistext3" ""

    // call additional stuff for playing this map round based is needed
    if(level.roundbased)
    thread roundbasedthread

    level waitTill prespawn

    //*** Precache Dm Stuff
    exec global/DMprecache.scr

    level waittill spawn

    // Rain setup
    level.rain_speed = "32"
    level.rain_speed_vary = "16"
    level.rain_length = "2"
    level.rain_width = "1"
    level.rain_density = ".2"
    level.rain_slant = "250"
    level.rain_min_dist = "1800"
    level.rain_numshaders = 12
    level.rain_shader = "textures/snow0"
    end

    roundbasedthread:

    // Can specify different scoreboard messages for round based games here.

    level waitTill prespawn

    level waittill spawn

    // set the parameters for this round based match
    level.dmrespawning = 0 // 1 or 0
    level.dmroundlimit = 5 // round time limit in minutes
    level.clockside = kills // set to axis, allies, kills, or draw

    level waittill roundstart
    end


    The rain code is self-explanatory. For tutorials about scripting, I don't have any links in hand but others could give one or more to you

  10. #10

    Default

    Isn't that almost exactly what I posted, Ley0k? lol Another thing worth adding is that your .scr should be in the same place as your map/bsp.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •