Making the city defenders faction specific and not race specific?

By on June 27, 2013 6:21:43 AM from Elemental Forums Elemental Forums


Join Date 03/2013

Is there a way to change the types of units that are present when you attack cities?


If I understand correctly, it's done through improvements, but can it be made faction specific? Currently each race has their own set of defenders which are pretty much identical. What if I wanted to change the city defenders for just that faction?

Locked Post 5 Replies
Search this post
Subscription Options

Reason for Karma (Optional)
Successfully updated karma reason!
June 27, 2013 6:55:42 AM from Elemental Forums Elemental Forums

As far as factions are concerned, I'd think you'd have to make relevant improvements specifically for that faction.  Example, you'd need to make an Elf_Armory to 'replace' the K_Armory.  However, this gets very tricky, as said improvements are tech dependent, and also faction dependent (Kingdom versus Empire).  Hence, you'd need to make a third Faction/Allegience (say, Foundationists) to make the change factionwide.

That being said, if we are just talking a new race though, that is either Kingdom or Empire, I'd think it'd be quite a bit easier.

Note that CityDefenders are called out in the unit.xml Note examples:

    <UnitType InternalName="Unit_CityDefender_Mancer">
    <UnitType InternalName="Unit_CityDefender_Tarth">

etc. etc. etc.

Most stats are called out by the equipment they wear, as all units regardless of race usually start with the same base values, with racial differences called out by:




(so the game knows this unit is only for Tarthians)


So, if you've defined your racial bonuses under Blood_Elf or whatever, the SelectedAbilityBonusOption should pull up your racial specific bonuses.  I'd suggest simply copying one of the City Defenders files, modifying it for your race, saving it to a new <Units> file, drop it into the mods folder and give it a spin.  Make it sufficiently different so you can immediately tell if your change took (i.e. give them axes instead of clubs).

    <UnitType InternalName="Unit_CityDefender_Elf">

    <UnitType InternalName="Unit_CityArcher_Elf">

The City Defender and City Archer files should call up your new, race specific unit, as long as you've used the above format.

If for some reason, your city defender units started with more hit points or something, using the <UnitLevel> entries should be able to accomplish that.  Note that each unit now has 20 entries for that.  You could also call out a <SelectedAbilityBonusOption> with an ingame trait/ability instead, if you wanted to, say, add 3 to defense or whatever, and the the current ingame trait gets you what you want (saves the trouble of changing/adding 20 level entries).

Or, if your Blood_Race def already includes your desired modifier, that works too.

You also may need to modify your Race file, to make sure the game needs to, as an example, look for Elf units instead of Tarthian units.  This can get tricky sometimes, though.  I'll let those who understand custom races comment on that regard, or just look at the Children Of The Storm or similar mod files for ideas...




Reason for Karma (Optional)
Successfully updated karma reason!
July 1, 2013 1:18:48 AM from Elemental Forums Elemental Forums

Yeah it looks like I may have to create an entirely new race geared for that city to defend it with specific units. The only other viable alternative is to get more improvements that are faction specific, and that does not solve the fact that existing improvements are there already.


My original intention was to create a set of faction improvements where the defenders would scale with technology, but that does not appear possible right now.


Thanks for the advice. +karma.

Reason for Karma (Optional)
Successfully updated karma reason!
July 3, 2013 1:39:16 AM from Elemental Forums Elemental Forums

It should actually possible to make an entirely new tech tree, although I haven't tried extensively modding techs/adding trees recently in E:LH. 

Back in the E:WOM days, Heavenfall and others messed with this quite a bit.  I actually have a THIRD tech tree that I was working on, but that is for E:WOM.  It was mostly the same as the Kingdom tree, but back then we had five subtrees/disciplines, not three, and I was consolidating that to four disciplines. 

The fifth subtree tree was repurposed to allow you to reallocate research to gildar production or unit production.   It took some work, but was working great EXCEPT along the improvements line, which are dependent on tech prereqs.  So I was needing to make new improvement files (copy, paste, edit code for said improvements  to point to the new tech tree essentially).  All in all, a lot of work, and since E:WOM is now abandoned, and E:LH interests me, I never felt the need to finish it up, although I played with it a bit recently.

With FE and LH, they consolidated the Empire and Kingdom tech trees (used to have two separate trees), but I would think that you could still build a separate tech tree.  Of course, some functionality has been deprecated since the E:WOM days, so there could be issues with this.  That being said, look at some of the more extensive mods and study their code.

