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