help with stack trig

Hero

─║╣ero─
Reaction score
250
Just past this in your map header...and then i think it should work out


Code:
function HasItemtype takes unit whichUnit, item this returns item
   local integer i = 0
   local item whichItem = null
   local integer itemType = GetItemTypeId(this)
   if whichUnit != null then
     loop
       exitwhen i > 6
       set whichItem = UnitItemInSlot(whichUnit, i)
       if GetItemTypeId(whichItem) == itemType and whichItem != this then
          return whichItem
       endif
       set i = i + 1
     endloop
   endif
   return null
endfunction

function StackItem takes unit whichHero, item whichItem returns nothing
   local item stack = HasItemtype(whichHero,whichItem)
   local integer itemCharges = GetItemCharges(stack)
   if stack != null and stack != whichItem and itemCharges > 0 then
       call SetItemCharges( stack, itemCharges+ GetItemCharges(whichItem))
       call RemoveItem( whichItem)
   endif
endfunction

credits to Aiursrage2k from Wc3Jass.com
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top