• 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] Item Upgrading Trigger

Status
Not open for further replies.
Level 36
Joined
Jul 22, 2004
Messages
1,002
Ok, at the beginning of the map, the player chooses what element he wants to be out of 6 (fire,water,earth,wind,darkness,light). Later on, they pick their heroes. Afterwards, they see they have a building called an Upgrade Center. The player can put their items into the Upgrade Center (has 1 item slot) and press the Upgrade Ability (dummy ability that does nothing), the item will be upgraded. However, when the player puts the item into the Upgrade Center, a Floating Text should pop up in color corresponding to the element of the item (Ex. fire sword, darkness sword etc.). Fire will be red, Earth will be brown, Darkness will be purple, Wind will be light green, Light will be yellow, and Water will be blue. The text should display the Item Name, the Item's Level, and the Cost. I kinda started making this but got stuck already =/ Here's what I have so far:

  • Melee Initialization Copy
    • Events
      • Map initialization
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Set Element_Darkness[(Integer A)] = 1
          • Set Element_Earth[(Integer A)] = 2
          • Set Element_Fire[(Integer A)] = 3
          • Set Element_Light[(Integer A)] = 4
          • Set Element_Water[(Integer A)] = 5
          • Set Element_Wind[(Integer A)] = 6
      • Set Upgrade_Item_Name[(Integer(Fire Sword (Lvl1)))] = Fire Sword (Level 1)
      • Set Upgrade_Item_Name[(Integer(Fire Sword (Lvl2)))] = Fire Sword (Level 2)
      • Set Upgrade_Item_Name[(Integer(Fire Sword (Lvl1)))] = Fire Sword (Level 1)
Where do I go next?
 
Level 5
Joined
Dec 10, 2007
Messages
65
ok, so you'll need a few triggers.
first one, gotta find out what they are putting in the upgrade center

  • Floating Text
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Upgrade Center
      • (Item-type of (Item being manipulated)) Equal to Fire Sword (level 1)
    • Actions
      • Floating Text - Create floating text that reads Fire Sword level 1 $100 above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%) and 0.00% transparency
Now, you can just repeat this trigger for every item and level, but would be kind of stupid, so all you need to do is have some if statements and for loops to decide what item and level was put into the center.
So for example:

  • Floating text
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Upgrade Center
    • Actions
      • For each (Integer A) from 1 to 10, 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 ElementItem[integer A]
            • Then - Actions
              • Floating Text - Create floating text that reads ElementItemName[integer A] + level + ElementItemLevel[integer A] + $ + ElementItemCost[integer A] above (Triggering unit) with Z offset 0.00, using font size 10.00, color (ElementColorRED[integer A], ElementColorBLUE[integer A]%, ElementColourGreen[integer A]%) and 0.00% transparency
where the variables:
Integer A = maximum number of items in the game
ElementItem[integer A] = every single item possible (i.e every element type with sword, axe, with every level 1,2 ect. ect..)
ElementItemName[integer A] = String - name of the item
ElementItemLevel[integer A] = Integer - level of item
ElementItemCost[integer A] = Real - cost of item
ElementColorRED[integer A] = Real - number between 0 and 100% to get of red value
same with color blue and green.

As easy as that, hope this helps & plz +rep
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Couldn't you atleast add a trigger that shows him how to set all the variables that you put in the loop ?

And I don't think that color thingy you put there will work.
I think it should be done with seperate loops that check if that item is whatever element you want and then change the color according to that.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
You could make an array of strings that each one is for its item, and then just put it when you put that item.

For example, if you set a Fire Dagger to be Item[1], you'd create a String[1] that'll be a text like this: "|cffff0000Fire dagger level X cost X to upgrade to a Flaming Sword|r".

Then run a loop that'll be from 0 or 1 depends on when you started the array, untill the end of it (so if you started at [1] and you have 20 items, it'll be "from 1 to 20"), and then make a If/Then/Else which says "If item equal to Item[Integer[A]] show String[Integer[A]]".
 
Level 5
Joined
Dec 10, 2007
Messages
65
Couldn't you atleast add a trigger that shows him how to set all the variables that you put in the loop ?

Sorry man, my bad. I was gonna show him, i just forgot.

Ok, so all ya do is to initialise the variables at the start (map initialisation).
So for your case:

  • Variable Set
    • Events
      • Map Initialization
    • Conditions
    • Actions
      • ElementItem[1] = FireSword lvl 1
      • ElementItem[2] = FireSword lvl 2
      • ElementItem[3] = FireSword lvl 3
      • ElementItem[4] = WaterSword lvl 1
      • ElementItem[5] = WaterSword lvl 2
      • ElementItem[6] = WaterSword lvl 3
      • -----ect-----
      • ElementItemName[1] = FireSword
      • ElementItemName[2] = FireSword
      • ElementItemName[3] = FireSword
      • ElementItemName[4] = WaterSword
      • ElementItemName[5] = WaterSword
      • ElementItemName[6] = WaterSword
      • -----ect-----
      • ElementItemLevel[1] = 1
      • ElementItemLevel[2] = 2
      • ElementItemLevel[3] = 3
      • ElementItemLevel[4] = 1
      • ElementItemLevel[5] = 2
      • ElementItemLevel[6] = 3
      • -----ect-----
      • ElementItemCost[1] = 100.00
      • ElementItemCost[2] = 250.00
      • ElementItemCost[3] = 500.00
      • ElementItemCost[4] = 100.00
      • ElementItemCost[5] = 250.00
      • ElementItemCost[6] = 500.00
      • -----ect-----
      • ElementColorRED[1] = 100.00
      • ElementColorRED[2] = 100.00
      • ElementColorRED[3] = 100.00
      • ElementColorRED[4] = 0.00
      • ElementColorRED[5] = 0.00
      • ElementColorRED[6] = 0.00
      • -----ect-----
      • ElementColorBLUE[1] = 0.00
      • ElementColorBLUE[2] = 0.00
      • ElementColorBLUE[3] = 0.00
      • ElementColorBLUE[4] = 100.00
      • ElementColorBLUE[5] = 100.00
      • ElementColorBLUE[6] = 100.00
      • -----ect-----
      • ElementColorGreen[1] = 0.00
      • ElementColorGreen[2] = 0.00
      • ElementColorGreen[3] = 0.00
      • ElementColorGreen[4] = 0.00
      • ElementColorGreen[5] = 0.00
      • ElementColorGreen[6] = 0.00
