detect destructables in region

Nina

New Member
Reaction score
8
Let's say I have a point p, I move a region r with region - center r on p. How can I detect if the region has destructables in it? It is for a trigger which creates a structure at p when there are no items/units/destructables near that location I got the units and I also know a workarround for items but those wouldn't work for destructables. So does anyone know how to detect if there are destructables in a region?
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
this should work. if there are any destructibles in My Rect the variable TempInteger (integer variable of course) will be set to 1.

Code:
    Actions
        ...(yourActions)
        Destructible - Pick every destructible in My Rect <gen> and do (Actions)
            Loop - Actions
                Set TempInteger = 1
        If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            If - Conditions
                TempInteger Not equal to 0
            Then - Actions
                 ...(YourActions)
            Else - Actions
 

Nina

New Member
Reaction score
8
I think tempinteger will be set to 1 even if it didn't pick any and thus it will always be not equal to 0.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
it will only be set to 1 if there is at least 1 destructible in the region. check it out it works fine.
 

Nina

New Member
Reaction score
8
I just tested it and even if there are no destructibles in the region it does the action:S
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
thats impossible. i have tested it too and it did work. the action runs a number of times equal to the number of destructibles in the region. no destructibles = no actions...
 

Nina

New Member
Reaction score
8
It seems you were right, it wouldn't work because I did something wrong with p so the region wouldn't move and it always was near destructables. Thanks for helping.
 
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