• Check out the results of the Techtree Contest #19!
  • 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.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

Tree ressurect

Status
Not open for further replies.
Level 2
Joined
Sep 14, 2007
Messages
15
I have in my map much trees and much skills that can target units//destructibles.

And there i have the problem that i want regrowth the trees when they are destroyed.

But the trigger wont work.

Pls give me an example of the right trigger
 
Create Two Triggers Named :
Regrow Trees Setup.
And
Regrow Trees.

Convert them both to custom text.

Select Regrow Trees Setup and paste this (replace everything):
JASS:
function Setup takes nothing returns nothing
    call TriggerRegisterDeathEvent( gg_trg_Regrow_Trees, GetEnumDestructable() )
endfunction

function Trig_Regrow_Trees_Setup_Actions takes nothing returns nothing
    call EnumDestructablesInRectAll( GetEntireMapRect(), function Setup )
    call DestroyTrigger( GetTriggeringTrigger() )
endfunction

//===========================================================================
function InitTrig_Regrow_Trees_Setup takes nothing returns nothing
    set gg_trg_Regrow_Trees_Setup = CreateTrigger(  )
    call TriggerRegisterTimerEventSingle( gg_trg_Regrow_Trees_Setup, 1.00 )
    call TriggerAddAction( gg_trg_Regrow_Trees_Setup, function Trig_Regrow_Trees_Setup_Actions )
endfunction
Select
Regrow Trees
And paste this into it (replace everything):
JASS:
function Trig_RegrowTrees_Actions takes nothing returns nothing
    local destructable DEADTREE = GetDyingDestructable()
    call TriggerSleepAction( 45.00 )
    call DestructableRestoreLife( DEADTREE, GetDestructableMaxLife(DEADTREE), true )
endfunction

//===========================================================================
function InitTrig_Regrow_Trees takes nothing returns nothing
    set gg_trg_Regrow_Trees = CreateTrigger(  )
    call TriggerAddAction( gg_trg_Regrow_Trees, function Trig_RegrowTrees_Actions )
endfunction

call TriggerSleepAction( 45.00 ) is the amount of time before a tree should be regrow.
 
You don't have to understand this one.
Just do like I said and it will work.
Create one Trigger named
Regrow Trees Setup
and another trigger named :
Regrow Trees

Convert them both to custom text ( Edit -> Convert to custom text).

Paste in these texts the lines I told you above.
Just copy'n paste ;)
 
Status
Not open for further replies.
Back
Top