Now with that last bit of that variable stuff with the colours, it doesnt really make much sense, but if you go into paint and open up a pallete of colours, you can see that its split up into 3 colours to make up a specific colour, which ranges from 0 - 255. Now all you need to do is pick out what colour u want for ur floating text, and then take a % of each number to get 3 numbers you put in the variables.

i.e:
colour red = (255,0,0) => (100,0,0)
colour blue = (0,255,0) => (0,100,0)
colour light green = (128,128,255) => (50,50,100)
colour brown = (128,0,128) => (50,0,50)
colour purple = (128,128,0) => (50,50,0)
colour yellow = (255,0,255) => (100,0,100)

And thats pretty much it, if your not happy with those colours, try varying the numbers abit to match what you want. If you have any more questions, just post it up.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Seems to be easier this way.

  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Item[0] = Fire Dagger
      • Set Item[1] = Fire Sword
      • Set Item[2] = Flaming Double Edged Sword
      • Set Item[3] = Fire Star
      • Set Item[4] = Fire Ultimatus
      • Set String[0] = |cffff0000Fire Dagger | level 1 item | costs 100 gold to upgrade to a Fire Sword
      • Set String[1] = |cffff0000Fire Sword | level 2 item | costs 200 gold to upgrade to a Flaming Double Edged Sword
      • Set String[2] = |cffff0000Flaming Double Edged Sword | level 3 item | costs 500 gold to upgrade to a Fire Star
      • Set String[3] = |cffff0000Fire Star | level 4 item | costs 2000 gold to upgrade to a Fire Ultimatus (ultimate weapon)
      • Set String[4] = |cffff0000Fire Ultimatus | level 5 item (ultimate) | can't be upgraded !
  • Untitled Trigger 002
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • For each (Integer A) from 0 to 3, 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
              • Floating Text - Create floating text that reads String[(Integer A)] above (Triggering unit) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
            • Else - Actions

{ Variables used: Item[array] - Item Type variable, String[array] - string variable }


This also alowes you to easily make the upgrading system (in case you didn't make it yet) by just creating the "(Item[Integer[A]] + 1)", because the +1 will make it the next item level.
I would suggest anyone that reads this to do it this way (that items that can be upgraded are in a good order 1 after another) because its really easy then to make them upgrade with a loop :)

By the way, you didn't say anything about time of texts so I left it out.
 
I used the stats given in the object editor:

Level -> Level
Name -> Name
Price -> Life
Element -> Classification

Note:
I preplaced the Items you want to give information about in a unreachable region and check if the same Item Type is the one being used. Then It gives out the information.
Since I used Life as the Price you might want to make the items undropable or invulnerable.

Heres the Trigger:

  • SomeRandomTrigger
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to (Item-type of (Random item in Region 000 <gen> matching ((Item-type of (Matching item)) Equal to (Item-type of (Item being manipulated)))))
    • Actions
      • Game - Display to (All players) the text: (Name: + (Name of (Item being manipulated)))
      • Game - Display to (All players) the text: (Level: + (String((Item level of (Item being manipulated)))))
      • Game - Display to (All players) the text: (Price: + (String((Integer((Current life of (Item being manipulated)))))))
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-class of (Item being manipulated)) Equal to Permanent
        • Then - Actions
          • Game - Display to (All players) the text: Element: Earth
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-class of (Item being manipulated)) Equal to Charged
            • Then - Actions
              • Game - Display to (All players) the text: Element: Wind
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-class of (Item being manipulated)) Equal to Powerup
                • Then - Actions
                  • Game - Display to (All players) the text: Element: Darkness
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • (Item-class of (Item being manipulated)) Equal to Artifact
                    • Then - Actions
                      • Game - Display to (All players) the text: Element: Fire
                    • Else - Actions
                      • Game - Display to (All players) the text: Element: None
      • Game - Display to (All players) the text: ============
 
Level 36
Joined
Jul 22, 2004
Messages
1,002
The only problem I have now is the floating text duration. The text needs to disappear once the item is taken out of the upgrade center. How would I do that? Btw, I'm using GhostWolf's method. Here's what I tried to do:
  • Untitled Trigger 001 Copy
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Upgrade Center
      • (Item-type of (Item being manipulated)) Equal to Upgrading_Item[(Integer A)]
    • Actions
      • Floating Text - Destroy Upgrading_Item_FText[(Integer A)]
 
Level 36
Joined
Jul 22, 2004
Messages
1,002
this trigger doesn't work, can someone show me how to fix it? The floating text won't go away once I remove the item.
  • Lose
    • Events
      • Unit - A unit Loses an item
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Triggering unit)) Equal to Upgrade Center
          • (Item-type of (Item being manipulated)) Equal to Upgrading_Item[(Integer A)]
        • Then - Actions
          • For each (Integer A) from 0 to 17, do (Actions)
            • Loop - Actions
              • Floating Text - Destroy Upgrading_Item_FText[(Integer A)]
        • Else - Actions
now the hard part, how do I get it to upgrade? I figured I would do something like this:

  • Upgrade
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Upgrade
      • (Unit-type of (Casting unit)) Equal to Upgrade Center
    • Actions
      • For each (Integer A) from 0 to 17, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
            • Else - Actions
the only problem is that stupid warcraft doesnt have a function that checks if unit has item, only if hero has item. freakin retarded. so what do I do now?

