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

Check if hero has 2 of the same item

Status
Not open for further replies.
Level 6
Joined
Apr 5, 2013
Messages
154
This is what i'm working with
  • pistol ability
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to 9mm
      • (Unit-type of (Hero manipulating item)) Equal to Player
    • Actions
      • Unit - Add Attack 9mm(Dummy) to (Hero manipulating item)
      • Item - Remove (Item carried by (Triggering unit) of type AK-47)
      • Item - Remove (Item carried by (Triggering unit) of type Butcher's Chopper)
      • Item - Remove (Item carried by (Triggering unit) of type M249 Light Machine Gun)
      • Item - Remove (Item carried by (Triggering unit) of type M4A1)
      • Item - Remove (Item carried by (Triggering unit) of type Prototype Shock Rifle)
      • Item - Remove (Item carried by (Triggering unit) of type Rusty Knife)
This trigger takes into account picking up other weapons, but picking up the same weapon will cause it to be picked up, which it shouldn't. I tried messing around with "for loop a," but to no avail. Some insight into this would be appreciated
 
Level 6
Joined
Jun 4, 2017
Messages
172
Try with something like this:
  • Test
    • Eventi
      • Unità - A unit Raccoglie un oggetto
    • Condizioni
    • Azioni
      • Set Guns = 0
      • For each (Integer A) from 1 to 6, do (Actions)
        • Giro - Azioni
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • Se - Condizioni
              • (Item-type of (Item carried by (Hero manipulating item) in slot (Integer A))) Uguale a Gun
            • Allora - Azioni
              • Set Guns = (Guns + 1)
            • Altrimenti - Azioni
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Se - Condizioni
          • Guns Maggiore di 1
        • Allora - Azioni
          • Eroe - Drop (Item being manipulated) from (Hero manipulating item)
        • Altrimenti - Azioni
 
Status
Not open for further replies.
Top