What is wrong with this trigger?
Unfortunately, the fact that the World Editor has no "Integer - Item - Items carried by hero of type" comparison forced me to make this matter very difficult and complicated.
Code:
Events:
Unit - A unit acquires an item
Conditions:
(Charges remaining in (Item being manipulated) Greater than 0
Actions:
Set ItemBeingManipulatedCharges = (Charges remaining in (Item being manipulated))
Item - Remove (Item being manipulated)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
((Triggering unit) has an item of type (Item-type of (Item being manipulated)) Equal to True
Then - Actions
Item - Set charges remaining in (Items carried by (Triggering unit) of type (Item-type of (Item being manipulated)) to (Charges remaining in (Item carried by (Triggering unit) of type (Item-type of (Item being manipulated))) + ItemBeingManipulatedCharges
Else - Actions
Hero - Create (Item-type of (Item being manipulated)) and give it to (Triggering unit)
Item - Set charges remaining in (Last created item) to ItemBeingManipulatedCharges
Unfortunately, the fact that the World Editor has no "Integer - Item - Items carried by hero of type" comparison forced me to make this matter very difficult and complicated.