- Joined
- Dec 6, 2016
- Messages
- 5
I was trying to create a Ravage spell version and for some reason the loop isn't working well. Using 1.30v
All in this function works very well except for the first loop , who for some reason is working very very very glitchy even when I can't see any problem with it, pls someone help.
JASS:
function RavageLoop takes nothing returns nothing
local timer t = GetExpiredTimer()
local integer i = GetHandleId(t) - 1048576
local integer r = 0
local unit u = udg_RavageCaster[i]
local real x = udg_RavageX[i]
local real y = udg_RavageY[i]
local unit u2
local unit u3
local real ux
local real uy
local real d
local real arc
local real dy
local real dx
local player p = GetOwningPlayer(u)
local group g = CreateGroup()
if udg_RavageTime[i] < 1.00 then
set udg_RavageTime[i] = udg_RavageTime[i] + 0.2
set d = udg_RavageRange[i]
set udg_RavageRange[i] = udg_RavageRange[i] + 212.5
call GroupEnumUnitsInRange( g, x, y, udg_RavageRange[i], null)
loop
set u2 = FirstOfGroup(g)
exitwhen u2 == null
call GroupRemoveUnit(g, u2)
if ( IsUnitType(u2, UNIT_TYPE_STRUCTURE) != true ) and IsUnitAliveBJ(u2) and IsUnitEnemy(u2, p) and (IsUnitInGroup(u2, udg_AirKnokbackUnits) != true) then
set ux = GetUnitX(u2)
set uy = GetUnitY(u2)
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Undead\\Impale\\ImpaleHitTarget.mdl", ux, uy ))
call UnitDamageTarget( u, u2, udg_RavageDamage[i], true, true, ATTACK_TYPE_CHAOS, DAMAGE_TYPE_NORMAL, null )
call UnitAddAbility( u2, 'Amrf' )
call GroupAddUnit( udg_AirKnokbackUnits, u2 )
call AirKnockBackStart( u2, 400, 1.00)
call SetUnitPathing( u2, false )
call UnitRemoveAbility( u2 , 'Amrf' )
set u3 = CreateUnit( p, 'u001', ux, uy, 0)
call UnitAddAbility( u3, 'A001')
call IssueTargetOrder( u3, "firebolt", u2)
call UnitApplyTimedLife( u3, 'BTLF', 1.00 )
endif
endloop
//call EnumRavageUnits( u, udg_RavageDamage[i], udg_RavageX[i], udg_RavageY[i], udg_RavageRange[i])
loop
set r = r + 1
exitwhen r == 19
set arc = Deg2Rad(20*r)
set dy = udg_RavageY[i] + udg_RavageRange[i]*Sin(arc)
set dx = udg_RavageX[i] + udg_RavageRange[i]*Cos(arc)
call DestroyEffect( AddSpecialEffect( "Abilities\\Spells\\Undead\\Impale\\ImpaleMissTarget.mdl", dx, dy ))
endloop
else
call PauseTimer(t)
call DestroyTimer(t)
endif
set u = null
set t = null
call DestroyGroup(g)
set p = null
set g = null
endfunction
All in this function works very well except for the first loop , who for some reason is working very very very glitchy even when I can't see any problem with it, pls someone help.
Attachments
Last edited: