#Move item to neutral slot or grab from stash
1 messages · Page 1 of 1 (latest)
You just need to use npc:SwapItems(DOTA_ITEM_NEUTRAL_SLOT, ...).
I thought you wanted to put a item into your neutral slot?
So put it there?
I want to do it in game
You mean allowing the players to put any item into the neutral slot?
Yes something like that, and right now you only can buy it to this slot
Or grap from ground
This should work inside your execute order filter:
if (event.order_type == DOTA_UNIT_ORDER_MOVE_ITEM) then
if (event.entindex_target == DOTA_ITEM_NEUTRAL_SLOT) then
DeepPrintTable(event)
local unit = EntIndexToHScript(event.units["0"])
local item = EntIndexToHScript(event.entindex_ability)
local slot = item:GetItemSlot()
unit:SwapItems(slot, DOTA_ITEM_NEUTRAL_SLOT)
end
end
You should probably add checks for stash items, unit~=nil and item~=nil.