• 🏆 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!

HELP ME PLS!! LIMIT OF ITEM TIPE CARRIED FOR HERO (SORRY MY BAD ENGLISH)

Status
Not open for further replies.
Level 6
Joined
Oct 25, 2018
Messages
108
Hello, I have a question, what I want to do is something simple, but it has not worked for me. How can I limit the amount of items a hero carries to 1? that is to say that the hero can only carry a single item of that class. Example: How can I make a hero can only carry 1 item of the Crown of Death type.
 
The only way that I am aware of to do this is to have a "Unit acquires an item" trigger, and then when a unit gets an item, check if the unit already has an item of the acquired item's class. If so, cause the unit to instantly drop the acquired item (with the trigger actions).

But if this is too complicated, maybe you can find a "system" on Hive where someone already made all these triggers, and so you would just tell their triggers the type of each item.
 
 
Level 28
Joined
Feb 18, 2014
Messages
3,580
If you're looking for a simple solution which doesn't require JASS knowledge or complex GUI than you can do this:
  • Untitled Trigger 001
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • 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-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Equal to (Item-type of (Item being manipulated))
              • (Item carried by (Hero manipulating item) in slot (Integer A)) Not equal to (Item being manipulated)
            • Then - Actions
              • Hero - Drop (Item being manipulated) from (Hero manipulating item)
            • Else - Actions
 

Attachments

  • PreventDuplicateItems.w3x
    17.8 KB · Views: 11
Status
Not open for further replies.
Top