- Reaction score
- 534
Well I've made a short script looking like that :
What it does is create a mana potion at the dying barrel's position, then if the random integer between 1 and 8 is 1, it creates another potion (but healing one) and if the integer is 2 it creates another mana potion. If it is from 3 to 8 nothing happens.
The trigger runs perfectly ! ... Once
As soon as the barrel is created again (after 20 seconds) it bugs. First the barrel doesn't even drop a mana potion (it is obliged to!) and then never revives again.
I can't seem to understand why
Any ideas ?
Code:
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 create a mana potion at the dying barrel's position, then if the random integer between 1 and 8 is 1, it creates another potion (but healing one) and if the integer is 2 it creates another mana potion. If it is from 3 to 8 nothing happens.
The trigger runs perfectly ! ... Once
As soon as the barrel is created again (after 20 seconds) it bugs. First the barrel doesn't even drop a mana potion (it is obliged to!) and then never revives again.
I can't seem to understand why
Any ideas ?