• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Trigger for upgrading abilities (Need help)

Status
Not open for further replies.
I'm making a trigger that allows the player to upgrade his abilities to higher level in exchange for lumber. These abilities are linked with items. If you have the item you have the ability. These items are ability items. The items and the abilities set in array variable to be easy for me to call them.
The thing I want to do is when you drop an item on specific* unit-type shop to upgrade it, or if you don't have enough lumber to refund it. Here's the trigger and it's not working. When I drop the item on the shop nothing happens. See what you can help me about that?
  • Upgrade
    • Events
      • Unit - A unit Pawns an item (to shop)
    • Conditions
      • (Unit-type of (Buying unit)) Equal to Abyss (Team 1)
    • Actions
      • Set Temp_Upgrading_Player = (Owner of (Item being manipulated))
      • For each (Integer A) from 1 to 100, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Item[(Integer A)]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Temp_Upgrading_Player Current lumber) Greater than or equal to 5
                • Then - Actions
                  • Set Temp_Upgrade_number[(Integer A)] = (Integer A)
                  • Hero - Create Item[(Integer A)] and give it to Hero[(Player number of Temp_Upgrading_Player)]
                  • Unit - Increase level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)]
                  • Player - Set Temp_Upgrading_Player Current lumber to ((Temp_Upgrading_Player Current lumber) - 10)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 1 (Red)
                    • Then - Actions
                      • Set PLayer_Upgrades_1[Temp_Upgrade_number[1]] = (PLayer_Upgrades_1[Temp_Upgrade_number[1]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 2 (Blue)
                    • Then - Actions
                      • Set PLayer_Upgrades_2[Temp_Upgrade_number[2]] = (PLayer_Upgrades_2[Temp_Upgrade_number[2]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 3 (Teal)
                    • Then - Actions
                      • Set PLayer_Upgrades_3[Temp_Upgrade_number[3]] = (PLayer_Upgrades_3[Temp_Upgrade_number[3]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 4 (Purple)
                    • Then - Actions
                      • Set PLayer_Upgrades_4[Temp_Upgrade_number[4]] = (PLayer_Upgrades_4[Temp_Upgrade_number[4]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 5 (Yellow)
                    • Then - Actions
                      • Set PLayer_Upgrades_5[Temp_Upgrade_number[5]] = (PLayer_Upgrades_5[Temp_Upgrade_number[5]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 6 (Orange)
                    • Then - Actions
                      • Set PLayer_Upgrades_6[Temp_Upgrade_number[6]] = (PLayer_Upgrades_6[Temp_Upgrade_number[6]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 7 (Green)
                    • Then - Actions
                      • Set PLayer_Upgrades_7[Temp_Upgrade_number[7]] = (PLayer_Upgrades_7[Temp_Upgrade_number[7]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 8 (Pink)
                    • Then - Actions
                      • Set PLayer_Upgrades_8[Temp_Upgrade_number[8]] = (PLayer_Upgrades_8[Temp_Upgrade_number[8]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 9 (Gray)
                    • Then - Actions
                      • Set PLayer_Upgrades_9[PLayer_Upgrades_9[Temp_Upgrade_number[9]]] = (PLayer_Upgrades_9[Temp_Upgrade_number[9]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 10 (Light Blue)
                    • Then - Actions
                      • Set PLayer_Upgrades_10[Temp_Upgrade_number[10]] = (PLayer_Upgrades_10[Temp_Upgrade_number[10]] + 1)
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Temp_Upgrading_Player Current lumber) Less than 5
                • Then - Actions
                  • Player - Add 5 to Temp_Upgrading_Player Current lumber
                  • Hero - Create Item[(Integer A)] and give it to Hero[(Player number of Temp_Upgrading_Player)]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 1 (Red)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_1[Temp_Upgrade_number[1]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 2 (Blue)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_2[Temp_Upgrade_number[2]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 3 (Teal)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_3[Temp_Upgrade_number[3]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 4 (Purple)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_4[Temp_Upgrade_number[(Integer A)]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 5 (Yellow)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_5[Temp_Upgrade_number[5]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 6 (Orange)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_6[Temp_Upgrade_number[5]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 7 (Green)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_7[Temp_Upgrade_number[7]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 8 (Pink)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_8[Temp_Upgrade_number[8]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 9 (Gray)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_9[Temp_Upgrade_number[9]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 10 (Light Blue)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_10[Temp_Upgrade_number[10]]
                    • Else - Actions
                • Else - Actions
            • Else - Actions
the set_player_upgrade_X is integer that stores the level of the ability for the player so you can recall it later.
 
Level 11
Joined
Jun 2, 2013
Messages
613
Is 'buying unit' supposed to be your shop? If so, perhaps that condition only works with the 'Item is Sold event'?

Have you tried using triggering unit instead of buying unit?

EDIT*
Never mind, apparently that condition is supposed to work with your event.

My suggestion is to put a Game Message at the very top to see if the trigger even fires.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
If you sold the item, you are no longer the owner of the item xP Change (Owner of (Item)) to (Triggering player).

Also, instead of using a ton of If/Then/Else, you can just use the triggering player's ID as an array.

  • Set TempPlayer = (Triggering player)
  • Set TempInt = (Player number of TempPlayer)
  • Set Player_Upgrades[TempInt] = (Player_Upgrades_1[TempInt] + 1)

This should also be moved to Triggers & Scripts.
 
Level 12
Joined
May 22, 2015
Messages
1,051
Shouldn't it be Owner of (Triggering Unit) ?

Also omg my eyes. Please use what KILLCIDE has given you. Copy-paste if statements like that are painful.
 
I'm making a trigger that allows the player to upgrade his abilities to higher level in exchange for lumber. These abilities are linked with items. If you have the item you have the ability. These items are ability items. The items and the abilities set in array variable to be easy for me to call them.
The thing I want to do is when you drop an item on specific* unit-type shop to upgrade it, or if you don't have enough lumber to refund it. Here's the trigger and it's not working. When I drop the item on the shop nothing happens. See what you can help me about that?
  • Upgrade
    • Events
      • Unit - A unit Pawns an item (to shop)
    • Conditions
      • (Unit-type of (Buying unit)) Equal to Abyss (Team 1)
    • Actions
      • Set Temp_Upgrading_Player = (Owner of (Item being manipulated))
      • For each (Integer A) from 1 to 100, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Item[(Integer A)]
            • Then - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Temp_Upgrading_Player Current lumber) Greater than or equal to 5
                • Then - Actions
                  • Set Temp_Upgrade_number[(Integer A)] = (Integer A)
                  • Hero - Create Item[(Integer A)] and give it to Hero[(Player number of Temp_Upgrading_Player)]
                  • Unit - Increase level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)]
                  • Player - Set Temp_Upgrading_Player Current lumber to ((Temp_Upgrading_Player Current lumber) - 10)
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 1 (Red)
                    • Then - Actions
                      • Set PLayer_Upgrades_1[Temp_Upgrade_number[1]] = (PLayer_Upgrades_1[Temp_Upgrade_number[1]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 2 (Blue)
                    • Then - Actions
                      • Set PLayer_Upgrades_2[Temp_Upgrade_number[2]] = (PLayer_Upgrades_2[Temp_Upgrade_number[2]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 3 (Teal)
                    • Then - Actions
                      • Set PLayer_Upgrades_3[Temp_Upgrade_number[3]] = (PLayer_Upgrades_3[Temp_Upgrade_number[3]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 4 (Purple)
                    • Then - Actions
                      • Set PLayer_Upgrades_4[Temp_Upgrade_number[4]] = (PLayer_Upgrades_4[Temp_Upgrade_number[4]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 5 (Yellow)
                    • Then - Actions
                      • Set PLayer_Upgrades_5[Temp_Upgrade_number[5]] = (PLayer_Upgrades_5[Temp_Upgrade_number[5]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 6 (Orange)
                    • Then - Actions
                      • Set PLayer_Upgrades_6[Temp_Upgrade_number[6]] = (PLayer_Upgrades_6[Temp_Upgrade_number[6]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 7 (Green)
                    • Then - Actions
                      • Set PLayer_Upgrades_7[Temp_Upgrade_number[7]] = (PLayer_Upgrades_7[Temp_Upgrade_number[7]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 8 (Pink)
                    • Then - Actions
                      • Set PLayer_Upgrades_8[Temp_Upgrade_number[8]] = (PLayer_Upgrades_8[Temp_Upgrade_number[8]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 9 (Gray)
                    • Then - Actions
                      • Set PLayer_Upgrades_9[PLayer_Upgrades_9[Temp_Upgrade_number[9]]] = (PLayer_Upgrades_9[Temp_Upgrade_number[9]] + 1)
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 10 (Light Blue)
                    • Then - Actions
                      • Set PLayer_Upgrades_10[Temp_Upgrade_number[10]] = (PLayer_Upgrades_10[Temp_Upgrade_number[10]] + 1)
                    • Else - Actions
                • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Temp_Upgrading_Player Current lumber) Less than 5
                • Then - Actions
                  • Player - Add 5 to Temp_Upgrading_Player Current lumber
                  • Hero - Create Item[(Integer A)] and give it to Hero[(Player number of Temp_Upgrading_Player)]
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 1 (Red)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_1[Temp_Upgrade_number[1]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 2 (Blue)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_2[Temp_Upgrade_number[2]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 3 (Teal)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_3[Temp_Upgrade_number[3]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 4 (Purple)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_4[Temp_Upgrade_number[(Integer A)]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 5 (Yellow)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_5[Temp_Upgrade_number[5]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 6 (Orange)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_6[Temp_Upgrade_number[5]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 7 (Green)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_7[Temp_Upgrade_number[7]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 8 (Pink)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_8[Temp_Upgrade_number[8]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 9 (Gray)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_9[Temp_Upgrade_number[9]]
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • Temp_Upgrading_Player Equal to Player 10 (Light Blue)
                    • Then - Actions
                      • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_10[Temp_Upgrade_number[10]]
                    • Else - Actions
                • Else - Actions
            • Else - Actions
the set_player_upgrade_X is integer that stores the level of the ability for the player so you can recall it later.

Why make it that selling the item upgrades it. That makes little sense and makes the trigger much more complex. Why not make it upgrade when you buy another item of that type? This would be easy and make sense. You would modify a simple item stacking system to upgrade the ability rather than stack the items. Also, do yourself and us a huge favor and don't if/then that way. As KILLCIDE said, just loop players. Also, you must be doing something wrong if you have indexes on indexes. I remember needed to do this once ... but I probably didn't really need to do it. Anyway, you really don't need to do it.

  • Upgrade
  • Events
    • Unit - A unit Pawns an item (to shop)
  • Conditions
    • (Unit-type of (Triggering unit)) Equal to Abyss (Team 1)
  • Actions
    • Set Temp_Upgrading_Player = (Owner of (Triggering unit))
    • Set PlayerNumber = (Player number of Temp_Upgrading_Player)
    • Set ItemType = (Item-type of (Item being manipulated))
    • For each (Integer A) from 1 to 100, do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • ItemType Equal to Item[(Integer A)]
          • Then - Actions
            • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Temp_Upgrading_Player Current lumber) Greater than or equal to 5
              • Then - Actions
                • Set Temp_Upgrade_number[(Integer A)] = (Integer A)
                • Hero - Create Item[(Integer A)] and give it to Hero[(Player number of Temp_Upgrading_Player)]
                • Unit - Increase level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)]
                • Player - Set Temp_Upgrading_Player Current lumber to ((Temp_Upgrading_Player Current lumber) - 10)
                • Set PLayer_Upgrades_1[Temp_Upgrade_number[PlayerNumber]] = (PLayer_Upgrades_1[Temp_Upgrade_number[PlayerNumber]] + 1)
              • Else - Actions
                • Player - Add 5 to Temp_Upgrading_Player Current lumber
                • Hero - Create Item[(Integer A)] and give it to Hero[(Player number of Temp_Upgrading_Player)]
                • Unit - Set level of Ability[(Integer A)] for Hero[(Player number of Temp_Upgrading_Player)] to PLayer_Upgrades_1[Temp_Upgrade_number[PlayerNumber]]
I still think you can get rid of a lot more baggage here too. For example: Set PLayer_Upgrades_1[Temp_Upgrade_number[PlayerNumber]] = (PLayer_Upgrades_1[Temp_Upgrade_number[PlayerNumber]] + 1) -is probably a bad way to do this. Why not Set ItemUpgrade = (Level of (Ability)) and then Set (Level of (Ability)) = ((Level of (Ability) + 1). The ability stores this number (level) for you. There is no need to store it in a variable. You can always "get" it at the beginning of a trigger.
 
Last edited:
@Legal_Ease, I followed the other suggestions and changed it tp triggering unit, and it worked. However, something bugs me here, there also should be added the coresponding ability to the item, but does not. Also, two arrays here I think are needed, because player X's ability number has its own ability level that's why player[abilityupgraded[playernumber]] = level + 1

Now I'm trying this tutorial for stacking items.
I'm trying to increase the charges of the item and its ability level.

What happens? - When I buy again the same ability item The charges do not increase and the ability is lost. EDIT: Yeah, I handled it. thanks.
  • Acquire items
    • Events
      • Unit - A unit Acquires an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • ((Hero manipulating item) has an item of type (Item-type of (Item being manipulated))) 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
          • For each (Integer A) from 2 to 100, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Item being manipulated)) Equal to Item[(Integer A)]
                • Then - Actions
                  • Hero - Drop (Item being manipulated) from (Hero manipulating item)
                  • Item - Remove (Item being manipulated)
                  • Item - Set charges remaining in (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated))) to ((Charges remaining in (Item carried by (Hero manipulating item) of type (Item-type of (Item being manipulated)))) + (Charges remaining in (Item being manipulated)))
                  • Unit - Add Ability[(Integer A)] to (Triggering unit)
                  • Unit - Increase level of Ability[(Integer A)] for (Triggering unit)
                  • Skip remaining actions
                • Else - Actions
        • Else - Actions
      • For each (Integer A) from 2 to 100, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item being manipulated)) Equal to Item[(Integer A)]
            • Then - Actions
              • Unit - Add Ability[(Integer A)] to (Triggering unit)
            • Else - Actions
 
Last edited:
Status
Not open for further replies.
Top