Maintenance modifier issues ... any help or suggestions?

Mercury002

Chieftain
Joined
Dec 6, 2014
Messages
30
Location
UK
I was creating a civilisation / sponsor mod (don't worry it all works well, fine and dandy). Within this mod I was focusing on adjusting the maintenance modifiers of several different aspects and I noticed a couple of issues, possibly with the way the game has been built or a lack of modifier options.

First I noticed that if you add a maintenance modifier within the traits, it will nullify anything similar placed within the player perks i.e:
<Traits>
<Row>
<Type>TRAIT_XXXXX</Type>
<Description>TXT_KEY_TRAIT_XXXXX_DESC</Description>
<ShortDescription>TXT_KEY_TRAIT_XXXXX_SHORT</ShortDescription>
<LandUnitMaintenanceModifier>50</LandUnitMaintenanceModifier>
<!-- +50% to land unit maintenance cost. -->
<NavalUnitMaintenanceModifier>50</NavalUnitMaintenanceModifier>
<!-- +50% to naval unit maintenance cost. -->
<ImprovementMaintenanceModifier>-25</ImprovementMaintenanceModifier>
<!-- -25% maintenance cost of improvements. -->​
</Row>​
</Traits>

This will nullify the player perks:
<PlayerPerks>
<Row>
<Type>PLAYERPERK_XXXXX</Type>
<Description>TXT_KEY_PLAYERPERK_XXXXX_DESC</Description>
<Help>TXT_KEY_PLAYERPERK_XXXXX_HELP</Help>
<RouteMaintenanceMod>-100</RouteMaintenanceMod>​
</Row>​
</PlayerPerks>
<!-- No maintenance for roads and magrails. - overridden by trait so dont use.-->
<PlayerPerks_GeneralBuildingEffects>
<Row>
<PlayerPerkType>PLAYERPERK_XXXXX</PlayerPerkType>
<BuildingClassType>BUILDINGCLASS_NETWORK</BuildingClassType>
<MaintenanceChange>-1</MaintenanceChange>​
</Row>​
</PlayerPerks_GeneralBuildingEffects>
<!-- No maintenance for networks. - overridden by trait so dont use. -->

The aim of this set of perks (taken from a quick example / proof of concept mod) was to decrease the cost of tile improvement by X% (25% in this case) and then in the perks to make roads, magrails and networks free, however if the trait is removed they are free but improvements cost the full amount, if the improvement is left in it ignores the player perks that conflict completely and makes both the improvements and roads maintenance etc 25% cheaper instead of free.

This would appear to be due to some kind of conflict between the two as they can affect each other, I would like to know if there is a different trait I could use that would do the same thing but for just improvements and not roads etc (I looked and couldn't find anything any input would be nice) or if possible change the priority order, between perks and traits, that would fix this issue.

Secondly the aim is to increase the maintenance cost of land and naval units (not just military units) which works fine. I would add orbital units but there is no maintenance option for orbital units (although in real life there is even if its maintenance of ground equipment) they should have included an option for orbital maintenance and just left it at default -100 so its free.

I also noticed that units maintenance changes over time as well as with the amount of units, this would suggest that there is some form of time modifier but I have been unable to find any trace of this let alone any player perk / trait that would adjust this.

All I can say for this is HELP HELP HELP.

At the moment I have changed the trait to:
<ImprovementMaintenanceModifier>-100</ImprovementMaintenanceModifier>
<!-- -100% maintenance cost of improvements. -->
this gives all improvements free maintenance but this is a bit over powered for what I wanted.
 
This would appear to be due to some kind of conflict between the two as they can affect each other, I would like to know if there is a different trait I could use that would do the same thing but for just improvements and not roads etc (I looked and couldn't find anything any input would be nice) or if possible change the priority order, between perks and traits, that would fix this issue.
Only the traits that are in the database will (hopefully) work. Even some of them might not work if they are leftovers from Civ5 but if you try to add your own trait, you'll have to add code for it, and adding code for a trait with Lua alone is not easy. Changing the priority order would most probably require dll access.
What you might be able to do is design a perk that changes maintenance and use Lua to give that perk to your sponsor at the start of the game, but i haven't looked at what's possible with perks a lot so maybe there is no such option.
I would add orbital units but there is no maintenance option for orbital units
Don't know, didn't look at orbitals at all.
I also noticed that units maintenance changes over time as well as with the amount of units, this would suggest that there is some form of time modifier but I have been unable to find any trace of this let alone any player perk / trait that would adjust this.
Civ5 already used this "inflation" system. Basically there are a few entries (i think in defines table) that control how fast it will grow but it will always grow as time passes. Little you can do about it short of changing all units to use a flat maintenance cost. I know it should be possible as some moders did it with Civ5, but i'm not sure how they did it.
 
Thanks for the feedback. I am slowly building mods to see how far I can go and as such am trying something different each time, starting from adding a building, then unit, then civ, then trait and I added perks but noticed this problem when I first tried something more advanced with perks. As you can see I start in XML but I then try it again in Lua (which I haven't done yet with the perks, as this seemed like a complex problem).

There are some time factors that I have found so far but they don't relate to this aspect of the game so I'll start again and search for inflation, or similar, instead. Might also look at those Civ 5 mods that did the same sort of thing, Just got to find them too (its been a while since I modded civ5).

As for adding orbital maintenance, I think I may have to create a separate mod to include it, perhaps buy making orbital units produce something (like an imaginary building called maintenance) at a cost of x energy per turn ... haven't really looked at it at all yet.
 
As you can see I start in XML but I then try it again in Lua (which I haven't done yet with the perks, as this seemed like a complex problem).
Well, XML and Lua are for totally different things. XML (or you could use SQL) will alter the game data so you basically change values from 1 to 2, activate some built-in features and such. Lua allows you to actually add lines of code so you can (to some extend) add entirely new functions to the game. Sometimes if you try to add something in the database that the game does not understand, you can use Lua to tell the game how to use it.
Final step would be modding the very game code contained in the dll with C++ coding but the source code for the dll is not out yet.
There are some time factors that I have found so far but they don't relate to this aspect of the game so I'll start again and search for inflation, or similar, instead. Might also look at those Civ 5 mods that did the same sort of thing, Just got to find them too (its been a while since I modded civ5).
I don't know exactly how inflation was calculated inCiv5 as it was in the C++ code and i only got some very superficial looks at that code with close to zero C++ knowledge but basically it increased with number of units and with time, but i don't think it was a simple x% increase over time so you probably won't find this. I think those values are probably related to inflation calculation.
From the defines table :
UNIT_MAINTENANCE_GAME_MULTIPLIER|8
UNIT_MAINTENANCE_GAME_EXPONENT_DIVISOR|7
I think there was something in HandicapInfos for Civ5 but can't find it in the BE database. HandicapInfos is still where the :c5production: maintenance is defined.
ID|Type||ProductionFreeUnits|ProductionFreeUnitsPerCity|ProductionFreeUnitsPopulationPercent
0|HANDICAP_SPUTNIK|…|7|3|50
1|HANDICAP_MERCURY|…|5|2|50
2|HANDICAP_VOSTOK|…|5|2|50
3|HANDICAP_GEMINI|…|5|2|50
4|HANDICAP_SOYUZ|…|5|2|50
5|HANDICAP_APOLLO|…|5|2|50
6|HANDICAP_AI_DEFAULT|…|7|3|50
As for the mods : the Communitas mod (one of the big ones with it's own sub-forum) did it at some point but i'm not sure the last version still had this.
As for adding orbital maintenance, I think I may have to create a separate mod to include it, perhaps buy making orbital units produce something (like an imaginary building called maintenance) at a cost of x energy per turn ... haven't really looked at it at all yet.
Well, you could add "Satellite Uplink" buildings that do cost maintenance and produce 2 units of "satellite control" a strategic resource that's required by satellites (buildings could do that in Civ). More than 2 would probably require you use UFOs navigation computers ;)
 
Thank you, you have been so helpful

This is why I love the Civ community forums. If you get stuck, no matter how stupid a question you might have, someone always seems to help. My turn to do my bit for others if I can :)
 
Back
Top Bottom