1. We have added the ability to collapse/expand forum categories and widgets on forum home.
    Dismiss Notice
  2. Photobucket has changed its policy concerning hotlinking images and now requires an account with a $399.00 annual fee to allow hotlink. More information is available at: this link.
    Dismiss Notice
  3. All Civ avatars are brought back and available for selection in the Avatar Gallery! There are 945 avatars total.
    Dismiss Notice
  4. To make the site more secure, we have installed SSL certificates and enabled HTTPS for both the main site and forums.
    Dismiss Notice
  5. Civ6 is released! Order now! (Amazon US | Amazon UK | Amazon CA | Amazon DE | Amazon FR)
    Dismiss Notice
  6. Dismiss Notice
  7. Forum account upgrades are available for ad-free browsing.
    Dismiss Notice

[MODCOMP] Unit Statistics

Discussion in 'Civ4 - Mod Components' started by Teg_Navanis, Mar 13, 2006.

  1. Teg_Navanis

    Teg_Navanis Chieftain

    Joined:
    Jan 21, 2006
    Messages:
    737
    current version: 1.53 (June 24, 2009)

    Compatible with: v1.74, Warlords v2.13, BtS v3.02 (Unit Statistics 1.45)
    Compatible with: BtS v3.19 (Unit Statistics 1.53)
    Compatible with: Fall from Heaven 2 (check this thread for newest version)
    MP Compatibility: yes


    New:

    compatible with BtS v3.19

    Download

    Version 1.45 (compatible with: v1.74, Warlords v2.13, BtS v3.02)

    Version 1.53 (compatible with: BtS v3.19)


    Description

    This mod adds some unit statistics. To see them, simply select a unit and press U. For an overview over the different statistics, check the screen shots.

    Installation Instructions

    Unzip this into the "civ4_install_folder\Mods\" folder.

    Combining this mod with other mods

    To incorporate this mod into another one, copy all files into the other mod's corresponding folders.
    If there a several files with the same name, check if there are differences between the files. If there aren't, just use one.
    If there is already a CvCustomEventManager.py in the other mod, check the example-file CvXXXEventManager
    to see how you can modify the CvCustomEventManager file of the other mod to create a file parallel to CvUnitStatisticsEventManager.
    You can load this newly created/modified file by adding a single line in this mod's CvCustomEventManager (appr. line 34).

    I won't explain how you can merge several CvGameCoreDLL.dll files. It is explained in the CivFanatics Forum, but rather complicated.
    For those who know how to do it: The required files are in the SDKfiles folder, all changes have been commented.
    search for "// Unit Statistics by Teg Navanis".


    Known Issues

    Cannot (easily) be merged with any mod that uses the ScriptData functions, but not the SdToolKit (or SdToolKitAdvanced). This includes most of Firaxis own scenarios.

    Version Information
    Spoiler :


    ----v1.53 ----

    - compatible with 3.19

    ----v1.52-----

    - expanded Italian translation

    - flanking attacks weren't tracked in 1.51. fixed.


    ----v1.51-----

    will break save games.

    - compatible with 3.17

    - New set of buttons by xienwolf

    - FfH specific improvements: new high scores (most heroes killed, most spells cast)

    - Mod is more robust when confronted with units that don't have unitstats information

    - fixed some issues with global high scores enabled

    ----v1.5------

    - Compatible with BtS 3.13

    - Removed config file and all files necessary to read it. Config values can now only be changed in
    UnitStatisticsDefines.py. (System was broken and caused unexpected behaviour). Some values might be
    moved to XML files in the future.

    - Removed unit naming (untested for a long time, buggy and not needed for the mod since 1.32

    - Cleaned up the code and removed obsolete parts of it (popup windows, for example)

    - Moved FfH editor to open document format (new macro for OpenOffice).

    - Damage is now handled by a single event (combatHit), which means that
    more types of damage can be tracked without bloating the code. This also opens up the possibility
    of adding spell damage (and spell kill!) tracking in FfH.
    The different types of damage are distinguished by a parameter.
    # iTypeofAttack
    # 0: (empty, reserved for total damage)
    # 1: Attacker is hit
    # 2: Defender is hit
    # 3: Collateral damage (defender is hit)
    # 4: Flanking strike (defender is hit)
    # 5: Air Strike (defender is hit)
    # 6: Other (FfH magic?) (defender is hit)

    - Kills with flanking strikes (possible in BtS), collateral damage and
    air strikes (not possible in BtS) will also be recorded in the unit log and
    are visible in the unit and player statistics (as "other" kills).

    - Bugfix: Number of lost air combats is now correctly shown in player statistics.

    - Bugfix: Air combats are no longer counted twice if both planes are damaged.

    - Disabled some unit stats by default. (movement and fortify tracking)

    - Minor improvements concerning high scores and experience tracking when unit retreats.

    ----v1.45------

    - Fixed two issues with BTS SDK:

    --- If a unit retreats after reaching its combat limit (siege units), the result will
    be registered.

    --- If a unit is killed, damage will again be rounded down to the defeated unit's health before the battle.

    ----v1.44------

    - compatibility with Vanilla 1.74, Warlords 2.13 and BtS 3.02.

    - New player stats: Average combat odds, average combat results and luck index. The latter compares
    your victory probability with the actual outcome and tells you how lucky (or unlucky) you have been
    in the game so far.

    - some new FfH-specific feature: number of spells and summons survived (optional).


    ----v1.43b-----

    - two small bugfixes


    ----v1.43------

    - warlords: compatible with patch 2.08.

    - bugfix: when a unit is upgraded, the new unit is correctly marked as the high score holder.

    - some additions for FfH


    ----v1.42------

    - fixed wrong Warlords CvScreensInterface.py (used vanilla one).

    - Now also correctly loads games that have been started without unit statistics running.

    - fixed bug with top 10 when you have no units left (one of those bugs you wish never to notice ;))

    - added info about whether a battle was offensive or defensive to the unit log.

    - added colour coding of active window (taken from Mongoose's mod)

    - stores promotions of tracked dead units (taken from Mongoose's mod)

    - added tracking of defeat with highest combat odds (taken from Mongoose's mod)

    - added victory with lowest combat odds / defeat with highest combat odds to player statistics

    - adopted some UI improvements from Mongoose's mod

    - activated help panes for the unit statistics screens. They can be disabled in the config file.

    - fixed wrong calculation of player experience (thx to Mongoose)

    - fixed high score bug with "Global High Score" enabled

    - fixed bug when switching between player statistics with "Show All Players" enabled

    - fixed some issues with minimap on Top 10 page:
    - The minimap won't vanish on Warlords
    - The minimap is clickable
    - The top 10 units will be correctly displayed on the minimap


    (check the readme for older changes)



    Major contributors

    TheLopez: reworked the code for greater flexibility and added new features.


    ===Credits & Thanks===

    - Roger Bacon
    Kill List Mod - this Mod is the core of the Unit Statistics Mod

    - TheLopez
    Mercenary Mod - the unit statistics screen is based on the mercenary manager screen.

    - Stone-D
    SD ToolKit

    - Gillmer J. Derge
    CustomEventManager
    INI-Parser

    - Zuul, White Rabbit, xienwolf
    Buttons

    - Kael
    FfH Editor

    - Mongoose
    Mongoose Mod

    - ViterboKnight
    Italian translation

    Screenshots
     
  2. Pvblivs

    Pvblivs Scriptor

    Joined:
    Oct 28, 2005
    Messages:
    696
    Location:
    Berlin, DE
    Finally I'm enabled to keep track of my glorious :spear:!

    Great!

    p.s.: Interesting mod to be combined with the Chuck Norris Mod :lol:
     
  3. woodelf

    woodelf Bard

    Joined:
    Jun 12, 2003
    Messages:
    15,036
    Location:
    Gallery
    Nice work and very helpful for us stat freaks! Thanks man. :goodjob:
     
  4. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Very cool, very cool indeed.

    A couple of questions, why did you use Impaler's custom event manager over Dr Elmer Jiggles? Would you like me to mod your modcomp to use his custom event manager so you can see the difference between the two? Would you mind if I encorporated your mod into the merc mod so mercs have a "resume"?
     
  5. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    A couple more questions, when a unit gets upgraded do they retain their previous information as well? I would assume so but when checking your code I don't see where this happens.

    EDIT: Also, in your code in the onUnitCreated method in the UnitStats.py file you don't need to figure out the "AD" or "BC" value by hand, you can just call CyGameTextMgr().getInterfaceTimeStr(unit.getOwner()).
     
  6. Teg_Navanis

    Teg_Navanis Chieftain

    Joined:
    Jan 21, 2006
    Messages:
    737
    the information is moved to the new unit in the onUnitLost event. I even used some of your code there ;)

    Impaler's custom event manager was used in the Kill List Mod, I simply took it over from there. I'll check Dr Elmer Jiggle's file though.

    I have now implemented CyGameTextMgr().getInterfaceTimeStr(unit.getOwner( )) and fixed a bug with the "total distance travelled". I'm pretty sure there are other things that could be coded more elegantly (like the absolute values in onUnitSetXY), but I'm new to programming python so I just used if-functions :blush:. 1.02 will follow shortly
     
  7. Zuul

    Zuul Mod lister!

    Joined:
    Nov 13, 2005
    Messages:
    1,117
    Location:
    Sweden
    Very nice work :).

    Some more stats to add (as I said in the other thread):

    *When you killed a unit, tell if it was in defence or attack (and total attack/defence), and maybe even the win chance and fight ratio and health lost.
    Amount of withdraw
    Total heal turns
    Total fortified turns
    Turns in city/fort/other - per terrains/per features - friendly/neutral/enemy land - service time for other civs.
    Best fight (the fight ratio, and chance to win and how much health you lost)
    Total animals/barbarians/civ units killed.

    What this unit is rated in your civ and on the world (example 3rd best unit in your civ and 5th in the world)
     
  8. The Great Apple

    The Great Apple Big Cheese

    Joined:
    Mar 24, 2002
    Messages:
    3,361
    Location:
    Oxford, England
    Does it remember information if you manually rename a unit?
     
  9. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Hmmm..... that's a very good question ... thanks for making me now go check out the mercenaries mod to fix it... lol. Oh well.
     
  10. Teg_Navanis

    Teg_Navanis Chieftain

    Joined:
    Jan 21, 2006
    Messages:
    737
    haven't tested it, but it should. the data is stored through the unitID and the name is only needed when you upgrade a unit.
     
  11. Teg_Navanis

    Teg_Navanis Chieftain

    Joined:
    Jan 21, 2006
    Messages:
    737

    most of this would be doable, but this is a lot of data and I don't know how to organize the popup. I would like to have buttons and different windows, but I haven't found a popup documentation and am quite at a loss there.
     
  12. Nexushyper

    Nexushyper Chieftain

    Joined:
    Dec 3, 2002
    Messages:
    245
    Location:
    Colorado
    This looks great.

    I just finished fusing Sevo's Fusion mod, with Kill list Mod, Great specialists Mod, Military bases mod, and Random event mod.

    I will now add this as it seems to be a great replacement/upgrade to kill list mod.

    I was going to add Merc mod but event manager used in it by Dr Elmer Jiggles will not work with mods that do not use it. Atleast I have not had the time to spend to get them to work together. Everytime I try it fails.

    Perhaps someone here can help me? I'd love to use this and merc mod with the mod I made using Dr Elmer Jiggles event manager(Which is as I said above Sevo's mod with a few add-ons.)
     
  13. Teg_Navanis

    Teg_Navanis Chieftain

    Joined:
    Jan 21, 2006
    Messages:
    737
    my mod now has two CvCustomEventManager - files. Use the first one (CvCustomEventManager) for Mods compatible with Dr Elmer Jiggles event manager, the second one (CvCustomEventManager2) for all the others.
     
  14. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    So now that you used both custom event managers from Dr Elmer and Impaler, which one do you like better? Personally, I like Dr Elmer's since it makes combining mods that use events a lot easier.
     
  15. Teg_Navanis

    Teg_Navanis Chieftain

    Joined:
    Jan 21, 2006
    Messages:
    737
    Dr Elmer's file is easier for mod-merging if it is consistently used by all mod-makers. But in contrast to Impaler's file, I do not find it self-explanatory and would have liked a better description (I edited the CvCustomPromoEvent of theMercenary Mod, otherwise I wouldn't have had a clue what to do... :D).
     
  16. Nexushyper

    Nexushyper Chieftain

    Joined:
    Dec 3, 2002
    Messages:
    245
    Location:
    Colorado
    I agree, Dr Elmer's file is hard to understand off the bat. I'm sure when I study it further I will figure it out. But Impaler's is easier to figure out at first glance.


    Anyways, tonight after work I will figure it out and add this and the merc mod to my modified Sevo mod.
     
  17. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon
    Here is the link to his thread:
    http://forums.civfanatics.com/showthread.php?t=157141

    Personally I thought it was pretty self explanitory. But that is just me. :D

    BTW, since I have been using it I can pretty much take any mod comp that doesn't use his custom event manager and integrate them together in about 5 mins. That's how long it took me to integrate Merc mod and Zuul's promotion mod.
     
  18. TheLopez

    TheLopez Chieftain

    Joined:
    Jan 16, 2006
    Messages:
    2,525
    Location:
    Oregon

    Nexushyper, let me know if you need help integrating the two, I would be more than happy to help.
     
  19. Jeff1787

    Jeff1787 Sarge

    Joined:
    Jun 4, 2003
    Messages:
    574
    Location:
    The Dog House
    I seem to have it installed correctly, but it doesn't show unit promotions...:confused:

    I am using it in conjunction with the Log Change Mod by eotinb.
     
  20. Teg_Navanis

    Teg_Navanis Chieftain

    Joined:
    Jan 21, 2006
    Messages:
    737
    thanks, that bug slipped in in the version 1.02
     

Share This Page