some really really strange bugs related to gold costs
Actually, this is not a bug with your unit data.
Most people do not notice this, but there is not simply 1 list of Standard Units on Warcraft 3. Actually, there are many lists. This was true ever since Frozen Throne in 2003.
In particular, Frozen Throne back in the day was very serious about preserving custom games support perfectly. To accommodate this, they wanted a system where:
- Blizzard could update the balance of units -- hp, gold cost, etc -- for melee versus competitive play
- The custom games remained perfectly the same and ignored balance changes. That way, in a really hard map with exact numbers -- maybe a map that can only be won by dealing exactly 425 damage to some Standard Unit with 425 hit points, using some trigger that stops at 425 -- it would nevertheless be the case that a balance change to give this unit 450 hit points doesnt apply in custom game mode.
And this is how it came to be that the Standard Units diverged. Internally in the game, there is a frozen "custom" copy of the data that always mirrors Frozen Throne Patch 1.07 from 2003, and there is a balance-oriented "melee" copy.
These two copies have diverged for over 20 years. In particular, some of the most obvious differences are:
- In the "custom" copy, the Tavern sells 5 heroes. In the "balance" copy, the Tavern sells 8 heroes.
- In the "custom" copy, a Gameplay Constant called "Use Relative Upgrade Costs" is turned off. This causes the Gold Cost of Keep unit-type to be the price the user sees when clicking the Keep icon on the Town Hall.
- In the "balance" copy, the setting above is turned on. This means that the "Stats - Gold Cost" of Keep is interpreted as the new total full price of the unit.
The consequence of this data split is that when you develop your custom units, the map decides it is a "custom game" and jumps to the frozen "custom" Patch 1.07 data. And then you change "Stats - Gold Cost" and expect this is the full price of an upgrade. Suppose you have a custom unit called "Building One" that costs 100 gold. Suppose that "Building One" upgrades to "Building Two" and the cost of "Building Two" is set to 25 gold.
When you create these units in the custom mode, everything works as expected. You pay the full price of 125 gold to complete "Building Two," that is to say you first pay 100 gold and then afterward pay 25.
Now, if you rip out the exact unit data from your custom map and dump it into a melee map without actually using World Editor to modify the melee map, what happens is that the melee map never updates its status to "custom." Accordingly, the default Gameplay Constants for the relative upgrade cost setting are different in this melee map that in the map where you originally made your units.
So, now, "Building One" costs 100 gold to make but "Building Two" will cost
negative 75 gold to produce because the relative upgrade costs are enabled and in this mode the "Stats - Gold Cost" of 25 that you selected is interpreted as the new
total cost to construct a "Building Two".
This has a complex explanation but an easy fix. Before injecting your units into a melee map,
open the Melee map in World Editor and go to "Scenario > Map Options" and change "Game Data Set" from "Default" to "Frozen Throne Custom v1.07".