• 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.

[Solved] Count Destructables in Region

Status
Not open for further replies.
Level 30
Joined
Aug 29, 2012
Messages
1,387
Managed to do it in GUI, seems quite weird but this worked for me :

  • Destructible - Pick every destructible in My Region <gen> and do (Actions)
    • Boucle - Actions
      • Set My_Var = (My_Var + 1)
Of course you have to handle the leak, but that was just so you can see the idea =)

Edit : Ah yes sorry my WE is in French, boucle means loop!
 
I see how it works. I'll give it a shot and call a script to destroy the group. Also related; Do you know how to return a region that a destructible was destroyed in?

You don't need destroy anything. Destructable enumeration doesn't actually involve "group" objects. :)

As for your second question, no. There is no built-in way, because regions may overlap (so a destructable could belong to many regions). If your map is made so that all regions are disjoint, then you can use a hashtable to save the region under the handle ID of the destructable. You can just enumerate through all regions on initialization. Don't forget to map all the destructables you create/respawn through code as well.
 
Status
Not open for further replies.
Top