1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. The Lich King demands your service! We've reached the 19th edition of the Icon Contest. Come along and make some chilling servants for the one true king.
    Dismiss Notice
  4. The 4th SFX Contest has started. Be sure to participate and have a fun factor in it.
    Dismiss Notice
  5. The poll for the 21st Terraining Contest is LIVE. Be sure to check out the entries and vote for one.
    Dismiss Notice
  6. The results are out! Check them out.
    Dismiss Notice
  7. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  8. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  9. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

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

Discussion in 'Triggers & Scripts' started by Mister_Haudrauf, Nov 5, 2019.

  1. Mister_Haudrauf

    Mister_Haudrauf

    Model Reviewer

    Joined:
    Mar 14, 2014
    Messages:
    1,071
    Resources:
    58
    Models:
    53
    Icons:
    2
    Packs:
    3
    Resources:
    58
    Hello friends,

    the title is pretty much the question. I want to create a trigger with which i can detect the Percentage of dead Trees.

    Basically during 6pm 5% of destroyed Trees will regrow.
     
  2. FeelsGoodMan

    FeelsGoodMan

    Joined:
    Dec 13, 2018
    Messages:
    574
    Resources:
    2
    Maps:
    2
    Resources:
    2
    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.
     

    Attached Files:

    Last edited: Nov 5, 2019
  3. Mister_Haudrauf

    Mister_Haudrauf

    Model Reviewer

    Joined:
    Mar 14, 2014
    Messages:
    1,071
    Resources:
    58
    Models:
    53
    Icons:
    2
    Packs:
    3
    Resources:
    58
    Thank you for the answer.
     
  4. FeelsGoodMan

    FeelsGoodMan

    Joined:
    Dec 13, 2018
    Messages:
    574
    Resources:
    2
    Maps:
    2
    Resources:
    2
    No problem, did you get it working?