When upgrading, the following criteria must be met:
- The upgrade center must have the item in the slot (there's only 1 slot).
- The item must NOT be lvl3 (max level).
- The hero must have enough gold.
- The hero must have enough lumber.

That's it. I already made a variable array for gold cost and lumber cost. The only problem is implementing it into the trigger above.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
  • Untitled Trigger 001
    • Events
      • Unit - A unit Loses an item
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Footman
    • Actions
      • For each (Integer A) from 0 to 17, 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
              • Floating Text - Destroy FloatingText[(Integer A)]
            • Else - Actions
  • Untitled Trigger 002
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Animate Dead
    • Actions
      • For each (Integer A) from 0 to 17, 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 (Triggering unit) in slot 1)) Equal to Item[(Integer A)]
            • Then - Actions
              • Set GoldNeeded[(Player number of (Owner of (Triggering unit)))] = 1
            • Else - Actions
      • For each (Integer A) from 0 to 17, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Item[(Integer A)]
                  • (Item level of (Item being manipulated)) Not equal to 3
                  • ((Owner of (Triggering unit)) Current gold) Greater than or equal to GoldNeeded[(Player number of (Owner of (Triggering unit)))]
            • Then - Actions
              • Item - Remove (Item being manipulated)
              • Hero - Create Item[((Integer A) + 1)] and give it to (Triggering unit)
              • Player - Add -1 to (Owner of (Triggering unit)) Current gold
              • Skip remaining actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item level of (Item being manipulated)) Equal to 3
                • Then - Actions
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You can't upgrade a...
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Owner of (Triggering unit)) Current gold) Less than GoldNeeded[(Player number of (Owner of (Triggering unit)))]
                    • Then - Actions
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more gold !
                    • Else - Actions

Instead of the "1" and "-1" in the upgrading cost, put a Integer variable (that you'll need to set from the start) that will be the costs of the items.

And notice that "Skip remaining actions", you MUST put it or it will upgrade it automaticly to level 3.


I actualy think now that the easiest way to make this work, is to set all your items based on levels.

For example, if you have 18 items (like it seems you do), I guess its 6 items with 3 levels ?
So you'll put Level 1 = 1-6 , so your Item[1] will be for example a Fire Dagger, then untill Item[6] it'll continue all the elements level 1 items, then from 7-12 it'll be all the level 2 items, and then from 13-18 level 3 items.
Now instead of "Integer[A] + 1" put "Integer[A] + 6".


And also do notice that you'll need to set all your items levels (in the object manager).
 
Level 36
Joined
Jul 22, 2004
Messages
1,002
So I make all my lvl1 items have an item level of 0-5, all the lvl2 items have an item level of 6-11, all lvl3 items have item level of 12-17? or do I set all the lvl1 items to have an item lvl of 1, all the lvl2 items to have an item lvl of 2, all of the lvl3 items to have an item lvl of 3?

I also found a problem with that trigger, the upgrade cost of the items increases as the level gets higher. For example, upgrading 1 > 2 costs 100 gold and 2 lumber, upgrading 2 > 3 costs 500 gold and 10 lumber. I tried editing your trigger a bit and here's the big mess that I have. It's really buggy ><

  • Upgrade
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • (Ability being cast) Equal to Upgrade
  • Actions
    • For each (Integer A) from 0 to 17, 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 (Triggering unit) in slot 1)) Equal to Upgrading_Item[(Integer A)]
          • Then - Actions
            • Set Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))] = 100
            • Set Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))] = 2
          • Else - Actions
            • For each (Integer A) from 0 to 17, do (Actions)
              • Loop - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • And - All (Conditions) are true
                      • Conditions
                        • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Upgrading_Item[(Integer A)]
                        • (Item level of (Item being manipulated)) Less than 2
                        • ((Owner of (Triggering unit)) Current gold) Greater than or equal to Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                        • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
                  • Then - Actions
                    • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
                    • Special Effect - Destroy (Last created special effect)
                    • Item - Remove (Item carried by (Triggering unit) in slot 1)
                    • Hero - Create Upgrading_Item[((Integer A) + 1)] and give it to (Triggering unit)
                    • Player - Add (Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))] x -1) to (Owner of (Triggering unit)) Current gold
                    • Player - Add (Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))] x -1) to (Owner of (Triggering unit)) Current gold
                    • Skip remaining actions
                  • Else - Actions
                    • For each (Integer A) from 0 to 17, 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 (Triggering unit) in slot 1)) Equal to Upgrading_Item[(Integer A)]
                          • Then - Actions
                            • Set Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))] = 500
                            • Set Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))] = 10
                          • Else - Actions
                            • For each (Integer A) from 0 to 17, do (Actions)
                              • Loop - Actions
                                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                  • If - Conditions
                                    • And - All (Conditions) are true
                                      • Conditions
                                        • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Upgrading_Item[(Integer A)]
                                        • (Item level of (Item being manipulated)) Less than 3
                                        • ((Owner of (Triggering unit)) Current gold) Greater than or equal to Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                                        • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
                                  • Then - Actions
                                    • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
                                    • Special Effect - Destroy (Last created special effect)
                                    • Item - Remove (Item carried by (Triggering unit) in slot 1)
                                    • Hero - Create Upgrading_Item[((Integer A) + 2)] and give it to (Triggering unit)
                                    • Player - Add (Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))] x -1) to (Owner of (Triggering unit)) Current gold
                                    • Player - Add (Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))] x -1) to (Owner of (Triggering unit)) Current gold
                                    • Skip remaining actions
                                  • Else - Actions
                                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                      • If - Conditions
                                        • (Item level of (Item being manipulated)) Equal to 3
                                      • Then - Actions
                                        • Game - Display to (Player group((Owner of (Triggering unit)))) the text: The item is at its ...
                                      • Else - Actions
                                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                          • If - Conditions
                                            • ((Owner of (Triggering unit)) Current gold) Less than Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                                          • Then - Actions
                                            • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more gold.
                                          • Else - Actions
                                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                          • If - Conditions
                                            • ((Owner of (Triggering unit)) Current lumber) Less than Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
                                          • Then - Actions
                                            • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more spiri...
                                          • Else - Actions
                                        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                          • If - Conditions
                                            • ((Owner of (Triggering unit)) Current gold) Less than Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                                            • ((Owner of (Triggering unit)) Current lumber) Less than Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
                                          • Then - Actions
                                            • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more gold ...
                                          • Else - Actions
