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

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