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

[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: 22
Last edited:
Status
Not open for further replies.
Top