These are the problems:
- When you put in a lvl 1 item and upgrade but you don't have enough gold, it will say "You don't have enough gold" 18 times.
- When you put in a lvl 1 item and upgrade but you don't have enough lumber, it will say "You don't have enough lumber" 18 times.
- When you put in a lvl 1 item and upgrade but you don't have enough gold AND lumber, it will say "You don't have enough gold" 18 times, it will say "You don't have enough lumber" 18 times, and it will say "You don't have enough gold and lumber" 18 times.
- When you successfully level up an item, the item gets removed but the upgraded item doesn't appear.
- When you put in a lvl 2 item and upgrade regardless of the fact that you don't have enough gold AND lumber, it still levels and you don't get an upgraded item.
- When you put in a lvl 3 item and upgrade regardless of the fact that you don't have enough gold AND lumber, it still levels and you don't get an upgraded item.
- If you don't replace Item - Remove (Item being manipulated) from (Triggering Unit) with Item - Remove (Item carried by (Triggering unit) in slot 1), the item that's being upgraded doesn't disappear and the upgraded item appears on the floor which isn't what I want. I want it to appear in the 1st slot of the Upgrade Center. However, after I replaced it. The upgrading item doesn't come out and the item that you want to upgrade just disappears.

Also, if there are any leaks, can you please tell me. Thanks a TON!
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
For it to not show 18 times the text, add a "Skip remaining actions" in every Actions block after it made its actions (last action in every action block).

Now, can you explain why you added that similiar loop which adds a "Item[array] + 2" ?

And about the prices, as I said you should set them at the start of the game (like the item variable).
Just make a 2 similiar integers that will be Gold and Wood and set their prices.
Then "...is Item[Integer[A]]..." "...property is greater or equal to Gold[Integer[A]]...".
The same with wood of course.

And about the not removing or picking items, dunno, maybe its a bug in WE ?


About the leaks, I think the only leaks we have access for in GUI are Unit Groups and Locations.
Since you are not using any of those, it won't leak.
 
Level 36
Joined
Jul 22, 2004
Messages
1,002
Can you tell me which blocks to put in under? I made the item[array] + 2 so that i can have 2 different prices. the +1 costs 100 gold and 2 lumber while the +2 costs 500 gold and 10 lumber.

can you explain the "Then "...is Item[Integer[A]]..." "...property is greater or equal to Gold[Integer[A]]...".
The same with wood of course." thing?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
  • Untitled Trigger 001
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set Gold[0] = 100
      • Set Gold[1] = 200
      • Set Wood[0] = 20
      • Set Wood[1] = 40
      • -------- Go on to all your item prices --------
      • -------- Gold[0] = gold price of upgrading Item[0] to Item[1] --------
      • -------- Wood[0] = wood price of upgrading Item[0] to Item[1] --------
  • Untitled Trigger 002
    • Events
    • Conditions
    • Actions
      • -------- I deleted the original code so just add this instead of the property condition I put there --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • ((Owner of (Triggering unit)) Current gold) Greater than or equal to Gold[(Integer A)]
              • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to Wood[(Integer A)]
        • Then - Actions
        • Else - Actions

As I said, im suggestion you to set all your level 1 items, then all your level 2 items, and then the level 3 items, and just jump with the item array to upgrade.
This will remove things needed to stop a player from upgrading a level 3 item to the next level 1 item.

And just from curiosity, why are you making 2 prices ?
How can the player CHOOSE beetwin them when he casts 1 spell ?
 
Level 36
Joined
Jul 22, 2004
Messages
1,002
Level 1 item costs: 100 to upgrade. After it's level 2, it takes 500 to upgrade. Now it's level 3 and can't be upgraded any further. I don't want a static price like for all levels it takes 100 to upgrade. And are u suggesting this?

item[0] = fire sword lvl1
item[1] = water sword lvl1
item[2] = light sword lvl1
item[3] = dark sword lvl1
item[4] = earth sword lvl1
item[5] = wind sword lvl1
item[6] = fire sword lvl2
item[7] = water sword lvl2
item[8] = light sword lvl2
item[9] = dark sword lvl2
item[10] = earth sword lvl2
item[11] = wind sword lvl2

and so on?
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Yes thats what I meant.

And about the prices, I meant that you will do exacly like you did now with the items but with prices.

here's an example:
  • Actions
  • item[0] = fire sword lvl1
  • item[1] = water sword lvl1
  • item[2] = light sword lvl1
  • item[3] = dark sword lvl1
  • item[4] = earth sword lvl1
  • item[5] = wind sword lvl1
  • item[6] = fire sword lvl2
  • item[7] = water sword lvl2
  • item[8] = light sword lvl2
  • item[9] = dark sword lvl2
  • item[10] = earth sword lvl2
  • item[11] = wind sword lvl2
  • -------- Continue with all your items --------
  • Integer[0] = 100 //this is the price to upgrade a level 1 fire sword to level 2
  • Integer[1] = 110 //this is the price to upgrade a level 1 water sword to level 2
  • Integer[2] = 90
  • Integer[3] = 60
  • Integer[4] = 80
  • Integer[5] = 100
  • Integer[6] = 500 //this is the price to upgrade a level 2 fire sword to level 3
  • Integer[7] = 460 //this is the price to upgrade a level 2 water sword to level 3
  • Integer[8] = 800
  • Integer[9] = 600
  • Integer[10] = 580
  • Integer[11] = 640

As you can notice, you don't need a level 3 price, so you'll only need as much as you have level 1 items and level 2 items.

