• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Solved] Count Destructables in Region

Status
Not open for further replies.
Level 20
Joined
Aug 29, 2012
Messages
825
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