UnitUseItem
- Parameters
-
whichUnit unit
whichItem item
- comment
Issues an immediate order for the unit to use the specified item.
This is the same as left-clicking and using an item in inventory. Units that cannot use items will not do anything.
Returns:
- true if item was successfully used / an order was issued
- false otherwise, because an order was not issued: unit doesn't have item, item on cooldown, invalid unit/item etc.
Examples:
-
Potion of Healing
'phea'
:- Unit on patrol, but has full HP: does nothing, unit continues running
- Unit on patrol, but has low HP: Uses potion to restore HP, stops patrolling
-
Dagger of Escape
'desc'
: is not casted, because requires a position as a target. However, an order is issued, hence returns true. -
Inferno Stone
'infs'
: same as with dagger above.
- note
See:
UnitUseItemPoint
,UnitUseItemTarget
.- patch
1.00
- Source
- common.j
- return type
boolean
- Source code
native UnitUseItem takes unit whichUnit, item whichItem returns boolean