You'll also need a wood integer and make it work the same way.
 
Level 36
Joined
Jul 22, 2004
Messages
1,002
this is what I have so far: [rainbow]
  • Cost
    • Events
    • Conditions
    • Actions
      • -------- Gold Cost --------
      • Set Upgrade_Item_GCost[0] = 100
      • Set Upgrade_Item_GCost[1] = 500
      • Set Upgrade_Item_GCost[2] = 0
      • Set Upgrade_Item_GCost[3] = 100
      • Set Upgrade_Item_GCost[4] = 500
      • Set Upgrade_Item_GCost[5] = 0
      • Set Upgrade_Item_GCost[6] = 100
      • Set Upgrade_Item_GCost[7] = 500
      • Set Upgrade_Item_GCost[8] = 0
      • Set Upgrade_Item_GCost[9] = 100
      • Set Upgrade_Item_GCost[10] = 500
      • Set Upgrade_Item_GCost[11] = 0
      • Set Upgrade_Item_GCost[12] = 100
      • Set Upgrade_Item_GCost[13] = 500
      • Set Upgrade_Item_GCost[14] = 0
      • Set Upgrade_Item_GCost[15] = 100
      • Set Upgrade_Item_GCost[16] = 500
      • Set Upgrade_Item_GCost[17] = 0
      • -------- Spirit Cost --------
      • Set Upgrade_Item_SCost[0] = 2
      • Set Upgrade_Item_SCost[1] = 10
      • Set Upgrade_Item_SCost[2] = 0
      • Set Upgrade_Item_SCost[3] = 2
      • Set Upgrade_Item_SCost[4] = 10
      • Set Upgrade_Item_SCost[5] = 0
      • Set Upgrade_Item_SCost[6] = 2
      • Set Upgrade_Item_SCost[7] = 10
      • Set Upgrade_Item_SCost[8] = 0
      • Set Upgrade_Item_SCost[9] = 2
      • Set Upgrade_Item_SCost[10] = 10
      • Set Upgrade_Item_SCost[11] = 0
      • Set Upgrade_Item_SCost[12] = 2
      • Set Upgrade_Item_SCost[13] = 10
      • Set Upgrade_Item_SCost[14] = 0
      • Set Upgrade_Item_SCost[15] = 2
      • Set Upgrade_Item_SCost[16] = 10
      • Set Upgrade_Item_SCost[17] = 0
  • [/rainbow]
 
Level 36
Joined
Jul 22, 2004
Messages
1,002
How would I revise my Upgrade trigger? I already changed the map initialization as u told me :
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Level 1 --------
      • Set Upgrading_Item[0] = Fire Sword (Lvl1)
      • Set Upgrading_Item[1] = Water Sword (Lvl1)
      • Set Upgrading_Item[2] = Light Sword (Lvl1)
      • Set Upgrading_Item[3] = Wind Sword (Lvl1)
      • Set Upgrading_Item[4] = Dark Sword (Lvl1)
      • Set Upgrading_Item[5] = Earth Sword (Lvl1)
      • -------- Level 2 --------
      • Set Upgrading_Item[6] = Fire Sword (Lvl2)
      • Set Upgrading_Item[7] = Water Sword (Lvl2)
      • Set Upgrading_Item[8] = Light Sword (Lvl2)
      • Set Upgrading_Item[9] = Wind Sword (Lvl2)
      • Set Upgrading_Item[10] = Dark Sword (Lvl2)
      • Set Upgrading_Item[11] = Earth Sword (Lvl2)
      • -------- Level 3 --------
      • Set Upgrading_Item[12] = Fire Sword (Lvl3)
      • Set Upgrading_Item[13] = Water Sword (Lvl3)
      • Set Upgrading_Item[14] = Light Sword (Lvl3)
      • Set Upgrading_Item[15] = Wind Sword (Lvl3)
      • Set Upgrading_Item[16] = Dark Sword (Lvl3)
      • Set Upgrading_Item[17] = Earth Sword (Lvl3)
      • -------- Fire --------
      • Set Upgrade_Item_String[0] = |cffED4836- Fire Sword Level 1 - Gold Cost: 100 - Fire Spirits Needed: 2 -
      • Set Upgrade_Item_String[1] = |cffED4836- Fire Sword Level 2 - Gold Cost: 500 - Fire Spirits Needed: 10 -
      • Set Upgrade_Item_String[2] = |cffED4836- Fire Sword Level 3 - Can't Be Upgraded -
      • -------- Water --------
      • Set Upgrade_Item_String[3] = |cff46A3FF- Water Sword Level 1 - Gold Cost: 100 - Water Spirits Needed: 2 -
      • Set Upgrade_Item_String[4] = |cff46A3FF- Water Sword Level 2 - Gold Cost: 500 - Water Spirits Needed: 10 -
      • Set Upgrade_Item_String[5] = |cff46A3FF- Water Sword Level 3 - Can't Be Upgraded -
      • -------- Light --------
      • Set Upgrade_Item_String[6] = |cffFAE154- Light Sword Level 1 - Gold Cost: 100 - Light Spirits Needed: 2 -
      • Set Upgrade_Item_String[7] = |cffFAE154- Light Sword Level 2 - Gold Cost: 500 - Light Spirits Needed: 10 -
      • Set Upgrade_Item_String[8] = |cffFAE154- Light Sword Level 3 - Can't Be Upgraded -
      • -------- Wind --------
      • Set Upgrade_Item_String[9] = |cff8EFDDE- Wind Sword Level 1 - Gold Cost: 100 - Wind Spirits Needed: 2 -
      • Set Upgrade_Item_String[10] = |cff8EFDDE- Wind Sword Level 2 - Gold Cost: 500 - Wind Spirits Needed: 10 -
      • Set Upgrade_Item_String[11] = |cff8EFDDE- Wind Sword Level 3 - Can't Be Upgraded -
      • -------- Dark --------
      • Set Upgrade_Item_String[12] = |cff8000FF- Dark Sword Level 1 - Gold Cost: 100 - Dark Spirits Needed: 2 -
      • Set Upgrade_Item_String[13] = |cff8000FF- Dark Sword Level 2 - Gold Cost: 500 - Dark Spirits Needed: 10 -
      • Set Upgrade_Item_String[14] = |cff8000FF- Dark Sword Level 3 - Can't Be Upgraded -
      • -------- Earth --------
      • Set Upgrade_Item_String[15] = |cff9B4E00- Earth Sword Level 1 - Gold Cost: 100 - Earth Spirits Needed: 2 -
      • Set Upgrade_Item_String[16] = |cff9B4E00- Earth Sword Level 2 - Gold Cost: 500 - Earth Spirits Needed: 10 -
      • Set Upgrade_Item_String[17] = |cff9B4E00- Earth Sword Level 3 - Can't Be Upgraded -
      • -------- Gold Cost --------
      • Set Upgrade_Item_GCost[0] = 100
      • Set Upgrade_Item_GCost[1] = 500
      • Set Upgrade_Item_GCost[2] = 100
      • Set Upgrade_Item_GCost[3] = 500
      • Set Upgrade_Item_GCost[4] = 100
      • Set Upgrade_Item_GCost[5] = 500
      • Set Upgrade_Item_GCost[6] = 100
      • Set Upgrade_Item_GCost[7] = 500
      • Set Upgrade_Item_GCost[8] = 100
      • Set Upgrade_Item_GCost[9] = 500
      • Set Upgrade_Item_GCost[10] = 100
      • Set Upgrade_Item_GCost[11] = 500
      • -------- Spirit Cost --------
      • Set Upgrade_Item_SCost[0] = 2
      • Set Upgrade_Item_SCost[1] = 10
      • Set Upgrade_Item_SCost[2] = 2
      • Set Upgrade_Item_SCost[3] = 10
      • Set Upgrade_Item_SCost[4] = 2
      • Set Upgrade_Item_SCost[5] = 10
      • Set Upgrade_Item_SCost[6] = 2
      • Set Upgrade_Item_SCost[7] = 10
      • Set Upgrade_Item_SCost[8] = 2
      • Set Upgrade_Item_SCost[9] = 10
      • Set Upgrade_Item_SCost[10] = 2
      • Set Upgrade_Item_SCost[11] = 10
