Moving a rect and destroying destructs/trees

Komaqtion

You can change this now in User CP.
Reaction score
469
Well, do all messages show in all of the functions ?!
If so, then there shouldn't be a problem...
 

shiFt

Member
Reaction score
8
The msg does not show at all, I placed it in the killtrees function, it isnt firing, this is the problem.
 

Magentix

if (OP.statement == false) postCount++;
Reaction score
107
private rect r = Rect(0,200.,0,200.)
0 AoE.

Actually, that's a rect of 200x200...

Try this code:
JASS:
library someLib initializer Init
    private struct DDIC
        real x
        real y
        real r
        real d
    endstruct

    globals
        private DDIC ddic
        boolexpr BE_TRUE
    endglobals

    private function TrueBoolexpr takes nothing returns boolean
        return true
    endfunction

    function IsDestructableInCircle takes destructable d returns boolean
        return ( (Pow(GetDestructableX(d)-ddic.x,2)+Pow(GetDestructableY(d)-ddic.y,2)) <= (ddic.r*ddic.r) )
    endfunction

    function DamageTreesInCircleEnum takes nothing returns nothing
        local destructable d=GetEnumDestructable()
        
        if (GetWidgetLife(d)>.405) and not(IsDestructableInvulnerable(d)) and IsDestructableInCircle(d) then
            call KillDestructable(d)
        endif
            
        set d=null
    endfunction

    function DamageTreesInCircle takes real x, real y, real radius returns nothing
        local rect r=Rect(x - radius,y - radius,x + radius,y + radius)
        
        set ddic.x = x
        set ddic.y = y
        set ddic.r = radius
        call EnumDestructablesInRect(r,BE_TRUE,function DamageDestructablesInCircleEnum)
        
        call RemoveRect(r)
        set r=null
    endfunction

    private function Init takes nothing returns nothing
        set ddic = DDIC.create()
        set BE_TRUE = Condition(function TrueBoolexpr)
    endfunction
endlibrary


Kills all destructables in a circle around some coordinates (unitX and unitY for example)
Do mind that 200 is a rather small radius to test with...

Try setting it to 500 to begin with?
 

Sevion

The DIY Ninja
Reaction score
413
[ljass]Rect(0, 0, 200, 200)[/ljass]

Would be the correct sized rect for 200x200 WCU (WarCraft Units).

You could try setting the radius to something larger as Magnetix said... If the callback isn't running, it's probably because something is bugging beforehand or there are no destructables enumed.
 

shiFt

Member
Reaction score
8
Ive tried a larger radius and nothing iw working, maybe its my trigger i posted?
 

Sevion

The DIY Ninja
Reaction score
413
Just a quick question, why are you setting the unit to a new location, then killing destructibles on the old location?
 

shiFt

Member
Reaction score
8
ive changed it now to the units new location, still, nothing. I was kinda hopeful there sevion
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top