only 1 item of every type- the Item-drop-system
I know there is already a tutorial about this somewhere but if you follow it correctly you would need for every item class as many triggers as players are aviable. So 5 itemclasses*8players=40Triggers.
I was able do that in one trigger.(without jass and only 1 variable)
What is a item-drop-system?
If you ever have played one of the (o)rpg's you know that you are only allowed to carry only 1 item per type. So if you have 2 weapons 1 will be dropped and a message apears.In my system you are able to have 6 items classes.
How to start?
First of all you have to decide which item classes you will need.Lets say: weapon,offhand,armor,helmet,boots.
There are some standard item classes(called permanent ,campaign etc...). Now you just have to give them new names(note: only in your head they still have their names). So all weapons are artifacts, all armors are campaign etc... . Now give all your items their item class.
In this case every time you create a weapon you have to give it the class artifact.
Then you have to make a integer variable named item_integer.
(Thanks septimus for this)
test all in one Copy
What have we done? First off all we made a event and some conditions. This will make the trigger fire every time a hero acquieres a item which have one of the classes in the conditions. If you don't understand this please go to a easier tutorial.
The next step is to set our integer to 0. Wy? Cause we change it in the trigger, but need it as 0 again when the trigger fires again.
Set iteminteger = 0
Now lets start the important step.Now we make a loop which cheks the inventory for items with the same class as the acquired item. everytime it found a item our integer is growing bigger. So at least 1 time cause of the item itself.
For each (Integer A) from 1 to 6, do (Actions)
Loop - Actions
After this our integer could be only 1 or 2.
Now ,depending on the integer, we do nothing(integer=1) or we make the acquired item drop(integer=2).
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
Don't forget a nice message like: You cant carry 2 items of the same class.
Hope everything is clear.