• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

How to make a trigger that makes ....

Status
Not open for further replies.
Sorry, couldn't find this problem on the forums, cause of slow interent speed. Please tell me how to make this:
I need a trigger that makes hero carry only one item per item class (CLASS, not type !). I mean, if he has an Artifact in his inventory and takes another one, he automaticly drops last one. Help me with that please, i tried a lot in Editor, but couldn't. :cry:
I need that for my new (4th) map.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,178
You can use the "If...Then" approach to create that but that isnt reccomended in that it can creates unessary lag.

Easiest method is everytime the unit aquires an item it loop checks the unit's items and for every item it sets a local boolean "class" if the aquired item "class" is already on the unit it then orders the unit to drop that item.
 
Well, i understand that, but what triggers i have to use to make that ?
I tried :
"When unit acquiers item"
if
"Item class of item carried by hero manipulating item = artifacts"
"Item class of item being manipulated = artifacts"
actions
"Hero - drop item being manipulated from hero manipulating item"

I know that it looks bad and doesn't work but can you tell me how to make THAT right ? :roll:
 
Level 4
Joined
Apr 8, 2005
Messages
70
This line was right
"When unit acquiers item"
Um... what item carried by hero? And what if the item it detects is the item you just picked up? Then you would be dropping the item you just found.
"Item class of item carried by hero manipulating item = artifacts"
"Item class of item being manipulated = artifacts"
Soooo...
What you needed to do was first make sure the item being picked up was an artifact.
If it is an artifact you need to check each slot of the hero picking up the item to make sure there isn't another artiact item BUT you must make sure it doesn't drop the item you just picked up.


Working Trigger:
Code:
ItemDrop
    Events
        Unit - A unit Acquires an item
    Conditions
        (Item-class of (Item being manipulated)) Equal to Artifact
    Actions
        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 Artifact
                        (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
                    Then - Actions
                        Hero - Drop the item from slot (Integer A) of (Hero manipulating item)
                    Else - Actions
 
Level 6
Joined
May 13, 2005
Messages
164
umm i guess i had the same problem like yours. If the condition is "if (hero manipulating item) has item-class of artifacts" or something like that, it will check the condition after it acquires the item. Then if the hero also has an item-class item of artifact, then it will be dropped. So, if the manipulated item is artifact it will be dropped even if the hero does not have an artifact before that.
 
Status
Not open for further replies.
Top