• 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.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 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,650
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,650
  • 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,650
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