• 💀 Happy Halloween! 💀 It's time to vote for the best terrain! Check out the entries to Hive's HD Terrain Contest #2 - Vampire Folklore.❗️Poll closes on November 14, 2023. 🔗Click here to cast your vote!
  • 🏆 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!
  • 🏆 HD Level Design Contest #1 is OPEN! Contestants must create a maze with at least one entry point, and at least one exit point. The map should be made in HD mode, and should not be openable in SD. Only custom models from Hive's HD model and texture sections are allowed. The only exceptions are DNC models and omnilights. This is mainly a visual and design oriented contest, not technical. The UI and video walkthrough rules are there to give everyone an equal shot at victory by standardizing how viewers see the terrain. 🔗Click here to enter!

[Trigger] Simple spell request

Status
Not open for further replies.
Well in that case I would probably make a trigger like this:

  • TreeHugger
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • -------- Keep all the units with the ability in some sort of group to make this trigger less taxing on computers. --------
      • Unit Group - Pick every unit in (UNITS WITH THE ABILITY) and do (Actions)
        • Loop - Actions
          • -------- Change the 500 to the area of your aura, if you have different ranges depending on level this trigger is going to get a little more complicated, but still doable --------
          • Destructible - Pick every destructible within 500.00 of (Position of (Picked unit)) 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
                  • -------- This is the Summer Tree Wall (dead), or whatever type of tree is in your map --------
                • Then - Actions
                  • Destructible - Resurrect (Picked destructible) with (Max life of (Last created destructible)) life and Show birth animation
                • Else - Actions

Oh and by the way, I am making a Tides of Darkness map to :D
 
Level 16
Joined
Oct 12, 2008
Messages
1,570
Create 1 global unit named 'TreeDummy'.
Put this in your map header:
JASS:
private function TreeFilter takes destructable d returns boolean
    local boolean i = IsDestructableInvulnerable(d)
    local boolean result = false
    call SetUnitPosition(udg_TreeDummy, GetWidgetX(d), GetWidgetY(d))
    if i then
        call SetDestructableInvulnerable(d, false)
    endif
    set result = IssueTargetOrder(udg_TreeDummy, "harvest", d)
    if i then
      call SetDestructableInvulnerable(d, true)
    endif
    call IssueImmediateOrder(udg_TreeDummy, "stop")
    set d = null
    return result
endfunction
And use almost the same function as above:
  • TreeHugger
    • Events
      • Time - Every 0.20 seconds of game time
    • Conditions
    • Actions
      • -------- Keep all the units with the ability in some sort of group to make this trigger less taxing on computers. --------
      • Unit Group - Pick every unit in (UNITS WITH THE ABILITY) and do (Actions)
        • Loop - Actions
          • -------- Change the 500 to the area of your aura, if you have different ranges depending on level this trigger is going to get a little more complicated, but still doable --------
          • Destructible - Pick every destructible within 500.00 of (Position of (Picked unit)) and do (Actions)
            • Loop - Actions
              • Custom script: if TreeFilter(GetEnumDestructable()) then
              • Destructible - Resurrect (Picked destructible) with (Max life of (Last created destructible)) life and Show birth animation
              • Custom script: endif
That Jass part checks if it is a tree, if not it can also be a crate, or something else. This will filter out trees, so only Trees get revived.
 
If you're curious this is what I ended up using, no custom script required.

Code:
TreeHugger
    Events
        Time - Every 0.20 seconds of game time
    Conditions
    Actions
        Unit Group - Pick every unit in (Units of type Spell Breaker) and do (Actions)
            Loop - Actions
                Destructible - Pick every destructible within 500.00 of (Position of (Picked unit)) and do (Actions)
                    Loop - Actions
                        If ((Destructible-type of (Picked destructible)) Equal to Ashenvale Tree Wall) then do (Destructible - Resurrect (Picked destructible) with (Max life of (Picked destructible)) life and Show birth animation) else do (Do nothing)
 
Status
Not open for further replies.
Top