Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Item

Events


Unit - A unit Acquires an item

Conditions


(Item-type of (Item being manipulated)) Equal to Tome of Experience

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




And - All (Conditions) are true





Conditions






(Unit-type of (Triggering unit)) Equal to Archer






(Level of (Triggering unit)) Greater than or equal to 7



Then - Actions



Else - Actions




Hero - Drop (Item being manipulated) from (Triggering unit)
Item

Events


Unit - A unit Acquires an item

Conditions


(Item-type of (Item being manipulated)) Equal to Sun Key

Actions


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




And - All (Conditions) are true





Conditions






(Unit-type of (Triggering unit)) Equal to Archer






(Level of (Triggering unit)) Greater than or equal to 7



Then - Actions



Else - Actions




Hero - Drop (Item being manipulated) from (Triggering unit)
did you try out that trigger ?, i doubt using triggering unit works?
Ow thanks
Untitled Trigger 003

Events


Unit - A unit Acquires an item

Conditions

Actions


Set A = (Item level of (Item being manipulated))


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




A Greater than or equal to 1000




A Less than 1010



Then - Actions




If (All Conditions are True) then do (Then Actions) else do (Else Actions)





If - Conditions






Or - Any (Conditions) are true







Conditions








(Unit-type of (Triggering unit)) Not equal to Archer








(Hero level of (Triggering unit)) Less than integer[A]





Then - Actions






Hero - Drop (Item being manipulated) from (Triggering unit)





Else - Actions



Else - Actions
I would rather use a Hashtable and store the requirements for items there on their ItemType Id
pardon me if i am wrong, but i think shadowvzs's "system" requires lesser effort then your trigger O:, because the thing needed to change is just the item level while yours require us to change 3 stuffs
library ClassReq initializer init
globals
hashtable ClassReqHash = InitHashtable()
endglobals
private function onItemPickup takes nothing returns nothing
local unit picker = GetManipulatingUnit()
local item manip = GetManipulatedItem()
local integer manipID = GetItemTypeId(manip)
local integer unitID = GetUnitTypeId(picker)
local player p = GetOwningPlayer(picker)
local integer playerID = GetPlayerId(p)
local integer i = 1
local integer i2
local boolean trueCheck = LoadInteger(ClassReqHash, 1, manipID) > 5
local boolean b = false
if not trueCheck then
return
endif
set trueCheck = LoadInteger(ClassReqHash, 0, manipID) < GetHeroLevel(picker)
loop
set i2 = LoadInteger(ClassReqHash, i, manipID)
if i2 > 5 then
set b = b or i2 == unitID
set i = i + 1
else
exitwhen true
endif
endloop
if not(trueCheck and b) then
call UnitRemoveItem(picker, manip)
if not b then
call DisplayTimedTextToPlayer(p, 0, 0, 15, GetUnitName(picker) + " cannot equip " + GetItemName(manip))
else
call DisplayTimedTextToPlayer(p, 0, 0, 15, GetUnitName(picker) + " is too low to equip " + GetItemName(manip))
endif
endif
set picker = null
set manip = null
set p = null
endfunction
function RegisterItem takes nothing returns nothing
local integer i = 0
call SaveInteger(ClassReqHash, 0, udg_ClassReqItem, udg_ClassReqLevel)
loop
if udg_ClassReqUnit[i] > 5 then
call SaveInteger(ClassReqHash, i + 1, udg_ClassReqItem, udg_ClassReqUnit[i])
set i = i + 1
else
exitwhen true
endif
endloop
endfunction
private function init takes nothing returns nothing
local trigger t = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(t, EVENT_PLAYER_UNIT_PICKUP_ITEM)
call TriggerAddAction(t, function onItemPickup)
endfunction
endlibrary
Melee Initialization

Events


Map initialization

Conditions

Actions


Set ClassReqItem = Mask of Death


Set ClassReqUnit[0] = Paladin


Set ClassReqLevel = 11


Custom script: call RegisterItem()


Set ClassReqItem = Partial Key of the Three Moons


Set ClassReqUnit[0] = Paladin


Set ClassReqUnit[1] = Archmage


Set ClassReqLevel = 0


Custom script: call RegisterItem()
shadow, there's no need to loop through Id's. You save the data on Map Init and retrieve only the data from the Acquired Item Id. It's faster than looping.
Some use the Item Level as an Item Class, so you just check "if Item Level is = 6 and Unit Type = Footman, drop item" asuming "lvl 6" is equal to bow or something a footman shouldn't be able to wear.
Im not use what should i put