Food upkeep for units

In another thread OliverFA_306 said...

For me personally this is very important because I am implementing food upkeep for soldiers in my Population mod and only champions have access to A_ADDITIVE tags, so I am making every single unit a champion, and it would be great to find a way to (almost) automatically make the AI clean fatally wounded (false) champions.

Interesting.... have you made food a global resource to do this?  And units all reduce the global food resource?

2,667 views 1 replies
Reply #1 Top

First of all, thanks for asking :D

I have been evaluating this idea for many days. At first I tried to make health regeneration cost population, and it passed through different stages until I found something doable that can be interpreted as similar. I will explain (*):

1 - Create two resources: FoodUpkeep and Cities. Both not stored not global and not shared.

2 - Each unit in the army produces a resource of the type A_ADDITIVE_FoodUpkeep. For example, it can be added to the "Blood_xxxx" abilities.

3 - Each city produces an A_ADDITIVE_Cities resource so we know how many cities there are in the nation

4 - Then each CityHub have access to two "variables" (local unstored resources) that say how many upkeep there is and how many cities share this upkeep. I divide the Upkeep among the cities and substract the resulting number from the city's food. And it works!

(*) Actually there are some intermediate steps and issues, but wanted to make the explanation as simple as possible. Those are the issues:

5 - A_ADDITIVE only works for Champions. It does not work for normal units. That's why I am making every unit a champion

6 - Placing A_ADDITIVE_Cities in every hub works fine for the first hub, but it gets broken after the first level up. That's why I have placed it in the Conclave, Town and Fortress improvements

7 - There is no way to scale a resource produced by a unit depending on the soldiers in the unit. For that reason I just multiply the upkeep by the highest group trainable by the player.

But even with those issues I believe the result is pretty cool.

I can upload the mod as soon as there is a working version if you are interested, I'll just make clear it's a very early version. In fact I'll try to upload the finished part about using population to run buildings this weekend.