- Joined
- Feb 13, 2009
- Messages
- 388
JASS:
/ [GUI] Remove Dying Destructible -> crash[/b]
Greetings!
I am trying to remove trees on death (to remove a stump) because I place a "sapling" destructible on their place which turns into a tree on season change.
The problem is: whenever I try to remove "event response - dying destructable", the game crashes when I try to chop the tree.
This is my current code:
This is called on map initialization:
[code=jass] call EnumDestructablesInRectAll( gg_rct_Outdoors, function Trig_RegisterTreeDeath )
The function is:
JASS:
function Trig_RegisterTreeDeath takes nothing returns nothing
call TriggerRegisterDeathEvent( gg_trg_Woodcutting, GetEnumDestructable() )
endfunction
The trigger "gg_trg_Woodcutting" which starts when a tree is cut:
JASS:
function Trig_Woodcutting_Actions takes nothing returns nothing
local location locTreePosition
set locTreePosition = GetDestructableLoc(GetDyingDestructable())
call CreateDestructableLoc( 'B000', GetDestructableLoc(GetDyingDestructable()), 0, 0.2, 0 )
call RemoveDestructable( GetDyingDestructable() )
endfunction
//===========================================================================
function InitTrig_Woodcutting takes nothing returns nothing
set gg_trg_Woodcutting = CreateTrigger( )
call TriggerAddAction( gg_trg_Woodcutting, function Trig_Woodcutting_Actions )
endfunction
The problem is with the string:
JASS:
call RemoveDestructable( GetDyingDestructable() )
I don't get why does it crash.
Last edited: