/////////////////the two functions
function CheckItemSlot takes unit z, item x integer y returns integer
if y<4 and UnitItemInSlot(z,y)==x then
return y
elseif y==4 and UnitItemInSlot(z,4)==x then
return 4
elseif y==4 and UnitItemInSlot(z,5)==x then
return 5
else
call UnitDropItemSlot(z,x,y)
return 6
endif
endfunction
function CheckItemClass takes unit x, item y returns boolean
if CheckItemSlot(x, y, GetItemLevel(y)) !=6 then
return false
endif
call BJDebugMsg("Error: Invalid Equipment Pickup")
return false
endfunction
////////////////
//this is an example of how to use the functions in regular jass...
//i'm hoping it gives you good enough idea how to make a gui trigger with the functions
//the line you're most concerned with is the one that starts with 'call CheckItemClass('
//
//basically the way i set up the functions they work automatically and you don't have to code anything else.
//but you still have to edit the item properties in object editor.
//you might need to edit the code if your item needs are unusual.
//how it is set up now item levels 0-3 are for slots 0-3.
//item level 4 is for slots 4-5(perishable/miscellaneous item slots)
//also you can edit the debug message freely and even add a different message for different kinds of armors if you like.
//let me know if you have any trouble doing coding customizations like how i mentioned above.
function Trig_itemclasses_Conditions takes nothing returns boolean
call CheckItemClass(GetManipulatingUnit(),GetManipulatedItem())
return false
endfunction
private function InitTrig_itemclasses takes nothing returns nothing
set gg_trg_itemclasses = CreateTrigger( )
call TriggerRegisterPlayerUnitEvent(t,Player(2),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(3),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(4),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
call TriggerRegisterPlayerUnitEvent(t,Player(5),EVENT_PLAYER_UNIT_PICKUP_ITEM,null)
//repeat the above with every valid player(player(0) is red, player(1) blue, 2 teal, and so on)
call TriggerAddCondition( t, Condition(function triggeritemclassescallfunc) )
endfunction