• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

An easy smooth fog changing system

Status
Not open for further replies.

Zorrot

Hosted Project: QM
Level 16
Joined
May 16, 2010
Messages
158
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

globals
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
endglobals

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 )
else
set Changeflag = false
endif
endfunction

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
endif

endfunction

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

endlibrary

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.
 
Status
Not open for further replies.
Top