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

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,166
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,166
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