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

Trees stop respawn when in building help

Level 2
Joined
Nov 27, 2017
Messages
7
So, I have a simple trigger that makes the tree respawn when destroyed/chopped down.
  • Events
    • Time - Elapsed game time is 0.01 seconds
  • Conditions
  • Actions
    • Destructible - Pick every destructible in (Playable map area) and do (Actions)
      • Loop - Actions
        • Trigger - Add to Post Trees <gen> the event (Destructible - (Picked destructible) dies)
  • Events
  • Conditions
  • Actions
    • Wait 600.00 seconds
    • Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Show birth animation
The one that I wanna know is how to change/add the trigger where, when any structure is built below the chopped(dead) trees, their respawn rate pauses. Its hard to know how would that work especially that structure tend to change overtime or the difference in size.
 
I don't think that trigger will work if multiple tress are killed within that 600 second wait time, have you tested that? Then in terms of pausing it that becomes a lot trickier. What you might want to do is remove any trees within that buildings collision size and then if that building is killed create corpses within that area where it was killed that then get added to the respawn trigger.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
You could probably Hide the trees, this way they won't collide with the structure but will still resurrect properly. Then once the structure dies, use a pick every destructible search and unhide any nearby trees. I still have to confirm whether this works or not.

Edit: It works.
  • Block Trees
    • Events
      • Unit - A unit Begins construction
    • Conditions
    • Actions
      • Set VariableSet Tree_Point = (Position of (Constructing structure))
      • Destructible - Pick every destructible within 256.00 of Tree_Point 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
              • Destructible - Hide (Picked destructible)
            • Else - Actions
      • Custom script: call RemoveLocation( udg_Tree_Point )
  • Unblock Trees
    • Events
      • Unit - A unit Dies
    • Conditions
      • ((Triggering unit) is A structure) Equal to True
    • Actions
      • Set VariableSet Tree_Point = (Position of (Triggering unit))
      • Destructible - Pick every destructible within 256.00 of Tree_Point 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
              • Destructible - Show (Picked destructible)
            • Else - Actions
      • Custom script: call RemoveLocation( udg_Tree_Point )
Customize this to use your map's own resurrection system:
  • Ressurect Trees
    • Events
      • Player - Player 1 (Red) types a chat message containing r as An exact match
    • Conditions
    • Actions
      • Destructible - Pick every destructible in (Playable map area) and do (Actions)
        • Loop - Actions
          • Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Show birth animation
 

Attachments

  • Tree System 1.w3m
    18.7 KB · Views: 6
Last edited:
Level 13
Joined
Oct 18, 2013
Messages
691
I was thinking that a way to do it would be to import the IsTerrainWalkable lib, as trees immediately growing out of buildings blowing up would be a bit awkward. If you wanted them to start regrowing once no building there though, you'd need to add them to an array to iterate over to see when they could try to continue regrowing. Would need a bit more code but I think that would be a useful system.

edit: @Footman16, WC3's scripting system is such that each time a trigger runs, the GetTriggerUnit() is stored. Afaik, it doesn't do it for some of the Getters, but OP's trigger might be MUI. Iirc I used a similar trigger in the past and I want to say it is.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,543
I was thinking that a way to do it would be to import the IsTerrainWalkable lib, as trees immediately growing out of buildings blowing up would be a bit awkward. If you wanted them to start regrowing once no building there though, you'd need to add them to an array to iterate over to see when they could try to continue regrowing. Would need a bit more code but I think that would be a useful system.

edit: @Footman16, WC3's scripting system is such that each time a trigger runs, the GetTriggerUnit() is stored. Afaik, it doesn't do it for some of the Getters, but OP's trigger might be MUI. Iirc I used a similar trigger in the past and I want to say it is.
(Dying destructible) is probably treated as a local variable just like (Triggering unit) and many other Event Responses.
^ Unfortunately, this doesn't cover everything and is missing this one.

But the concern of trees immediately growing is valid, although in OP's case his respawn is 600.00 seconds later so the odds of this happening are extremely slim. You'd basically need to destroy a tree and have a building die on top of it a second before the 600.00 second mark has passed.

In my triggers, you could add a Wait before unhiding a tree - which could help prevent this from happening. Although, it brings up concern for what would happen when you rapidly build/destroy on the same spot and have stacking effects.
 
Last edited:
Top