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

Change cost of item via trigger

Status
Not open for further replies.
Level 16
Joined
Mar 27, 2011
Messages
1,349
You can set ALL items to increase in value after being bought by a percentage. Within:

Advanced - Gameplay Constants - Inventory - Sell Item Return Rate

By default it's set to 0.5 (you get 50% back of what you paid). Setting this to something above 1 will give you more than what you paid for it.
 
Level 13
Joined
Oct 18, 2013
Messages
691
Afaik, you can't increase the listed cost of an item. After the first sells, you'd have to replace it with the newer, more expensive each time upon purchase.

It's That or make a trigger that checks to see if they have the extra 500 gold for the 2nd item (which is kind of an awkward solution)
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
I think you'll need to trigger the cost of all items. This can be tricky because there's no way to change the item's description (so you can't say the price in the item title). In my example map I use "200 + (100)" to list the price. Meaning 200 + 100 x number of items bought. You could find a way to make it easy for players to understand how much an item costs.

You need to create "dummy" items that get used automatically when bought, just like a tome. Make a trigger that checks if the unit has enough gold to buy the item, then give them the item.

  • Init
    • Events
      • Map initialization
    • Conditions
    • Actions
      • -------- Claws of Attack --------
      • Set ItemCost[1] = 200
      • -------- Add More items below --------
  • Buy Item
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-class of (Item being manipulated)) Equal to Powerup
    • Actions
      • -------- Checks what item was bought --------
      • -------- Checks if player has enough money --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item being manipulated)) Equal to Claws of Attack - |cffffcc00200 + (100)|r
          • ((Owner of (Triggering unit)) Current gold) Greater than or equal to ItemCost[1]
        • Then - Actions
          • -------- Checks if unit has an empty slot to hold the item --------
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Number of items carried by (Triggering unit)) Less than 6
            • Then - Actions
              • Game - Display to (All players) for 5.00 seconds the text: (Cost: - |cffffcc00 + ((String(ItemCost[1])) + |r))
              • Hero - Create Claws of Attack +12 and give it to (Triggering unit)
              • Player - Set Player 1 (Red) Current gold to ((Player 1 (Red) Current gold) - ItemCost[1])
              • Set ItemCost[1] = (ItemCost[1] + 100)
            • Else - Actions
              • Game - Display to (All players) for 5.00 seconds the text: Inventory is full
        • Else - Actions
          • Game - Display to (All players) for 5.00 seconds the text: You don't have enou...
Edit: You can replace the items like mentioned above, but you can only realistically increase the cost of items once of twice this way. Too many custom items in a map sounds like a bad idea to me. But you can use any method you feel works best for you and your map.
 

Attachments

  • Item Cost.w3x
    17.9 KB · Views: 50
Level 12
Joined
May 20, 2009
Messages
822
I've been thinking of a way to do this that will maintain the in-game UI, and I think the best solution is to base an ability off of Charge Gold & Lumber and give it as many levels as you want the cost to increase. (Want it to increase by 1, 200 times? Give it 200 levels. Want it to increase by 10, 10 times? Give it 10 levels) This does come with some problems like increased loading times, but using Widgitizer should resolve it. Using some kind of macro automatically fill all the data for the levels would be the easiest solution for really high levels.

Give it all the proper UI set up as the item you want (Icon, Gold cost, description, etc). You're going to have to manually trigger "Nearby Patron" and then check when the corresponding ability to the item is used, then you just add the item of choice in the unit's inventory after the ability is used and then set the level of the ability to +1 to increase your cost.
 
Level 16
Joined
Mar 27, 2011
Messages
1,349
(Want it to increase by 1, 200 times? Give it 200 levels. This does come with some problems like increased loading times, but using Widgitizer should resolve it.

If there aren't too many items in the game or tomes which get spammed requiring 500+ levels, this would be a nice way to implement the feature. I'm not familiar with "macros", but it could solve the data entry problem.
 
Last edited:
Status
Not open for further replies.
Top