hgkjfhfdsj
Active Member
- Reaction score
- 55
JASS:
//globals
// array unit udg_F__U
// array integer udg_F__T
// array real udg_F__D
// array real udg_F__A = 255.
// integer udg_Total
// timer udg_Timer
//endglobals
function fading takes nothing returns nothing
local integer i = 0
local unit get
local integer ticks
local integer alpha
local integer delta
local integer q = udg_Total
loop
exitwhen i == q
set get = udg_F__U<i>
if ticks > 0 then
set udg_F__A<i> = udg_F__A<i> - udg_F__D<i>
set udg_F__T<i> = udg_F__T<i> - 1
call SetUnitVertexColor( get, 100, 100, 100, udg_F__A<i>)
set i = i + 1
else
set q = q - 1
set udg_F__U<i> = udg_F__U[q]
set udg_F__A<i> = udg_F__A[q]
set udg_F__T<i> = udg_F__T[q]
set udg_F__D<i> = udg_F__D[q]
set udg_Total = q
call RemoveUnit(get)
endif
endloop
if q == 0 then
call PauseTimer(udg_Timer)
endif
endfunction
function CreateFadeUnit takes unit u, real x, real y, real duration returns nothing
local integer ticks = R2I(duration/0.03125)
local integer i = udg_Total
set udg_F__U<i> = CreateUnit(Player(15), GetUnitTypeId(u) , x, y, GetUnitFacing(u))
call UnitAddAbility(udg_F__U<i>, 039;Aloc039;)
call SetUnitAnimation(udg_F__U<i>, "attack")
set udg_F__T<i> = ticks
set udg_F__D<i> = I2R(255/ticks)
if i == 0 then
call TimerStart(udg_Timer, 0.03125, false, function fading)
endif
set udg_Total = i + 1
endfunction
//===========================================================================
function InitTrig_Fade takes nothing returns nothing
set udg_Timer = CreateTimer()
endfunction
</i></i></i></i></i></i></i></i></i></i></i></i></i></i></i></i>
problem
i seem to get that error on line set i = i + 1..
am i missing any codes to show?
what the code does
- one timer fade>periodically reduce transparency of a unit