Could someone help me to do an inventory which works like this :
I give an building (lets say a barrack) 2 differents inventories : one for marines and one for snipers, and now when i put a weapon item (which gives for example a +2 damages) in the marine inventory i want all my marines to have +2 damages but only the marines. And if i switch this weapon item into the sniper inventory it doesnt give the +2 damages to the marines anymore but instead to all the snipers.
The item must have a different behavior according to which inventory it is currently in.
If you want to do it to all units you can create a couple of upgrades that increase the damages for various units, and then detect what inventory the item is and either remove or apply the upgrade based on that. If you want to do it at the time of unit creation, detect when a unit is built and then set the units properties based on what's in the buildings inventory.