1. We have added a Gift Upgrades feature that allows you to gift an account upgrade to another member, just in time for the holiday season. You can see the gift option when going to the Account Upgrades screen, or on any user profile screen.
    Dismiss Notice

New City Defender.

Discussion in 'Mod Creation Help' started by Lonecat Nekophrodite, Aug 7, 2019.

  1. Lonecat Nekophrodite

    Lonecat Nekophrodite Prince

    Joined:
    Jan 10, 2019
    Messages:
    466
    Gender:
    Male
    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?
     
  2. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    1,935
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    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".
    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.
    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.
     
  3. Knasp

    Knasp Warlord

    Joined:
    Sep 10, 2011
    Messages:
    262
    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: Aug 9, 2019
  4. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    1,935
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    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: Aug 9, 2019
    Knasp likes this.
  5. Lonecat Nekophrodite

    Lonecat Nekophrodite Prince

    Joined:
    Jan 10, 2019
    Messages:
    466
    Gender:
    Male
    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?
     
  6. LeeS

    LeeS Imperator

    Joined:
    Jul 23, 2013
    Messages:
    6,453
    Location:
    Illinois, USA
    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".
     
  7. Lonecat Nekophrodite

    Lonecat Nekophrodite Prince

    Joined:
    Jan 10, 2019
    Messages:
    466
    Gender:
    Male
    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?
     
  8. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    1,935
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    I think I explained all this a few posts up. :rolleyes:
     
  9. Lonecat Nekophrodite

    Lonecat Nekophrodite Prince

    Joined:
    Jan 10, 2019
    Messages:
    466
    Gender:
    Male
    Are you referring to this one?

    city defender units2.jpg

    And what is 001 suffix shown AFTER UnitGlobals?
     
  10. Laurana Kanan

    Laurana Kanan Don’t underestimate who I am.

    Joined:
    Apr 10, 2014
    Messages:
    1,935
    Gender:
    Female
    Location:
    Near the Greatest Snow on Earth
    Yes
    That's just the element name iirc.
     

Share This Page