• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!
  • ✅ The POLL for Hive's Texturing Contest #34 is OPEN! Vote for the TOP 3 SKINS! 🔗Click here to cast your vote!
  • ✅ The POLL for Hive's Techtree Contest #20 is OPEN! Vote for the TOP 3 FACTIONS! 🔗Click here to cast your vote!

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
 
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.
Back
Top