• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Help with Tree Respawn (Not getting it)

Status
Not open for further replies.
Level 1
Joined
Oct 8, 2010
Messages
4
I've looked all over this forum and haven't found one tree respawn trigger set that works successfully. I've created my own and it still doesn't work.

Does anyone know how to create a trigger that allows you to regrow trees on a map, but after a tree is chopped down... and a structure is built near a tree.. Trees within 300 aoe of that structure do not regrow.

If the Structure is destroyed the trees previously chopped down will regrow.
 
Level 5
Joined
Jan 4, 2007
Messages
103
This?:

First Trigger, make a region that contains less than 64 trees and do:
  • Events
    • Destructible - A destructible within Your Region <gen> dies
  • Conditions
    • Or - Any (Conditions) are true
      • Conditions
        • (Destructible-type of (Dying destructible)) Equal to Summer Tree Wall
        • (Destructible-type of (Dying destructible)) Equal to Fall Tree Wall
        • Or any of your Type Tree
  • Actions
    • Set TreeNumber = (TreeNumber + 1)
    • Countdown Timer - Start TreeTimer[TreeNumber] as a One-shot timer that will expire in 90.00 seconds
    • Set DestPoint[TreeNumber] = (Position of (Dying destructible))
    • Set DestUnit[TreeNumber] = (Dying destructible)
    • Trigger - Add to (Trigger 2) the event (Time - TreeTimer[TreeNumber] expires)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • TreeNumber Greater than or equal to 64
      • Then - Actions
        • Set TreeNumber = 0
      • Else - Actions
        • Do nothing
The TreeNumber is an Integer variable. The DestPoint is a Point variable. The DestUnit is a destructible variable. The TreeTimer is a Timer variable.

Then the second trigger:

  • Events
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 64, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Remaining time for TreeTimer[Integer A]) Equal to 0.00
          • Then - Actions
            • Set DestGroup[Integer A] = (Units in (Region centered at DestPoint[Integer A] with size (600.00, 600.00)) matching (((Matching unit) is A structure) Equal to True))
            • Unit Group - Pick every unit in DestGroup[Integer A] and do (Actions)
              • Loop - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Number of units in DestGroup[Integer A) Equal to 0
                  • Then - Actions
                    • Destructible - Resurrect (DestUnit[Integer A]) with (Max life of (DestUnit[Integer A])) life and Hide birth animation
                  • Else - Actions
                    • Trigger - Add to (Trigger 3) the event (Unit - (Picked unit) Dies)
            • Custom script: call DestroyGroup (udg_DestGroup[bj_forLoopAIndex])
          • Else - Actions
            • Do nothing
Then the third Trigger:

  • Events
  • Conditions
  • Actions
    • For each (Integer A) from 1 to 64, do (Actions)
      • Loop - Actions
        • Unit Group - Pick every unit in DestGroup[Integer A] and do (Actions)
          • Loop - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Number of units in DestGroup[Integer A]) Equal to 0
              • Then - Actions
                • Destructible - Pick every destructible in (Region centered at DestPoint[Integer A] with size (600.00, 600.00)) and do (Actions)
                  • Loop - Actions
                    • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Hide birth animation
                • Custom script: call RemoveLocation (udg_DestPoint[bj_forLoopAIndex])
              • Else - Actions
                • Do nothing
Hope it helps:)
 
Level 1
Joined
Oct 8, 2010
Messages
4
Mine>Set TreeNumber = TreeNumber
Yours>Set TreeNumber = (TreeNumber + 1)
Mine>Trigger - Add to Trigger 2 <gen> the event (Time - TreeTimer expires)
Yours> Trigger - Add to (Trigger 2) the event (Time - TreeTimer[TreeNumber] expires)
Mine>Set DestPoint = (Position of (Dying destructible))
Yours>Set DestPoint[TreeNumber] = (Position of (Dying destructible))

This one is a Then Action from the top of Line 2, I don't even know how you got that. Please help?
Set DestGroup[Integer A] = (Units in (Region centered at DestPoint[Integer A] with size (600.00, 600.00)) matching (((Matching unit) is A structure) Equal to True))
 
Level 5
Joined
Jan 4, 2007
Messages
103
For the first, you have to put an artimetric instead of TreeNumber, then in the first put TreeNumber and in the second put 1. For the second, you have to put an array of 64 on your variables. Do it in the same place where you made the variables. Just edit them and put an array of 64. Then when you edit the triggers you wrote above, just add TreeNumber in the array. For Integer A, just scroll down and put For Loop Integer A. Hope it helps:)
 
Status
Not open for further replies.
Top