There was a Doctor Who mod back in the day for E:WOM.  If that is still downloadable, it might not be a bad place to study how to mess with the tech trees.

I'll leave this for the more savvy among the current modders to comment r.e. whether a new tech tree is still in the cards or not.  There have been a LOT of simplifications since E:WOM.  Sometimes simple is better, of course, but I still think we could have had both...


OK, WITH that diatribe, let's be clear what you are talking about.  Are you talking about City Defenders that gain weapons based on the current tech, or something else?  Because I think at least one modder has the upgrade tree working for city defenders (i.e. they have the latest weapons available).  Or at least I remember reading it anyways, I've had my head buried in my own mods that I need to get out of my system.  I've done something along similar lines with some quest units.

But if you are talking about entirely new units showing up as city defenders, that gets a little more tricky.  Even then, though, I think it would still be quite possible.  Essentially, reading the code, I see for city hubs that more defenders are added based on the city size.  I'd imagine that you might be able to interpolate that to other structures, the Guardian Idol/Statue might be a good place to start for ideas (it adds a Guardian to your defenders).

As for making this 'unique' to a race, hmmmm... I think you are looking at building a new faction entirely, but again if you have the earlier games (read E:WOM), there might be some ideas buried in the code there.  And Heavenfall's mods are pretty extensive, so I imagine he's done some of this in his mods.

I haven't test driven Children of the Storm, because I'm still trying to balance my mods with Vanilla E:LH.  Lots of good stuff in there, though... definitely worth the download!


A third way to do this is to keep the existing tech trees, but create some new faction specific techs that are not tech tree dependent.  Example: Tech_ElvishStuff.  Then you add some new structures that exist alongside the existing ones, with ElvishStuff as a prereq.  Structures can have multiple prereqs, so you could, for example, require both Mounted Warfare and Elvish Stuff in order to be able to build the Elvish specific structure.

Then, when you create your new race (Elves), Add Tech_Elvish Stuff to their Blood Ability or whatever, and any structures, items, etc. that you list Elvish Stuff as a prereq for will only show up for them.

You could carry this one step further, and create a third faction (we talked about this in another thread).  Said faction, as mentioned above, has their own structures, which have the 'usual' tech prereqs with the faction specific tech being an additional one.  I mentioned this before in another thread I think, and as I said, there are a few other modders have a lot more experience in this regard.  I'm sure they would be willing to give suggestions at least.


At least that's my take on it.  I'm sure Heavenfall, Parrotmath, etc. can comment on this further.  Looking at the starting abilities we have now, you'll see where certain races/background picks have specific spells, techs, etc. that belong to them only.  Arcane Monolith is a good example of this.


Hope this helps!

Reason for Karma (Optional)
Successfully updated karma reason!
July 3, 2013 7:12:13 PM from Elemental Forums Elemental Forums

Theoretically it does not appear to be much different than GC2: Twilight of the Arnor.


1. The default tech tree is the Amarian


2. I suspect that in the next expansions, if it follows GC2, each of the races will get their own distinct tech trees, and likely improvements giving each faction a distinct feel, not just the kingdom vs empire type of feel


3. Seeing that the improvements link to their respective technologies and prerequisites, it should not be hard to create a separate set of improvements for a given faction


4. There is a function out there to create tech with the latest weapons




It is already in the default slot and I presume upgrading would be the same for the other slots of equipment.


5.I agree that building a new faction seems like the way to go.


6. I think that creating a 3rd faction type would have it's own implications. I am not sure about diplomacy and art, but I suspect that they would need their own models, and other thins, like flavor text. I'd have to explore what is hard coded and what is not.


Thanks again.



Reason for Karma (Optional)
Successfully updated karma reason!
July 3, 2013 7:31:39 PM from Elemental Forums Elemental Forums

I believe it is actually the tag <Class>CityDefender</Class> on a unit that makes it be spawned as a city defender. I'm not sure if it chooses based on race or faction.

I have experimented with creating a third Allegiance but right now in FE and LH the amount of environments is hardcoded, which is the big reason it's impossible.

For Clarity's sake Factions like Altar and Yithril are the teams you play as, they get faction traits like Enchanters. Races like Amarians and Trogs are the type of unit that makes up a faction and they determine what your units look like and your blood trait. Allegiances are the political views of your faction and are divided between Kingdom and Empire.

Reason for Karma (Optional)
Successfully updated karma reason!
Stardock Forums v1.0.0.0    #108433  walnut3   Server Load Time: 00:00:00.0000234   Page Render Time: