bastanien
New Member
- Reaction score
- 0
Hello
any idea of how i can make this better/faster/more awesome?
and does it leak ?
any idea of how i can make this better/faster/more awesome?
and does it leak ?
JASS:
function Trig_InitTrig_Move_Conditions takes nothing returns boolean
if ( not ( CountUnitsInGroup(udg_SpellGroup) > 0 ) ) then
return false
endif
return true
endfunction
function PickedUnits takes nothing returns nothing
local real posX
local real posY
local location pos
local location pos2
set udg_UnitValue = GetUnitUserData(GetEnumUnit()) // set custom value of picked unit for MUI
if(udg_Distance[udg_UnitValue] > 0) then // when distance is less than 0 remove projectile
set udg_Distance[udg_UnitValue] = udg_Distance[udg_UnitValue]-4 // distance the projectile travels
set pos = GetUnitLoc(udg_SpellUnit[udg_UnitValue]) // position of spellunit
set pos2 = PolarProjectionBJ(pos,25,udg_TargetAngle[udg_UnitValue]) /// offset spellunit to move it
call SetUnitX(udg_SpellUnit[udg_UnitValue],GetLocationX(pos2)) // move the unit X
call SetUnitY(udg_SpellUnit[udg_UnitValue],GetLocationY(pos2)) // move the unit Y
call RemoveLocation(pos)
call RemoveLocation(pos2)
else
call KillUnit(udg_SpellUnit[udg_UnitValue])
call RemoveUnit(udg_SpellUnit[udg_UnitValue])
endif
endfunction
function Trig_Move_Actions takes nothing returns nothing
call ForGroupBJ( udg_SpellGroup, function PickedUnits )
endfunction
//===========================================================================
function InitTrig_Move takes nothing returns nothing
set gg_trg_Move = CreateTrigger( )
call TriggerRegisterTimerEventPeriodic( gg_trg_Move, 0.035 )
call TriggerAddCondition( gg_trg_Move, Condition( function Trig_InitTrig_Move_Conditions ) )
call TriggerAddAction( gg_trg_Move, function Trig_Move_Actions )
endfunction