and where would I add this into my Upgrade trigger?
  • Untitled Trigger 002
    • Events
    • Conditions
    • Actions
      • -------- I deleted the original code so just add this instead of the property condition I put there --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • And - All (Conditions) are true
            • Conditions
              • ((Owner of (Triggering unit)) Current gold) Greater than or equal to Gold[(Integer A)]
              • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to Wood[(Integer A)]
        • Then - Actions
        • Else - Actions
This is how I revised it and it definitely doesn't work:
  • Upgrade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Upgrade
    • Actions
      • For each (Integer A) from 0 to 17, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Upgrading_Item[(Integer A)]
                  • ((Owner of (Triggering unit)) Current gold) Greater than or equal to Upgrade_Item_GCost[(Integer A)]
                  • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to Upgrade_Item_GCost[(Integer A)]
            • Then - Actions
            • Else - Actions
      • For each (Integer A) from 0 to 17, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Upgrading_Item[(Integer A)]
                  • (Item level of (Item being manipulated)) Not equal to 3
                  • ((Owner of (Triggering unit)) Current gold) Greater than or equal to Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                  • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Item - Remove (Item carried by (Triggering unit) in slot 1)
              • Hero - Create Upgrading_Item[((Integer A) + 1)] and give it to (Triggering unit)
              • Player - Add (Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))] x -1) to (Owner of (Triggering unit)) Current gold
              • Player - Add (Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))] x -1) to (Owner of (Triggering unit)) Current gold
              • Skip remaining actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item level of (Item being manipulated)) Equal to 3
                • Then - Actions
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: The item is at its ...
                  • Skip remaining actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Owner of (Triggering unit)) Current gold) Less than Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                    • Then - Actions
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more gold.
                      • Skip remaining actions
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Owner of (Triggering unit)) Current lumber) Less than Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
                    • Then - Actions
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more spiri...
                      • Skip remaining actions
                    • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Owner of (Triggering unit)) Current gold) Less than Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                      • ((Owner of (Triggering unit)) Current lumber) Less than Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
                    • Then - Actions
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more gold ...
                      • Skip remaining actions
                    • Else - Actions
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
  • Upgrade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Upgrade
    • Actions
      • For each (Integer A) from 0 to 17, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Upgrading_Item[(Integer A)]
                  • ((Owner of (Triggering unit)) Current gold) Greater than or equal to Upgrade_Item_GCost[(Integer A)]
                  • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to Upgrade_Item_GCost[(Integer A)]
                  • (Item level of (Item being manipulated)) Not equal to 3
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Item - Remove (Item carried by (Triggering unit) in slot 1)
              • Hero - Create Upgrading_Item[((Integer A) + 6)] and give it to (Triggering unit)
              • Player - Add -(Upgrade_Item_GCost[Integer[A]]) to (Owner of (Triggering unit)) Current gold
              • Player - Add -(Upgrade_Item_SCost[Integer[A]]) to (Owner of (Triggering unit)) Current wood
              • Skip remaining actions
              • Else - Actions
                • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Item level of (Item being manipulated)) Equal to 3
                  • Then - Actions
                    • Game - Display to (Player group((Owner of (Triggering unit)))) the text: The item is at its ...
                    • Skip remaining actions
                  • Else - Actions
                    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • ((Owner of (Triggering unit)) Current gold) Less than Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                      • Then - Actions
                        • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more gold.
                        • Skip remaining actions
                        • Else - Actions
                          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                            • If - Conditions
                              • ((Owner of (Triggering unit)) Current lumber) Less than Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
                            • Then - Actions
                              • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more spiri...
                              • Skip remaining actions
                            • Else - Actions

