- Joined
- Aug 26, 2016
- Messages
- 139
I can’t figure out what needs to be added to remove the bullet when colliding with a destructible object.
JASS:
local bullet A = LoadInteger( H, GetHandleId( GetExpiredTimer( ) ), 0 )
local unit u
set A.x = A.x + A.s * A.v.x * Cos( A.v.z )
set A.y = A.y + A.s * A.v.y * Cos( A.v.z )
set A.z = A.z + A.s * A.v.z
set A.d = A.d - A.s
call SetUnitX( A.dummy, A.x )
call SetUnitY( A.dummy, A.y )
call SetUnitFlyHeight( A.dummy, A.z - GetLocZPS( A.x, A.y ), 0.00 )
call GroupEnumUnitsInRange( TempGroup, A.x, A.y, A.r, null )
loop
set u = FirstOfGroup( TempGroup )
exitwhen u == null
call GroupRemoveUnit( TempGroup, u )
if UnitAlive( u ) and IsUnitEnemy( u, A.p ) and RAbsBJ( GetUnitFlyHeight( u ) - GetUnitFlyHeight( A.dummy ) ) <= 100.00 then
call UnitDamageTarget( A.caster, u, 60.00, false, false, null, null, null )
endif
endloop
if A.d <= 0.00 or A.z - GetLocZPS( A.x, A.y ) <= 20.00 then
call FlushChildHashtable( H, GetHandleId( GetExpiredTimer( ) ) )
call PauseTimer( GetExpiredTimer( ) )
call DestroyTimer( GetExpiredTimer( ) )
call KillUnit(A.dummy)
call RemoveUnit( A.dummy )
set A.dummy = null
set A.caster = null
call A.v.destroy( )
call A.destroy( )
endif