- Joined
- Jul 12, 2018
- Messages
- 550
Hi, I'm trying to make a map where heroes can purchase the same item many times and thereby upgrade those items. So i made a trigger that checks if you're already holding a version of that item, and then replaces the version you're holding.
It's working, but sometimes it fails to recognize that you're already holding an item that's supposed to be upgraded, so you end up with both one level X item and one level 1 item in your backpack.
I have four very basic and simple triggers:
1) For what happens when you buy the Level 1 item, in this case it's a shield:
(this trigger is repeated for as many levels as the items has)
3) for when you run into the max level:
Thanks in advance, you sexy wizards.
It's working, but sometimes it fails to recognize that you're already holding an item that's supposed to be upgraded, so you end up with both one level X item and one level 1 item in your backpack.
I have four very basic and simple triggers:
1) For what happens when you buy the Level 1 item, in this case it's a shield:
-
Heroshield 1to2
-
Events
- Unit - A unit Acquires an item
-
Conditions
- (Item-type of (Item being manipulated)) Equal to Hero Shield
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Hero manipulating item) has an item of type Hero Shield) Equal to True
- (Item being manipulated) Not equal to (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))
-
Then - Actions
- Item - Remove (Item being manipulated)
- Hero - Drop (Item carried by (Hero manipulating item) of type Hero Shield) from (Hero manipulating item)
- Item - Remove (Last dropped item)
- Hero - Create Hero Shield 2 and give it to (Hero manipulating item)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
(this trigger is repeated for as many levels as the items has)
-
Heroshield 2to3
-
Events
- Unit - A unit Acquires an item
-
Conditions
- (Item-type of (Item being manipulated)) Equal to Hero Shield
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Hero manipulating item) has an item of type Hero Shield 2) Equal to True
-
Then - Actions
- Item - Remove (Item being manipulated)
- Hero - Drop (Item carried by (Hero manipulating item) of type Hero Shield 2) from (Hero manipulating item)
- Item - Remove (Last dropped item)
- Hero - Create Hero Shield 3 and give it to (Hero manipulating item)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
3) for when you run into the max level:
-
Heroshield 9isMax
-
Events
- Unit - A unit Acquires an item
-
Conditions
- (Item-type of (Item being manipulated)) Equal to Hero Shield
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Hero manipulating item) has an item of type Hero Shield 9) Equal to True
-
Then - Actions
- Game - Display to (All allies of (Owner of (Triggering unit))) the text: Nine is the highest...
- Item - Remove (Item being manipulated)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
-
Heroshield Reimburse
-
Events
- Unit - A unit Sells an item (from shop)
-
Conditions
- (Item-type of (Sold Item)) Equal to Hero Shield
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- ((Buying unit) has an item of type Hero Shield 9) Equal to True
-
Then - Actions
- Player - Add 450 to (Owner of (Buying unit)) Current gold
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Events
Thanks in advance, you sexy wizards.
Last edited: