Event: Unit aquires Item Condition: [boolean] Unit has item of class(Itemclass of (Item beeing manipulated)) == true Action: drop item beeing manipulated DisplayTextToPlayer(OwnerOfUnit(UnitManipulatingItem), "you already have an ietm of that class")
in addition to this you should group all items into different catgories e.g. weapons = campaign armor = permanent shields = rechargable ...
therefore you can simply check if the unit already has an item of this is that category and if it has, order it to drop the item it wanted to get.
PS: I know, this is quite the same as written above, but i hope it's easier to undertand ^^
Event: Unit aquires Item Condition: [boolean] Unit has item of class(Itemclass of (Item beeing manipulated)) == true Action: drop item beeing manipulated DisplayTextToPlayer(OwnerOfUnit(UnitManipulatingItem), "you already have an ietm of that class")
in addition to this you should group all items into different catgories e.g. weapons = campaign armor = permanent shields = rechargable ...
therefore you can simply check if the unit already has an item of this is that category and if it has, order it to drop the item it wanted to get.
PS: I know, this is quite the same as written above, but i hope it's easier to undertand ^^
That is because the trigger event is gaining the item; thus, you have at least one item matching those criteria (the one you picked up) when the actions start running. Therefore it drops the item automatically, since the condition is always true. One solution is to drop the item before checking the condition (using an If/Then/Else statement for the condition) and then remove the item if they still don't have a matching item and giving a new item to the Hero via the Create Item For Hero action. Even though the item itself doesn't propagate, the net effect works out correctly.
Ok, i had written it jsut out of my midn without checking of the functions i mention exist.
here is the code as i put it in the editor. Haven't tested whether it works, but it should.
LetItDrop
Ereignisse
Einheit - A unit Erwirbt einen Gegenstand
Bedingungen
tmp_boolean_IsCheckingItems Gleich False
Aktionen
Set tmp_boolean_IsCheckingItems = True
Set tmp_boolean = False
Held - Drop (Item being manipulated) from (Hero manipulating item)
For each (Integer A) from 1 to (Size of inventory for (Hero manipulating item)), do (Actions)
Schleifen - Aktionen
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
'IF'-Bedingungen
(Item-class of (Item being manipulated)) Gleich (Item-class of (Item carried by (Hero manipulating item) in slot (Integer A)))
'THEN'-Aktionen
Set tmp_boolean = True
'ELSE'-Aktionen
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
'IF'-Bedingungen
tmp_boolean Gleich False
'THEN'-Aktionen
Held - Give (Item being manipulated) to (Hero manipulating item)
'ELSE'-Aktionen
Set tmp_boolean_IsCheckingItems = False