1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  4. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  5. Units have been turned into heroes in our latest Icon Contest! Vote for the best icon set at the Icon Contest #18 Poll!
    Dismiss Notice
  6. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  7. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

An easy smooth fog changing system

Discussion in 'The Lab' started by Zorrot, Jan 1, 2019.

  1. Zorrot


    May 16, 2010
    Hi, haven't come for a long while. recently i was making some project for warcraft reforge, so there are few system i made for myself. But it's always a pleasure to share it anyway.

    library Fogchange initializer Init

    public real Rprim = 100 //Red
    public real Gprim = 100 //Grenn
    public real Bprim = 100 //Blue
    public real Sprim = 0 //Start
    public real Eprim = 4000 //End
    public real Dprim = 5 //Density
    public real Tprim = 5 //Time
    public real R1 = 100 //Red for a tick
    public real G1 = 100 //Grenn for a tick
    public real B1 = 100 //Blue for a tick
    public real S1 = 0 //Start for a tick
    public real E1 = 4000 //End for a tick
    public real D1 = 5 //Density for a tick
    public boolean Changeflag = false //While changing?
    private timer SyncTimer = CreateTimer() //Timer

    function FogchangeActions takes nothing returns nothing
    set Tprim = Tprim - 0.02 //T is changing time
    if(Tprim > 0) then
    set Sprim = Sprim - S1
    set Eprim = Eprim - E1
    set Dprim = Dprim - D1
    set Rprim = Rprim - R1
    set Gprim = Gprim - G1
    set Bprim = Bprim - B1
    //call BJDebugMsg( R2S(Rprim) )
    //call BJDebugMsg( R2S(Tprim) )
    call SetTerrainFogExBJ( 0, Sprim, Eprim, Dprim, Rprim, Gprim, Bprim )
    set Changeflag = false

    function Fogchange takes real S, real E, real D, real R, real G, real B, real T returns nothing
    set S1 = (Sprim - S)/(50*T)
    set E1 = (Eprim - E)/(50*T)
    set D1 = (Dprim - D)/(50*T)
    set R1 = (Rprim - R)/(50*T)
    set G1 = (Gprim - G)/(50*T)
    set B1 = (Bprim - B)/(50*T)
    //Sprim = S1
    //Eprim = E1
    //Dprim = D1
    //Rprim = R1
    //Gprim = G1
    //Bprim = B1
    if(Changeflag == false) then
    set Tprim = T
    call TimerStart(SyncTimer, 0.02, true, function FogchangeActions )
    set Changeflag = true


    private function Init takes nothing returns nothing
    call SetTerrainFogExBJ( 0, Sprim, Eprim, Dprim, Rprim, Gprim, Bprim )


    when use this you could simply write like

    call Fogchange(0, 4000, 5, 80, 20 , 20, 5)

    maybe i will upload an map if it gets guys interest.