| 12-28-2006, 11:04 PM | #1 |
Hi, I want to make a trigger that when a dustructable dies an item is droped at its location, the idea is when a tree is chopped it creates wood (the item) in the floor, for some reason its not working: JASS:function Trig_Tree_Dies_Actions takes nothing returns nothing local location l = GetDestructableLoc(GetDyingDestructable()) call CreateItemLoc('I000', l) call RemoveLocation(l) set l = null endfunction //=========================================================================== function InitTrig_Tree_Dies takes nothing returns nothing set gg_trg_Tree_Dies = CreateTrigger() call TriggerRegisterDestDeathInRegionEvent(gg_trg_Tree_Dies, GetEntireMapRect()) call TriggerAddAction(gg_trg_Tree_Dies, function Trig_Tree_Dies_Actions) endfunction I know i could do this by selecting all the trees in the map and make them drop an item, but that makes the script file weight 8mb and thats crazy it should be posible to make it easier. Thanks |
| 12-28-2006, 11:10 PM | #2 |
You'll need a few triggers. Here: Trigger: Trigger: Hope this helps, GUI FTW. |
| 12-28-2006, 11:30 PM | #3 |
Ok done, one more question, i never worked with destrucable groups so i would like to know if any of this trigger leaks and how to fix them: JASS:function Trig_Pick_Trees_Group takes nothing returns nothing if (GetDestructableTypeId(GetEnumDestructable()) == 'WTst') then call TriggerRegisterDeathEvent(gg_trg_Tree_Dies, GetEnumDestructable()) endif endfunction function Trig_Pick_Trees_Actions takes nothing returns nothing call EnumDestructablesInRectAll(GetPlayableMapRect(), function Trig_Pick_Trees_Group) endfunction //=========================================================================== function InitTrig_Pick_Trees takes nothing returns nothing set gg_trg_Pick_Trees = CreateTrigger() call TriggerAddAction(gg_trg_Pick_Trees, function Trig_Pick_Trees_Actions) endfunction JASS:function Trig_Tree_Dies_Actions takes nothing returns nothing local location l = GetDestructableLoc(GetDyingDestructable()) call CreateItemLoc('I000', l) call RemoveLocation(l) set l = null endfunction //=========================================================================== function InitTrig_Tree_Dies takes nothing returns nothing set gg_trg_Tree_Dies = CreateTrigger() call TriggerAddAction(gg_trg_Tree_Dies, function Trig_Tree_Dies_Actions) endfunction Thanks |
| 12-28-2006, 11:33 PM | #4 |
Not sure, I heard before that they don't leak, and even if they do, it's not a leak you should be worried about. |
| 12-29-2006, 11:57 AM | #5 |
destructable groups would 'leak' if destructable groups existed, if you check the code there is no part in which an instance of a "destructable group" is ever created |
