• 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.

[Trigger] Inventory full of items Win

Status
Not open for further replies.
Level 2
Joined
Feb 22, 2008
Messages
7
Im making a map that requires you to kill the enemy hero and when they die they will drop something.

I need to know how to make a trigger that makes the player win if he/she has a inventory full of an item e.g 6 Masks of death.

Does anyone know how to do this.
 
Level 17
Joined
Jun 17, 2007
Messages
1,433
  • Conditions
    • (Item carried by YourUnit in slot 1) Equal to (Your Item)
    • (Item carried by YourUnit in slot 2) Equal to (Your Item)
    • (Item carried by YourUnit in slot 3) Equal to (Your Item)
    • (Item carried by YourUnit in slot 4) Equal to (Your Item)
    • (Item carried by YourUnit in slot 5) Equal to (Your Item)
    • (Item carried by YourUnit in slot 6) Equal to (Your Item)
 
Level 6
Joined
Feb 12, 2008
Messages
207
i will explain better what Volvox said ^^

  • Victory
    • 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 in slot (Integer A))) Equal to Mask of Death
            • Then - Actions
              • Set ITEM_COUNT = (ITEM_COUNT + 1)
            • Else - Actions
              • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ITEM_COUNT Equal to 6
        • Then - Actions
          • Game - Victory (Owner of (Hero manipulating item)) (Show dialogs, Show scores)
        • Else - Actions
          • Set ITEM_COUNT = 0
i think that should work
 
Level 2
Joined
Feb 18, 2008
Messages
21
If you want to test for 6 generic items that aren't necessarily the same, it would be easier to make your if condition something like:

  • Victory
    • Events
    • 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 carried by <Hero> in slot (Integer A)) Not equal to No item
            • Then - Actions
              • Set <Counter> = (<Counter> + 1)
            • Else - Actions
 
Level 2
Joined
Feb 18, 2008
Messages
21
Aye that is true. To check against specific items, I'd just do this...

  • Victory
    • Events
    • Conditions
    • Actions
      • Set <ItemArray>[0] = <Item1>
      • Set <ItemArray>[1] = <Item2>
      • Set <ItemArray>[2] = <Item3>
      • Set <ItemArray>[3] = <Item4>
      • Set <ItemArray>[4] = <Item5>
      • Set <ItemArray>[5] = <Item6>
      • 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> in slot (Integer A))) Equal to <ItemArray>[((Integer A) - 1)]
            • Then - Actions
              • Set <Counter> = (<Counter> + 1)
            • Else - Actions

From a programming perspective, that's the most efficient, however, in terms of simplicity, hvo-busterkomo's solution is probably the easiest.
 
Level 15
Joined
Jan 16, 2008
Messages
1,244
And again, you missed the point, this time from a programing perspective. That way the player would have to place <ItemArray>[0] in first slot and so on. You must use two loops one inside the other, one to change slots, the other one to change items. If the items are unique, this is 100% bug-free but if there are more of the same item and you need to get different idem, this bugs. You'd have to add conditions for each item and so on... Loops only complicate the problem if all items are not of the same kind.
 
Level 2
Joined
Feb 18, 2008
Messages
21
Wow you're right. Damn, that'll teach me to post at 4 in the morning, lol. My solution would still work if the heroes were in a particular order, but as Volvox said, not for an inventory of specific different items.
 
Level 15
Joined
Jan 27, 2007
Messages
948
i will explain better what Volvox said ^^

  • Victory
    • 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 in slot (Integer A))) Equal to Mask of Death
            • Then - Actions
              • Set ITEM_COUNT = (ITEM_COUNT + 1)
            • Else - Actions
              • Do nothing
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ITEM_COUNT Equal to 6
        • Then - Actions
          • Game - Victory (Owner of (Hero manipulating item)) (Show dialogs, Show scores)
        • Else - Actions
          • Set ITEM_COUNT = 0
i think that should work

... thats ok guys stop with replies... xD
 
Status
Not open for further replies.
Top