• 🏆 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!

[Trigger] How can you get the Percentage of dead Trees?

Status
Not open for further replies.
Here you go:

  • Count Trees
    • Events
      • Player - Player 1 (Red) types a chat message containing count as An exact match
    • Conditions
    • Actions
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Destructible-type of (Picked destructible)) Equal to Summer Tree Wall
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Picked destructible) is alive) Equal to True
                • Then - Actions
                  • Set TreeCount[1] = (TreeCount[1] + 1.00)
                • Else - Actions
                  • Set TreeCount[2] = (TreeCount[2] + 1.00)
            • Else - Actions
      • Set TreeCount[3] = (TreeCount[1] + TreeCount[2])
      • Set TreeCount[4] = (TreeCount[2] / TreeCount[3])
      • Set TreeCount[5] = (TreeCount[3] x TreeCount[4])
      • Set TreeCount[6] = (TreeCount[5] x 0.05)
      • Game - Display to (All players) the text: (String(TreeCount[5]))

  • Regrow
    • Events
      • Player - Player 1 (Red) types a chat message containing regrow as An exact match
    • Conditions
    • Actions
      • For each (Integer A) from 0 to (Integer(TreeCount[6])), do (Actions)
        • Loop - Actions
          • Destructible - Resurrect (Random destructible in (Playable map area) matching (((Destructible-type of (Matching destructible)) Equal to Summer Tree Wall) and (((Matching destructible) is dead) Equal to True))) with (Max life of (Last created destructible)) life and Show birth animation


EDIT: Yeah, I did the loop wrong but the math checks out. Someone else can help you with the loop.
 

Attachments

  • Treecount.w3x
    20.8 KB · Views: 20
Last edited:
Status
Not open for further replies.
Top