HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

This Trigger

08-21-2006, 11:57 AM#1
insane_bubble
How can i make a tree respawn trigger that waits 10 seconds then respawns trees? it must be in GUI because im no Jass expert. ive already tried many things that would seemingly work but they dont..... somewon plz help me!
08-21-2006, 01:52 PM#2
aquilla
I don't think it's possible in gui, the trigger register destructable death region is capped at 64 destructables.

create a trigger called Restore Trees and paste this, it will revive all destructables after 10 secs
Collapse JASS:
function RestoreTrees takes nothing returns nothing
    local destructable d = GetDyingDestructable()
    call TriggerSleepAction(10)
    call DestructableRestoreLife(d, GetDestructableMaxLife(d), true)
    set d = null
endfunction

//===========================================================================
function RestoreTreesAddEvent takes nothing returns nothing
    call TriggerRegisterDeathEvent(gg_trg_Restore_Trees, GetEnumDestructable())
endfunction

function InitTrig_Restore_Trees takes nothing returns nothing
    set gg_trg_Restore_Trees = CreateTrigger()
    call EnumDestructablesInRect(bj_mapInitialPlayableArea, null, function RestoreTreesAddEvent)
    call TriggerAddAction(gg_trg_Restore_Trees, function RestoreTrees)
endfunction
08-21-2006, 02:31 PM#3
zeroXD
The newb with his WE is back... With a perfect working GUI tree regrow trigger!

Trigger:
Tree Regrow
Collapse Events
Destructible - A destructible within (Entire map) dies
Conditions
Collapse Actions
Wait 5.20 seconds
Animation - Change (Dying destructible)'s animation speed to 50.00% of its original speed
Animation - Play (Dying destructible)'s birth animation
Wait 4.80 seconds
Destructible - Resurrect (Dying destructible) with (Max life of (Dying destructible)) life and Hide birth animation
Animation - Change (Dying destructible)'s animation speed to 100.00% of its original speed

And my test map is here too.
08-21-2006, 02:36 PM#4
insane_bubble
aquilla your version is going in my map and you going in my credits! because zeros version is (dying distructible) its not multi instancable (sorry)
08-21-2006, 02:44 PM#5
zeroXD
Quote:
Originally Posted by insane_bubble
aquilla your version is going in my map and you going in my credits! because zeros version is (dying distructible) its not multi instancable (sorry)
It is very multiinstanceable, thats why i have added a test map... If you care to check it it works perfectly.
08-21-2006, 02:55 PM#6
insane_bubble
hmmmmm ok illl test it.... if its multi instancable your going in my map creds.
08-21-2006, 03:06 PM#7
insane_bubble
mmmmm the respawn trigger only respawns 64 destructibles....ah well... its good until i get a better one in
08-21-2006, 03:16 PM#8
zeroXD
Thank you for using my trigger.
08-21-2006, 04:46 PM#9
shadow1500
Collapse JASS:
function RegisterDestDeathInRegionEnum takes nothing returns nothing
    set bj_destInRegionDiesCount = bj_destInRegionDiesCount + 1
    if (bj_destInRegionDiesCount <= bj_MAX_DEST_IN_REGION_EVENTS) then
        call TriggerRegisterDeathEvent(bj_destInRegionDiesTrig, GetEnumDestructable())
    endif
endfunction
function TriggerRegisterDestDeathInRegionEvent takes trigger trig, rect r returns event
    set bj_destInRegionDiesTrig = trig
    set bj_destInRegionDiesCount = 0
    call EnumDestructablesInRect(r, null, function RegisterDestDeathInRegionEnum)
    return trig
endfunction
and
Collapse JASS:
constant integer bj_MAX_DEST_IN_REGION_EVENTS = 64


The GUI trigger will work great if you have 64 trees in your map, otherwise it will only regrow the first 64 trees it encountered. aquilla's trigger fixes this issue.
08-21-2006, 06:53 PM#10
zeroXD
Hmmm. You are right, it dont handle that much trees at once, tested it with 500 trees and destroyed all of them. Thanks for enlightening me.
08-21-2006, 07:07 PM#11
Ignitedstar
There's no way to go beyond the 64 destructable limit?
08-21-2006, 07:29 PM#12
Thunder_Eye
look up*
08-21-2006, 09:52 PM#13
aquilla
you might also be able to do this on map init and use gui-triggers
Trigger:
Custom script: set bj_MAX_DEST_IN_REGION_EVENTS = 10000
problem is I think the event adding each destructable will be triggered before this, haven't tried it though
08-22-2006, 02:25 AM#14
Ignitedstar
Quote:
Originally Posted by Thunder_Eye
look up*


Ah, what I meant was: "Is there no possible way to exceed the 64 destructable limit in GUI?"
08-22-2006, 06:06 PM#15
insane_bubble
the custom script code makes an error when saving.... O.o and i cant get the jass to work!!!!! aquilla please make a map on world editor with the jass on it and attach it to one of your posts.