- Joined
- Jun 7, 2008
- Messages
- 440
I have this script:
I had a couple problems testing this. when I picked up multiple items, item slot 1 only carried 1 charge while the others cariried a full 6.
Problem 2 : When item slots are full, I can only put one on the open slot. I dont understand why. I think perhaps because the inventory is full. But I cannot say. Is there any way I can get around this one?
Thanks in advance.
JASS:
function Trig_Max10_Conditions takes nothing returns boolean
return GetItemType(GetManipulatedItem()) == ITEM_TYPE_CHARGED
endfunction
function Trig_Max10_Actions takes nothing returns nothing
local integer index = 1
local item charge = GetManipulatedItem()
local unit u = GetTriggerUnit()
loop
exitwhen index > 6
if ( GetItemTypeId( UnitItemInSlot(u, index))) == GetItemTypeId(charge) and UnitItemInSlot(u, index) != charge then
if ( GetItemCharges(charge) + GetItemCharges(UnitItemInSlot(u, index))) <= 6 then
if ( GetItemCharges(UnitItemInSlot(u, index)) < 6 ) then
call SetItemCharges( UnitItemInSlot(u, index), ( GetItemCharges(UnitItemInSlot(u, index)) + GetItemCharges(charge) ) )
call RemoveItem( GetManipulatedItem() )
endif
endif
endif
set index = index + 1
endloop
endfunction
I had a couple problems testing this. when I picked up multiple items, item slot 1 only carried 1 charge while the others cariried a full 6.
Problem 2 : When item slots are full, I can only put one on the open slot. I dont understand why. I think perhaps because the inventory is full. But I cannot say. Is there any way I can get around this one?
Thanks in advance.