Hello.
I need someone who can redo this simple system from vJass to ordinary Jass.
Thank you very much.
Skore_sM
I need someone who can redo this simple system from vJass to ordinary Jass.
JASS:
library FadeOverTime
globals
//The interval that updates the faders
private constant real TIMER_INTERVAL = .05
//Default color codes
private constant integer DEFAULT_RED = 255
private constant integer DEFAULT_GREEN = 255
private constant integer DEFAULT_BLUE = 255
endglobals
struct FoT
unit fader
real trans
real transIncr
real endTrans
real timeLeft
static timer tim = CreateTimer()
static FoT array fots
static integer total
static method update takes nothing returns nothing
local integer i=0
local FoT fot
loop
exitwhen i >= .total
set fot = .fots[.total]
if fot.timeLeft <= .0 then
call fot.destroy()
set .total = .total - 1
set .fots[i] = .fots[.total]
if .total == 0 then
call PauseTimer(.tim)
endif
set i=i-1
else
set fot.timeLeft = fot.timeLeft-TIMER_INTERVAL
set fot.trans = fot.trans+fot.transIncr
call SetUnitVertexColor(fot.fader, DEFAULT_RED, DEFAULT_GREEN, DEFAULT_BLUE, R2I(fot.trans))
endif
set i=i+1
endloop
endmethod
method onDestroy takes nothing returns nothing
call SetUnitVertexColor(.fader, DEFAULT_RED, DEFAULT_GREEN, DEFAULT_BLUE, R2I(.endTrans))
endmethod
static method start takes unit fader, real startTrans, real endTrans, real time returns nothing
set .fots[.total] = FoT.create()
set .fots[.total].fader = fader
set .fots[.total].trans = startTrans
set .fots[.total].endTrans = endTrans
set .fots[.total].transIncr = (endTrans-startTrans)/time/TIMER_INTERVAL
set .fots[.total].timeLeft = time
if .total == 0 then
call TimerStart(.tim, TIMER_INTERVAL, true, function FoT.update)
endif
set .total=.total+1
endmethod
endstruct
function FadeUnitTimed takes unit fader, real startTrans, real endTrans, real time returns nothing
call FoT.start(fader, startTrans, endTrans, time)
endfunction
endlibrary
Thank you very much.
Skore_sM