• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[JASS] Searching for: "Item being dragged"

Status
Not open for further replies.
Level 13
Joined
Mar 16, 2008
Messages
941
Hey guys.
I'm working on an inventory system that allows you to store items in a bag, while the bonus of the items is only applied if they are in it. I got the full stat part working, but my problem is to get the items which are "dragged into the bag". My "dragging into the bag" is actually "dragging onto the bag" and removing(saving) it, but that doesn't mather.
I already have something :p
JASS:
function Order2Slot takes integer o returns integer
        local integer i = o-852002 //Drag on slot 1 is 852002, on Slot 6 852007, guess the rest :P
        if i >= 0 and i <= 5 then
            return i
        endif
        return -1
    endfunction
called with:
JASS:
call BJDebugMsg(GetItemName(UnitItemInSlot(GetTriggerUnit(), Order2Slot(GetIssuedOrderId()))))

Yes,this is working. If I drag an item on the bag, this will show "bag" (or in my case "Backpack"). My problem is to find the item "dragged on the bag".

Could you help me pls? :p

Greets Justify.

PS: Horrible text like always, sry^^
 
Last edited:
Level 9
Joined
Apr 5, 2008
Messages
529
You're making things harder than they really are. =)

JASS:
function Trig_test_Actions takes nothing returns nothing
  call BJDebugMsg(GetItemName(GetOrderTargetItem())) //GetOrderTargetItem will return the item you dropped in the bag
endfunction

function Trig_test_Conditions takes nothing returns boolean
    local integer i = GetIssuedOrderId()
    return i > 852001 and i < 852008 //To detect the drop event.
endfunction

//===========================================================================
function InitTrig_test takes nothing returns nothing
    local trigger t = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
    call TriggerAddCondition( t, Condition(function Trig_test_Conditions ))
    call TriggerAddAction( t, function Trig_test_Actions )
    set t = null
endfunction
 
Status
Not open for further replies.
Top