- Joined
- Aug 21, 2008
- Messages
- 533
Only 1 item of every type- the item-drop system
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)
The trigger
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.
Now ,depending on the integer, we do nothing(integer=1) or we make the acquired item drop(integer=2).
Hope everything is clear.
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)
The trigger
-
test all in one Copy
-
Events
-
Unit - A unit Acquires an item
-
-
Conditions
-
Or - Any (Conditions) are true
-
Conditions
-
(Item-class of (Item being manipulated)) Equal to Permanent
-
(Item-class of (Item being manipulated)) Equal to Artifact
-
(Item-class of (Item being manipulated)) Equal to Charged
-
(Item-class of (Item being manipulated)) Equal to Campaign
-
-
-
-
Actions
-
Set iteminteger = 0
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-class of (Item being manipulated))
-
-
Then - Actions
-
Set iteminteger = (iteminteger + 1)
-
-
Else - Actions
-
-
-
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
iteminteger Greater than 1
-
-
Then - Actions
-
Hero - Drop (Item being manipulated) from (Hero manipulating item)
-
Game - Display to (Owner of (Triggering unit)), at offset (0.00, 0.00) the text: |cffCE2919You cant ...
-
-
Else - Actions
-
-
-
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
-
For each (Integer A) from 1 to 6, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-class of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-class of (Item being manipulated))
-
-
Then - Actions
-
Set iteminteger = (iteminteger + 1)
-
-
Else - Actions
-
-
-
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)
-
If - Conditions
-
iteminteger Greater than 1
-
-
Then - Actions
-
Hero - Drop (Item being manipulated) from (Hero manipulating item)
-
Game - Display to (Owner of (Triggering unit)), at offset (0.00, 0.00) the text: |cffCE2919You cant ...
-
-
Else - Actions
-
Hope everything is clear.
Last edited: