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

[General] Editing sell price

Status
Not open for further replies.
Level 3
Joined
Jan 16, 2023
Messages
14
Hey, I'm playing a mod where you get items in your inventory and throughout the game, the sell price of those items should vary. However the Gameplay Constants->Inventory - Sell Item Return Rate is set to 0.000. This predictably has the effect of selling everything at 0 gold. Can you modify this constant dynamically in-game with triggers? Another issue is that most of these items have Stats - Gold Cost: 0 which also hinders getting gold for selling.
The mod has a tab in "Optional Quests" that says: "The value of items sold in the Town Hall varies depending on the damage your towers deal. To get better values, increase the level of upgrades in your Town Hall. Some towers will make items sell for higher prices than others."
There is a good chance that this is not, or poorly, implemented, but do you guys see a way to implement this?
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,552
I don't think there's a single Gameplay Constant that you can modify via triggers, otherwise they wouldn't be considered Constants.

I can only think of two ways of doing this:

1) Create multiple versions of the same item, each with varying gold costs. Then manipulate the shops via triggers to update their item lists to include/exclude these.

2) Use triggers to detect when you sell an item and add the correct amount of gold based on the item-type of the sold item and the current level of upgrades. This method lacks the standard gold/lumber UI that Warcraft 3 uses, however, you could put the sell price in the item's description or name assuming you're on a more recent version.
 
Level 39
Joined
Feb 27, 2007
Messages
5,016
There are a lot of ways to get like 70% of the way to what you want to do, but the game engine will just not fully let you do what you want:
  • Charge Gold and Lumber can give you gold/lumber when its fields have negative values, and those values can be updated dynamically with the ability integer level field setters to always reflect the current value of a particular item... but in-game those numbers would show as negative on the UI.
  • If you put CG&L on an item, the ability gets put on your command card rather than being bound to the item itself, which is a little weird (even when all you do is replace an existing ability on an activated item with CG&L with no other changes).
  • 6 different CG&L abilities (one to sell the item in each slot) could all inhabit the same spellbook without orderstring conflicts (since CG&L can have its base order changed unlike most abilities). It would be best to simply enable/disable the 6 abilities manually based on what item slots are currently occupied.
  • For some fucking reason "gold cost" is not an item integer field that can be changed in-game so you're just boned there.
 
Status
Not open for further replies.
Top