HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detecting inventry item moves

05-11-2007, 04:58 PM#1
Whitehorn
So, how can I detect when a player moves an item within an inventry to a different slot?

Does it count as a unit order? (EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER) ?

If so, how do I find out whether the target is an item (rather than a point or unit)?

Or can i just skip right to

item = GetOrderTargetItem()

EDIT: removed lisp spellings :P
05-11-2007, 05:06 PM#2
Rising_Dusk
The best way to test this would be to add an order detecting ability to your map and see which event registers properly.
I can't say from personal experience for sure (And definitely don't want to say something that might not be true), but I think the best course of action is to just test it and see what works.

It can definitely be detected with one of the three order events though.
05-11-2007, 05:15 PM#3
Troll-Brain
http://wc3campaigns.net/showthread.php?t=81742

And the unit event is the target order

You should need it : GetIssuedOrder (returns an integer)
05-11-2007, 05:17 PM#4
moyack
Quote:
Originally Posted by PitzerMike at The Warcraft III Ability Guide
  • 852002 to 852007 (moveslot): These are item targeted orders that move the target item to a certain inventory slot of the ordered hero. The id 852002 will move it to slot 1, the id 852003 will move it to slot 2 and so on.
  • 852008 to 852013 (useslot): These are orders that will make the ordered hero use the item in a certain inventory slot. If it's an order with no target or object or point targeted depends on the type of item. The id 852008 will use the item in slot 1, the id 852009 will use the item in slot 2 and so on.
I think this is the answer.
05-11-2007, 05:19 PM#5
Rising_Dusk
I was looking for that tutorial, Moy.
It was weird, I searched in the tutorial area for the term "ability" and it kept saying no matches were found. >_>

Glad someone knows where it is though. :P
05-11-2007, 05:30 PM#6
RaveEye
This trigger should do it:

Collapse JASS:
function Trig_Detect_Item_Move_Actions takes nothing returns nothing
    local integer orderid = GetIssuedOrderId()
    if orderid > 852001 then
        if orderid < 852008 then
            set orderid = orderid - 852001
            call DisplayTextToForce(GetPlayersAll(),I2S(orderid))
        endif
    endif
endfunction

//===========================================================================
function InitTrig_Detect_Item_Move takes nothing returns nothing
    set gg_trg_Detect_Item_Move = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Detect_Item_Move, Player(0), EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER )
    call TriggerAddAction( gg_trg_Detect_Item_Move, function Trig_Detect_Item_Move_Actions )
endfunction

If you move an item to slot x "GetIssuedOrderId()" will return:
slot 1 = 852002
slot 2 = 852003
slot 3 = 852004
slot 4 = 852005
slot 5 = 852006
slot 6 = 852007
05-11-2007, 05:32 PM#7
Troll-Brain
Quote:
Originally Posted by Rising_Dusk
I was looking for that tutorial, Moy.
It was weird, I searched in the tutorial area for the term "ability" and it kept saying no matches were found. >_>

Glad someone knows where it is though. :P

Yeah i don't use the search tool but just time and my eyes xD
05-11-2007, 05:41 PM#8
Whitehorn
Awesome response guys. I'm thinking I may just make the items undroppable (prevents movememnt) and trigger dropping/moving as i need it.