#Move item to neutral slot or grab from stash

1 messages · Page 1 of 1 (latest)

crude geode
#

I'm using GameMode:SetItemAddedToInventoryFilter to add item to the neutral slot on buy or on grab from ground, but is it possible to do the same for moving items from slot to neutral slot? PS SetExecuteOrderFilter doen't work for me or I don't know how to use this

midnight tusk
#

You just need to use npc:SwapItems(DOTA_ITEM_NEUTRAL_SLOT, ...).

crude geode
#

Where I should add this line?

#

In SetExecuteOrderFilter?

midnight tusk
#

I thought you wanted to put a item into your neutral slot?
So put it there?

crude geode
#

I want to do it in game

midnight tusk
#

You mean allowing the players to put any item into the neutral slot?

crude geode
#

Yes something like that, and right now you only can buy it to this slot

#

Or grap from ground

midnight tusk
#

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.

crude geode
#

Thank you! It works fine now

#

But after that people told me about meepo new talant on lvl25