since I want this to be an upgrade, it has to be normal at first, and very low when upgraded.
That part is clear (what you wish to execute).
What I do not understand: why it is important to preserve trees when gathered by human peasants?
Example: I did give better health for trees in my mod, originally all were 50, became 60 - 100, so they last longer from 20-100% which also means more lumber can gathered from the same ammount of tree doads before the forrest cut down.
So
1. Execution was:
1.1: increase health of trees.
2. Goals was:
2.1: preserve trees longer, by that:
- keep the gathering distance (units need to move to deliver gathered trees) for a longer time short around starting position
- keep the tree walls longer around settlement to block attacks
- increase possible ammount of tree res. what can be gathered
- decrease the neccesity of relocation/ additional bases because of tree res. needs
2.2: make trees stronger to witstand attacks from artillery (and partly other attacks/ abilities)
Near that there are also a new upgrade which improves the ammount of wood gathered with +5 for humans, so with all upgrades they can deliver 35 instead of 30 (for the same damage to trees by the way). -> for that there is UpgradeMetadata, VS for damage tree there is not.
What are your goals (purpose)?
And reason why affect just humans?
I struggle myself much with abilities, see here:
Basic (existing) abilities and spell modding (data fields) in MPQ
The problem is:
- there are quite limited variety what upgrades can grant directly - stored in UpgradeMetadata.slk (damage to trees not among them)
- even when you wish to add some of that you cannot WHEN that upgrade grants an ability (only ability added other data neglected)
In your case:
What you wish to change IS an ability, not an upgrade.
Upgrades can grant abilities, but all data called from the ability itself.
Problems:
- have no clue abilities can be replaced or not with a different one via upgrades (90% chance to not)
- there is not a single example when an unit ability have levels (opposed with hero abilities)
Possibility:
Triggers can disable abilities on the map level.
Probably can enable a different one (if you create a different ability first based on that) -> but have no clue how to bond it with an upgrade -> better to ask in the trigger section.