Warcraft III resources & community, 2003–2006 · archived

UnitMoveItemToSlot

not rated
Submitted by weaaddarFunctions0 downloads
A function which as the name suggests will take an item present in the unit's inventory and move it from its current position to the destined slot.

Use the "UnitMoveItemToSlotBJ" function if you are more comfortable with useing 1 based indices when describing your item slot positions.

Example usages:
You want all picked up items to enter slot 1.
Picked Up Item to slot 1
Events
Unit - A unit Acquires an item
Conditions
Actions
Custom script: call UnitMoveItemToSlot(GetManipulatingUnit() ,GetManipulatedItem(),0 )

New version additions:
Now checks if the unit has the item* and that the slot specified is in range of 0-5.


*IssueTargetOrderById will return false in this orders case if you don't have the item in your inventory I think

Source

function UnitMoveItemToSlot takes unit hero, item it, integer slot returns boolean
    local boolean b
    if(slot>5 or slot<0 )then
       return false
    endif
    return IssueTargetOrderById(hero ,852002+slot,it )
endfunction

function UnitMoveItemToSlotBJ takes unit hero,item it,integer slot returns boolean
   return UnitMoveItemToSlot(hero,it,slot-1)
endfunction

Comments

1
:)