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
 
Level 19
Joined
Nov 16, 2006
Messages
2,165
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.
 
Level 19
Joined
Nov 16, 2006
Messages
2,165
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.
Top