New City Defender.

Joined
Jan 10, 2019
Messages
1,851
How can I make my newly made cannon for Renaissance ranged City Defender? Do I have to make a separate unit mod/file for it?
Cannon in action.jpg

I saw Units.artdef of standard game and noticed that some units also have 'city defender' versions. Do they use 'gameplay.xml' to function?
 
How can I make my newly made cannon for Renaissance ranged City Defender? Do I have to make a separate unit mod/file for it?
I created a separate mod that handles all the new units I've added to the game that I want to use as city garrisons, though I imagine you could add it to your own new unit mod's artdef w/o creating a new mod. You'll just need to copy over the section under the "UnitGlobals" collection and then change the "GarrisonDefenseUnit" "m_ElementName text" to whatever your unit is defined as - "UNIT_XXXX" under "ERA_RENAISSANCE".
I saw Units.artdef of standard game and noticed that some units also have 'city defender' versions.
That's something new that was added with the update accompanying the Gathering Storm release. I didn't look at it too closely, but both regular and "CITY_DEFENDER" units appear to function identically and utilize the same elements, so I'm unsure what the purpose was behind the change. In any event, you can enter your unit as it is defined and it will work properly.
Do they use 'gameplay.xml' to function?
Not sure what file you're referring to here. The garrison unit's (i.e. city's) attack strength and defense strength are calculated based on the regular unit stats of units you've built and whether they're currently stationed in the city, whatever they might be. The actual unit graphic used for the garrison is based on era and is visual/cosmetic only. It has no effect on the city's stats.
 
Not sure what file you're referring to here. The garrison unit's (i.e. city's) attack strength and defense strength are calculated based on the regular unit stats of units you've built and whether they're currently stationed in the city, whatever they might be. The actual unit graphic used for the garrison is based on era and is visual/cosmetic only. It has no effect on the city's stats.
That is partly true. Because if you start the game in a later Era, the ranged strength starts at a preset level. For e.g. it's 25 in the Medieval Era, even if you lower ranged combat strength of Archers.

If someone could find out how to change that, I'd be grateful.
 
Last edited:
That is partly true. Because if you start the game in a later Era, the ranged strength starts at a preset level. For e.g. it's 25 in the Medieval Era. If someone could find two to change that, I'd be grateful.
It's a bit different if you start in later eras since there has to be a minimum value for city defense. If you want to modify that then you need to change the values per era in the 'StartingRangedStrengthMajor' and 'StartingRangedStrengthMinor' columns of the 'StartEras' table. These values currently correspond to the highest base game ranged attack value of units available (i.e. free units you begin with) at the start of each era. Which makes sense since the city ranged strike value equals the highest ranged attack value of whatever units you've built.

You can also attach a modifier to a building, for example, that will add a bonus to these values using the 'EFFECT_ADJUST_CITY_RANGED_STRIKE' effect, which I've done as part of my infrastructure overhaul mod.
 
Last edited:
These are lists of XML Files in the base game, one affects units gameplay (and there's a coding pattern to make overriding files), but i can't find the others that relates to city defenses
upload_2019-12-8_8-46-28.png


I'm talking about Units.artdef entries that has CITY_DEFENDER suffix shown here
city defender Units.artdef.jpg

Do I have to do extra codings elsewhere or create an extra XML files for it?
 
There is no UNIT_INFANTRY_CITY_DEFENDER showing anywhere in any of the game's xml files. Not under the Gameplay folder or elsewhere. Nor in any of the expansions.

I did not do a search through the SDK or "assets" folders but my guess is these designations are only relevant for the purposes of animation.

At least as far as actual Gameplay code loaded into Gameplay Database tables like <Units> or <Types> you should not need to add anything additional in such tables in order to get the game to recognize your unit as being available as a "city defender".
 
so 'City Defender' is just a code suffix added if graphical representations of city defense unit is to show up right?
For example in the middle ages if I want pikeman to be graphical representations of city defense of that era then just copy Pikeman entry and add CITY_DEFENDER suffix both under Units and UnitMembers directory. right?
 
I created a separate mod that handles all the new units I've added to the game that I want to use as city garrisons, though I imagine you could add it to your own new unit mod's artdef w/o creating a new mod. You'll just need to copy over the section under the "UnitGlobals" collection and then change the "GarrisonDefenseUnit" "m_ElementName text" to whatever your unit is defined as - "UNIT_XXXX" under "ERA_RENAISSANCE".
.

Are you referring to this one?

city defender units2.jpg


And what is 001 suffix shown AFTER UnitGlobals?
 
Top Bottom