• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Can anyone tell what's the problem with the code destroying destructables?

Status
Not open for further replies.
Level 10
Joined
May 24, 2016
Messages
339
Hello, Im having a problem of trying to kill the destructables

Im out of my pc right now, but I can reproduce the way its coded.
JASS:
function SteamTankKillDestructable takes nothing returns nothing
call KillDestructable(GetEnumDestructable())
endfunction


// a timer every 0.1 second
call GroupClear(P) // SteamTanks destructable
set bj_groupAddGroupDest = P
call ForGroup(SteamTanksGroup,function GroupAddGroupEnumJ)
 // set g = CopyGroup(Paladins)
 loop
 set f = FirstOfGroup(P)
 exitwhen f == null
 set X= GetUnitX(f)
 set Y = GetUnitY(f)
 call echo(GetUnitName(f))
 set rct = Rect(X - 200, Y- 200, X+ 200, Y+ 200)
 // call echo("destroy")
 call EnumDestructablesInRect(rct, filterEnumDestructablesInCircleBJ, function SteamTankKillDestructable)
 call RemoveRect(rct)
 
 call GroupRemoveUnit(P, f)
 endloop

I already used debug and found out time that unit cycle works pretty fine so as the timer itself.
 
Status
Not open for further replies.
Top