• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Revive Trees

Level 1
Joined
Dec 6, 2006
Messages
72
This is a script I made that will revive trees that die for some reason. Whether it be a peasant picking at it or a spell that destroys trees like flame strike.

JASS:
function RegrowTrees takes nothing returns nothing
    local destructable tree=GetDyingDestructable()
    call TriggerSleepAction(10)
    call DestructableRestoreLife( tree, GetDestructableMaxLife(tree), true )
    set tree=null
endfunction

function Trig_Int_Tree_Revival takes nothing returns nothing
    local integer d=GetDestructableTypeId(GetEnumDestructable())
    if d=='ATtr' or d=='BTtw' or d=='KTtw' or d=='YTft' or d=='YTct' or d=='YTwt' or d=='JTwt' or d=='DTsh' or d=='FTtw' or d=='CTtr' or d=='ITtw' or d=='NTtw' or d=='OTtw' or d=='ZTtw' or d=='WTst' or d=='LTlt' or d=='GTsh' or d=='Xtlt' or d=='WTtw' or d=='ATtc' or d=='BTtc' or d=='CTtc' or d=='ITtc' or d=='ZTtc' then
    call TriggerRegisterDeathEvent( gg_trg_Regrow_Trees, GetEnumDestructable() )
    call TriggerAddAction(gg_trg_Regrow_Trees,function RegrowTrees)
endif
endfunction

function Int_Tree_Revive takes nothing returns nothing
    call EnumDestructablesInRect(GetPlayableMapRect(), null, function Trig_Int_Tree_Revival)
endfunction

___________

I will add a test map later
 
Last edited:
Top