• 🏆 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!

[Spell] How to change an item in shop when it's already bought?

Status
Not open for further replies.
Level 2
Joined
Apr 28, 2014
Messages
14
Hello guys. I've been trying for few hours to solve problem with buying abilities from shop.
All I want to do is that my hero could buy a ability from shop and later he could upgrade this ability via shop at some cost.

So I created a custom shop which has a custom ability and when my hero enters nearby he can successfully buy it. Until this moment everything is fine. But what I want is that when he buys an ability than the same ability upgrades automatically in a shop and my hero lately could buy it in higher level and at cost of some gold or lumber.

So questions is: How I can change ability (item) in shop? :)

P.S. If you can't understand me, ask me I'll try explain as I can. :)
 
Level 25
Joined
May 11, 2007
Messages
4,651
Event: A unit Sells an Item
Condition: Item-Type of item bought == AwesomeSauce
Set item1 = Item of Type of Item Carried in slot 1 - 6 == AwesomeSauce

if (item1 equal to No Item == false)
{
replace item1 with AwesomeSauce Lvl 2
}

Psuedo code but it should work.
 
Level 25
Joined
May 11, 2007
Messages
4,651
  • buys item
    • Events
      • Unit - A unit Sells an item (from shop)
    • Conditions
      • (Item-type of (Sold Item)) Equal to INSERT_ITEM_HERE_MAKE_IT_A_POWERUP_AND_YOU_CAN_UPGRADE_WHEN_FULL_INVENTORY
    • Actions
      • Set Item1 = No item
      • -------- Loop through all the items in the inventory, will only pick one as the item to be replaced --------
      • For each (Integer tempInt) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by (Buying unit) in slot tempInt)) Equal to Claws of Attack +3
            • Then - Actions
              • Set Item1 = (Item carried by (Buying unit) in slot tempInt)
            • Else - Actions
      • -------- Check the item --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Item1 Not equal to No item
        • Then - Actions
          • Item - Remove Item1
          • Hero - Create Claws of Attack +6 and give it to (Buying unit)
        • Else - Actions
 
Level 2
Joined
Apr 28, 2014
Messages
14
My shop is not an unit guys. I think you all know Dota, don't you? At beginning in dota you have to choose a hero, which is stored is some kind of store (I call it shop) the same thing is with my abilities they are at that place as heroes at beginning of dota. I need to know how to change that in game via trigger?
 
Level 25
Joined
May 11, 2007
Messages
4,651
Try the trigger above. It detects when you buy an item from a shop, the Goblin Merchant for example.

When you buy heroes from a "shop" you buy them from the tavern, it's in neutral passive - Buildings.
 
Status
Not open for further replies.
Top