# [Trigger]Inventory full of items Win

#### Jax828

Level 2
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.

#### busterkomo

Level 17
• 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)

#### Volvox

Level 15
Loop makes it simple if all items are of the same type:
for each integer (variable here) from 1 to 6 do actions
if item comparison - item carried by (your hero) in slot (variable) = to (your item) then set (countVar)=(countVar)+1
if countVar = 6 then do actions

#### KaiserG

Level 6
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

#### dumai

Level 2
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

#### Volvox

Level 15
dumai, you didn't get the point... The items carried are dropped from bosses, your way he could just buy 6 potions and win.

#### dumai

Level 2
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.

#### Volvox

Level 15
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.

#### dumai

Level 2
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.

#### Lightskin

Level 15
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

Replies
9
Views
961
Replies
14
Views
1K
Replies
24
Views
2K
Replies
4
Views
1K
Replies
0
Views
335