HF or Sean - Is it Possible to Mod the XML to Make City Militia Always Use Leather Armor?

Inspired by Sean's City Defense post, it got me thinking. Is it easy to mod the game such that, when a faction obtains leather armor and wooden shields, to have their city defenders always use leather and wooden shields (instead of nothing)? I would not want later upgrades like chain and plate or any magic items to apply. My logic here is that:

  • Balance early game to make rushing difficult - leather armor should do the trick
  • Since leather doesn't require special resources such as crystal or metal, it makes sense the faction could support their militia with leather
  • Mid and end game should be fine since the player at that point should have upgraded weapons to overcome the leather armor defenders

I was thinking of modding the values and do some testing.

Ideally a seige counter time, maybe depending on city size (i.e. level 5 would require 5 turns of seiging to attack) but since we are in lockdown that's probably not feasible. Thanks in advance.

4,959 views 10 replies
Reply #1 Top

Yep, no problem. Just find all the city defender unit types in CoreUnits.xml and add leather armor to them. Keep an eye on their encumbrance.

Reply #2 Top

You can set their default weight capacity to any number to avoid encumbrance.

Reply #3 Top

Many thanks!

Reply #4 Top

Quick question and I apologize in advance for the newb question. If I have two competing Equipment tags, the first is let's say the leather breastpiece for torso, and the latter is some shirt for torso, the latter will override the former? I ask because I couldn't get the breastpiece defense to apply to a city defender but I think I figured it out.

[Edit] Nvm, figured it out. Gonna start with decking the militia out in full leather and wooden shield, may take it down a notch to leather breastpiece only, or breastpiece and greaves. Perty cool and easily done!

Reply #5 Top

There is a function called MaxSum to get the city defenders to be auto-equipped with the latest tech in armor and gear. You can simply set this up for every unit, but change the default gear to include a leather breastpiece. So, once leather researched, they will get a full suit of armor.

Reply #6 Top

Quoting seanw3, reply 6
There is a function called MaxSum to get the city defenders to be auto-equipped with the latest tech in armor and gear. You can simply set this up for every unit, but change the default gear to include a leather breastpiece. So, once leather researched, they will get a full suit of armor.

Gotcha, thanks. I'm testing a full suit of leather and wooden shield at start for all melee militia. I left the archers alone for now and haven't introduced auto upgrade yet. Question - only way I got this to work was edit coreunits.xml and put a copy in mods. If I edited coreunits.xml in default english folder the changes didn't take. Was my approach the correct way to do it?

Reply #7 Top

I always edit straight from the english directory for all these types of files. It shouldn't be a problem.

Reply #8 Top

Quoting AlLanMandragoran, reply 7
Quoting seanw3, reply 6There is a function called MaxSum to get the city defenders to be auto-equipped with the latest tech in armor and gear. You can simply set this up for every unit, but change the default gear to include a leather breastpiece. So, once leather researched, they will get a full suit of armor.

Gotcha, thanks. I'm testing a full suit of leather and wooden shield at start for all melee militia. I left the archers alone for now and haven't introduced auto upgrade yet. Question - only way I got this to work was edit coreunits.xml and put a copy in mods. If I edited coreunits.xml in default english folder the changes didn't take. Was my approach the correct way to do it?

I think your approach is the intended approach that players are suppose to do.

Reply #9 Top

No, editing files and then putting them in the mods folder doesn't work correctly unless they have changed how it works. A lot of different things wont function the right way and other things will be duplicated, etc.

 

You can edit the files straight from the core directory. I don't know why you are having trouble with it. I have edited several core files, including adding armor to all militia units and it works fine.

Reply #10 Top

Alright I'll give it another go. Thanks.