• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a faction for Warcraft 3 and enter Hive's 19th Techtree Contest: Co-Op Commanders! Click here to enter!
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 21st Texturing Contest: Upgrade is now concluded, time to vote for your favourite set of icons! Click here to vote!

An easy smooth fog changing system

Status
Not open for further replies.

Zorrot

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