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

Militia Promotions (minor mod)

Discussion in 'FfH2 Modmods, Scenarios, and Maps' started by Tholal, Sep 19, 2009.

  1. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    This is a very simple mod whose purpose is to add a little bit of flavor to the basic troops via semi-random, terrain-based promotions. In short, there is a small chance that a newly built unit will gain an extra, free promotion on creation based on the type of terrain around the building city.

    This mod is compatible with FfH2 0.41g. Current version of this mod is 0.2


    UPDATE NOTES:
    Version 0.2
    * Changed icon for Cliff Walker promotion
    * Fixed check for Hell terrain so that it looks for all four types of Hell terrain
    * Added the possibility to acquire the amphibious promotion based on number of Shore tiles next to the city
    * Slightly increased chance for these promotions to appear

    Download Militia Promotions mod

    DETAILS:

    This mod checks the terrain around the building city everytime a unit is built as long as the unit is alive, is not a hero, and is not a settler or worker. There is a small chance that the unit will receive a bonus, terrain-oriented promotion based on the current terrain around the city.

    Three of the possible promotions are already existing ones:

    Winterborn - Based on number of Snow and Tundra tiles (Illians and Doviello are excluded from this check)
    Demon-slaying - Based on the number of Hell terrain tiles (Infernal are excluded from this check)
    Amphibious - Based on the number of Shore tiles​

    And three are brand new:

    Cliff Walker - Based on the number of Hills and Peak tiles
    +10% attack and defense in hills

    Sand Devil - Based on the number of Sand tiles
    +10% attack and defense in desert

    Tree Warden - Based on the number of Forest, Ancient Forest and Jungle tiles (both elven civs have reduced chance to receive this promotion)
    +10% attack and defense in Forest, Ancient Forest and Jungle​


    It is possible (though extremely unlikely) for a single unit to get all six promotions if they have at least one tile that fits into each category around their city.


    This mod includes edits to the following files:
    CvEventManager.py
    CIV4PromotionInfos.xml
    CIV4GameText_FFH2.xml​

    You should make backups of these three files prior to installing the Militia Promotions mod.

    This mod also includes three new promotion icons. These should be placed in the the FFH folder under Art\Interface\Buttons\Promotions (Note: you'll probably have to create this folder)

    himalayas.dds - Taken from this graphics pack. Used for the Cliff Walker promotion
    markofthescorpion.dds - Taken from the Age of Ice scenario. Used for the Sand Devil promotion
    shamrock.dds - Taken from this graphics pack. Used for the Tree Warden promotion​


    This mod was mostly created as a self-lesson on how to modify the python files. As such, I mainly just cut and pasted codes from different parts of the file and tweaked it to do what I wanted. So I would love to hear any comments on the code. Am I doing anything wrong? Is there a better way to handle the terrain and promotion checks? Did I miss something important?

    I would love to hear any gameplay feedback and I'm willing to continue updating and tweaking this mod if there is any interest in it.

    (code snippets removed for the moment)

    STILL TO DO:
    * Come up a better, non-linear formula
    * Change base chance to a variable to enable easier future adjustments
    * Icons for new promotions (I'm still not happy with the ones I have)
    * Localization
    * Installer
     
  2. [to_xp]Gekko

    [to_xp]Gekko QCT junkie

    Joined:
    Dec 16, 2005
    Messages:
    7,943
    Location:
    Seyda Neen, Vvardenfell
    nice idea and very interesting mechanic!
     
  3. cyther

    cyther Lord of the Dance

    Joined:
    Jun 9, 2008
    Messages:
    1,033
    Location:
    Fane of Lessers
    Very cool. Could I use it in the next version of Rise of Darkness?
     
  4. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Certainly! Unless otherwise stated, I consider anything I post here to be public domain. And the code is pretty simple and self-contained, so it should be relatively easy to modify/tweak.
     
  5. Sephi

    Sephi Deity

    Joined:
    Jan 25, 2009
    Messages:
    2,941
    Tholal, I read you plan an update for this. Any ETA on this?
     
  6. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Yeah. I updated the code this weekend but haven't tested it much. I'll try and do that tonight. Nothing major. Here are the planned updates:

    * New icon for the Cliff Walker promotion
    * Updated the check for Hell terrain to include all 4 types
    * Added check for shoreline (chance to grant amphibious promotion)
    * Slightly increased chance for promotions to be granted
     
  7. Tholal

    Tholal Emperor

    Joined:
    May 19, 2009
    Messages:
    1,676
    Updated to version 0.2 See first post for details.
     
  8. Sephi

    Sephi Deity

    Joined:
    Jan 25, 2009
    Messages:
    2,941
    great! Thanks
     

Share This Page