HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Script running once ? >_<

07-11-2006, 06:33 AM#1
Daxtreme
If you read my other post, well that is the trigger :P

So I made this quick trigger which consists of Destructables...

Collapse JASS:
function Trig_Barrels_Copy_Actions takes nothing returns nothing
    local destructable d = GetDyingDestructable()
    local location p=GetDestructableLoc(d)
    local integer i=GetRandomInt(1, 8)
    call CreateItemLoc( 'pman', p )
    if i == 1 then
        call CreateItemLoc( 'phea', p )
    else
        if i == 2 then
            call CreateItemLoc( 'pman', p )
        else
        endif
    endif
    call TriggerSleepAction( 20.00 )
    call CreateDestructableLoc( GetDestructableTypeId(d), p, 331.00, 1.00, 0 )
endfunction

//===========================================================================
function InitTrig_Barrels_Copy takes nothing returns nothing
    set gg_trg_Barrels_Copy = CreateTrigger(  )
    call TriggerRegisterDestDeathInRegionEvent( gg_trg_Barrels_Copy, gg_rct_Barrel1 )
    call TriggerRegisterDestDeathInRegionEvent( gg_trg_Barrels_Copy, gg_rct_Barrel2 )
    call TriggerRegisterDestDeathInRegionEvent( gg_trg_Barrels_Copy, gg_rct_Barrel3 )
    call TriggerRegisterDestDeathInRegionEvent( gg_trg_Barrels_Copy, gg_rct_Barrel4 )
    call TriggerRegisterDestDeathInRegionEvent( gg_trg_Barrels_Copy, gg_rct_Barrel5 )
    call TriggerAddAction( gg_trg_Barrels_Copy, function Trig_Barrels_Copy_Actions )
endfunction

What it does is simply create a Mana potion when any barrel in the 5 regions are destroyed. Then if the integer var is equal to 1, create 1 healing potion (additionally to the mana potion) and if the integer is 2 it creates another mana potion.

Then after 20 seconds it recreates the destructable.

The trigger runs perfectly fine! ... Once :D

After it ran once, the barrel respawns, but drops no mana potion. If you kill it, it won't evne respawn again. (and it won't drop a mana potion :P)

Any ideas why it runs only once ?

Thanks
07-11-2006, 09:08 AM#2
Anitarf
http://www.wc3jass.com/viewtopic.php?t=439

http://www.wc3jass.com/viewtopic.php?t=438

The "register dest death in region" actualy loops through all the destructibles in the region and creates a specific destructible event for each of them... well, not each, since it has a built-in limit of 64 destructibles for some reason, but I suppose that could be hacked by changing the bj_MAX_DEST_IN_REGION_EVENTS constant. The point is, newly created destructibles won't have an event added for them. Try ressurecting the dying destructible instead of making a new one.
07-11-2006, 07:12 PM#3
Daxtreme
Yup reviving it worked. Thanks !