And set your strings so that they will be similiar to your items.

For example, your level 1 fire sword is Item[0] so the string for it would be String[0] but your level 2 is Item[6] so also the string will be needed to be set to String[6].


[Edit] Ok im going to sleep so if you need further help ill help you tommarow (*looks at the watch* today... lol).
 
Last edited:
Level 36
Joined
Jul 22, 2004
Messages
1,002
Seriously, what is up with WC3's bug with heroes and items. The whole damn system works now except for when creating the item. The item gets removed but no item is made. Anyway around this? Btw, How do I also make it say "You need to have an item" when there is no item in the Upgrade Center. Also, if you don't have both enough gold AND lumber, it should say "You don't have enough gold and lumber" but it only says "You don't have enough gold". I tried adding a wait inbetween removing the item and adding the item but it still doesn't work. Also when it's fully upgraded, it doesn't have a text that pops up and it says "You need more gold". Here's the 2 revised triggers:
  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Level 1 --------
      • Set Upgrading_Item[0] = Fire Sword (Lvl1)
      • Set Upgrading_Item[1] = Water Sword (Lvl1)
      • Set Upgrading_Item[2] = Light Sword (Lvl1)
      • Set Upgrading_Item[3] = Wind Sword (Lvl1)
      • Set Upgrading_Item[4] = Dark Sword (Lvl1)
      • Set Upgrading_Item[5] = Earth Sword (Lvl1)
      • -------- Text --------
      • Set Upgrade_Item_String[0] = |cffED4836- Fire Sword Level 1 - Gold Cost: 100 - Fire Spirits Needed: 2 -
      • Set Upgrade_Item_String[1] = |cff46A3FF- Water Sword Level 1 - Gold Cost: 100 - Water Spirits Needed: 2 -
      • Set Upgrade_Item_String[2] = |cffFAE154- Light Sword Level 1 - Gold Cost: 100 - Light Spirits Needed: 2 -
      • Set Upgrade_Item_String[3] = |cff8EFDDE- Wind Sword Level 1 - Gold Cost: 100 - Wind Spirits Needed: 2 -
      • Set Upgrade_Item_String[4] = |cff8000FF- Dark Sword Level 1 - Gold Cost: 100 - Dark Spirits Needed: 2 -
      • Set Upgrade_Item_String[5] = |cff9B4E00- Earth Sword Level 1 - Gold Cost: 100 - Earth Spirits Needed: 2 -
      • -------- Level 2 --------
      • Set Upgrading_Item[6] = Fire Sword (Lvl2)
      • Set Upgrading_Item[7] = Water Sword (Lvl2)
      • Set Upgrading_Item[8] = Light Sword (Lvl2)
      • Set Upgrading_Item[9] = Wind Sword (Lvl2)
      • Set Upgrading_Item[10] = Dark Sword (Lvl2)
      • Set Upgrading_Item[11] = Earth Sword (Lvl2)
      • -------- Text --------
      • Set Upgrade_Item_String[6] = |cffED4836- Fire Sword Level 2 - Gold Cost: 500 - Fire Spirits Needed: 10 -
      • Set Upgrade_Item_String[7] = |cff46A3FF- Water Sword Level 2 - Gold Cost: 500 - Water Spirits Needed: 10 -
      • Set Upgrade_Item_String[8] = |cffFAE154- Light Sword Level 2 - Gold Cost: 500 - Light Spirits Needed: 10 -
      • Set Upgrade_Item_String[9] = |cff8EFDDE- Wind Sword Level 2 - Gold Cost: 500 - Wind Spirits Needed: 10 -
      • Set Upgrade_Item_String[10] = |cff8000FF- Dark Sword Level 2 - Gold Cost: 500 - Dark Spirits Needed: 10 -
      • Set Upgrade_Item_String[11] = |cff9B4E00- Earth Sword Level 2 - Gold Cost: 500 - Earth Spirits Needed: 10 -
      • -------- Level 3 --------
      • Set Upgrading_Item[12] = Fire Sword (Lvl3)
      • Set Upgrading_Item[13] = Water Sword (Lvl3)
      • Set Upgrading_Item[14] = Light Sword (Lvl3)
      • Set Upgrading_Item[15] = Wind Sword (Lvl3)
      • Set Upgrading_Item[16] = Dark Sword (Lvl3)
      • Set Upgrading_Item[17] = Earth Sword (Lvl3)
      • -------- Text --------
      • Set Upgrade_Item_String[12] = |cffED4836- Fire Sword Level 3 - Can't Be Upgraded -
      • Set Upgrade_Item_String[13] = |cff46A3FF- Water Sword Level 3 - Can't Be Upgraded -
      • Set Upgrade_Item_String[14] = |cffFAE154- Light Sword Level 3 - Can't Be Upgraded -
      • Set Upgrade_Item_String[15] = |cff8EFDDE- Wind Sword Level 3 - Can't Be Upgraded -
      • Set Upgrade_Item_String[16] = |cff8000FF- Dark Sword Level 3 - Can't Be Upgraded -
      • Set Upgrade_Item_String[17] = |cff9B4E00- Earth Sword Level 3 - Can't Be Upgraded -
      • -------- Gold Cost --------
      • Set Upgrade_Item_GCost[0] = 100
      • Set Upgrade_Item_GCost[0] = 100
      • Set Upgrade_Item_GCost[1] = 100
      • Set Upgrade_Item_GCost[2] = 100
      • Set Upgrade_Item_GCost[3] = 100
      • Set Upgrade_Item_GCost[4] = 100
      • Set Upgrade_Item_GCost[5] = 100
      • Set Upgrade_Item_GCost[6] = 500
      • Set Upgrade_Item_GCost[7] = 500
      • Set Upgrade_Item_GCost[8] = 500
      • Set Upgrade_Item_GCost[9] = 500
      • Set Upgrade_Item_GCost[10] = 500
      • Set Upgrade_Item_GCost[11] = 500
      • -------- Spirit Cost --------
      • Set Upgrade_Item_SCost[0] = 2
      • Set Upgrade_Item_SCost[1] = 2
      • Set Upgrade_Item_SCost[2] = 2
      • Set Upgrade_Item_SCost[3] = 2
      • Set Upgrade_Item_SCost[4] = 2
      • Set Upgrade_Item_SCost[5] = 2
      • Set Upgrade_Item_SCost[6] = 10
      • Set Upgrade_Item_SCost[7] = 10
      • Set Upgrade_Item_SCost[8] = 10
      • Set Upgrade_Item_SCost[9] = 10
      • Set Upgrade_Item_SCost[10] = 10
      • Set Upgrade_Item_SCost[11] = 10
  • Upgrade
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Upgrade
    • Actions
      • For each (Integer A) from 0 to 17, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (Item-type of (Item carried by (Triggering unit) in slot 1)) Equal to Upgrading_Item[(Integer A)]
                  • ((Owner of (Triggering unit)) Current gold) Greater than or equal to Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                  • ((Owner of (Triggering unit)) Current lumber) Greater than or equal to Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
                  • (Item level of (Item being manipulated)) Not equal to 3
            • Then - Actions
              • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Other\Levelup\LevelupCaster.mdl
              • Special Effect - Destroy (Last created special effect)
              • Item - Remove (Item carried by (Triggering unit) in slot 1)
              • Wait 0.10 seconds
              • Hero - Create Upgrading_Item[((Integer A) + 6)] and give it to (Triggering unit)
              • Player - Add (Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))] x -1) to (Owner of (Triggering unit)) Current gold
              • Player - Add (Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))] x -1) to (Owner of (Triggering unit)) Current lumber
              • Skip remaining actions
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item level of (Item being manipulated)) Equal to 3
                • Then - Actions
                  • Game - Display to (Player group((Owner of (Triggering unit)))) the text: The item is at its ...
                  • Skip remaining actions
                • Else - Actions
                  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                    • If - Conditions
                      • ((Owner of (Triggering unit)) Current gold) Less than Upgrade_Item_GCost[(Player number of (Owner of (Triggering unit)))]
                    • Then - Actions
                      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more gold.
                      • Skip remaining actions
                    • Else - Actions
                      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                        • If - Conditions
                          • ((Owner of (Triggering unit)) Current lumber) Less than Upgrade_Item_SCost[(Player number of (Owner of (Triggering unit)))]
                        • Then - Actions
                          • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You need more spiri...
                          • Skip remaining actions
                        • Else - Actions
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Maybe you can try this way, not sure if this will work when the other doesn't though.

  • Item - Create Tome of Experience at (Center of (Playable map area))
  • Hero - Give (Last created item) to (Triggering unit)

