# Problem with item recipe.

Status
Not open for further replies.

#### Bambuskabeetoto

Level 1
Hi, I'm having trouble with an item recipe. What's confusing me is it is an exact clone of one that works.

The trigger which correctly removes exactly one Sword 1 and replaces it with Sword 2 even if the hero has multiple Sword 1s:

• Sword2a
• Events
• Unit - A unit Acquires an item
• Conditions
• (Item-type of (Item being manipulated)) Equal to Sword 2 (Recipe)
• 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 Sword 1
• Then - Actions
• Item - Remove (Item being manipulated)
• Item - Remove (Item carried by (Hero manipulating item) in slot (Integer A))
• Hero - Create Sword 2 and give it to (Hero manipulating item)
• Else - Actions
Then this trigger for some reason if you have multiple Sword 2s will remove them all and replace them all with Sword 3.

• Sword3a
• Events
• Unit - A unit Acquires an item
• Conditions
• (Item-type of (Item being manipulated)) Equal to Sword 3 (Recipe)
• 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 Sword 2
• Then - Actions
• Item - Remove (Item being manipulated)
• Item - Remove (Item carried by (Hero manipulating item) in slot (Integer A))
• Hero - Create Sword 3 and give it to (Hero manipulating item)
• Else - Actions
They're near identical apart from the items being bought/replaced. Does anyone have any ideas?

#### rulerofiron99

Level 25
You could re-do the trigger to use the function "Item carried by hero of type". Instead of using the for loop, you simply check if the hero has item of type, and replace it if it has.

Status
Not open for further replies.

Replies
8
Views
900
Replies
5
Views
1K
Replies
3
Views
200
Replies
8
Views
1K
[General] Item Drop System
Replies
0
Views
455