Thanks for the answer Heavenfall
I'll try to give more details about what I am trying to do.
I am modding the use of resources trying to make it more strategic. So far I have modded population in cities to really mean something. In my mod each improvement uses population and city hubs don't produce resources in a flat rate, they produce resources per person. So the result is that if you don't have enough population to run all the improvementes in a city there is a penalty to resources production, and that if you have extra population it will result in a moderate extra resources production. At least that part works well
Now the next step is to make units use population too. Each unit would use a food permanently. So if you have 30 soldiers (grouped in several units) and one city, that city has 30 less food. With 2 cities they have 15 less food each, with 3 cities they have 10 less food each and so on.
I have tried several approaches, but had to discard all of them. And now is when things are becoming complicated, as I am trying more and more strange things to try to overcome engine limitations and obtain the effect I want.
My current attempt involves a global resource provided by the sovereign and each unit requiring one of those resources to be built. The result is that this resource provides a way to know how many trained units the player has. For example, if the sovereign provides 1000 units of that resource, and there is one scout built, the new total is 997. If I could read that number from a city hub and substract this number from 1000 I would know there are 3 trained units consuming food. Then I would have to divide that number by the number of cities and substract that from the city food.
But it doesn't work, as I have no found a way to read global resource values from an improvement.
For cities I have use A_Additive_CitiesNumber as you suggest, but for units I can't do that, as the soldiers count is made at the unit level not at the improvement level, and the resources produces by units do not scale with people in the unit. The only thing that gets scaled by people in the unit (that I know) is the production requirement and that's what I am trying to use such a complicated system.
And here is where I am stucked.
If I can't solve it I will just go with an approximation and assume all units are always 3 people units. Better this than nothing.
Ok, that was a long text. Sorry for being so boring