If this still doesn't work try to make your unit a hero with changed model/armor/life/zero states/whatever you want to change and then try it again.


If the unit has no items, add this actions BEFORE the loop.

  • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • (Number of items carried by (Triggering unit)) Equal to 0
    • Then - Actions
      • Game - Display to (Player group((Owner of (Triggering unit)))) the text: You don't have any ...
      • Skip remaining actions
    • Else - Actions

And about the gold and lumber, add another If/Then/Else before the single gold and lumber and say there "if ... don't have enough gold AND if... don't have enough lumber"


Now just as a after thought, do you like those floating texts ?
You could make this use skills instead of texts.
For example,
When your unit aquires Item[1] give him Skill[1].
I think this will look kinda better and coolor but don't count me, its your desicion :p

There's even a ability that costs gold and lumber, I just don't remember which one it is.

[Edit] Ok I found the ability, it would work perfectly for you.
Its called 'Charge Gold and Lumber' and its in the netural hostile abilities.

If you use this, you will need a much simpler trigger.
It would check what item was inserted and give the ability you need.
No need for tooltips since they are inside the ability itself.
Then when a unit uses that spell, it will automaticly check if he has the gold and lumber and if he does, you remove the items he has and give the next item.
Then it will automaticly add the next level ability because he aquired the next item.
You don't even need the special effect because you can make it inside the ability.

I usually prefer making spells as much based on blizzard abilities as I can, because they never bug or do any problems, but again, its your desicion.
 
Last edited:
Level 36
Joined
Jul 22, 2004
Messages
1,002
That's an interesting thought and I would like to try implementing that. However, I would like the floating text to appear at the same time. Do you know of any way to increase the floating text size but still make the text appear all in one line instead of multiple lines like it does so right now.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
Yes it would look stupid, it wasn't the first solution I suggested.
If the others don't work for some unknown reason, you don't really have any choice, though.

As for implenting it.

You would set your item variable exacly the same way (don't touch it).
You can delete the strings and integers.
Make abilities based on "Charge Gold and Lumber", each ability for each item. You can now easly change the costs and strings through the ability.
Now instead of the strings and integers you had before, set a Ability variable with array to all your weapon abilities.
And then, just change your loop to say something like "If item... equal to (Item_Variable[Integer[A]])" "Then Add/Remove (Ability_Variable[Integer[A]]) from triggering unit".

Notice the bold part.
This is for acquires/loses an item. If the unit acquires it, give the ability, if he loses, remove the ability.
 
Level 29
Joined
Jul 29, 2007
Messages
5,174
I don't know whats EOTA but since your having problems ill just make it for you.

[Edit] Ok, this is super weird.

The problem is not giving the item to your unit. The problem is that the game won't accept to create the item you want.

I moved stuff and changed things but it wouldn't work for some strange reason... possibly a bug in WE ?
 
Last edited:
Level 29
Joined
Jul 29, 2007
Messages
5,174
I don't know sorry.

You may try to ask in the JASS forum since they usually know more then us GUI users.

And just in case you want the ability-based triggers, I made here a small template (with only fire/wind, without texts and stuff).
 

Attachments

  • Item Upgrading System (bugged).w3x
    18.4 KB · Views: 27
Status
Not open for further replies.
Top