[MODCOMP] Unit Statistics

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
 
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:
 
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"?
 
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()).
 
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
 
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)
 
The Great Apple said:
Does it remember information if you manually rename a unit?
Hmmm..... that's a very good question ... thanks for making me now go check out the mercenaries mod to fix it... lol. Oh well.
 
The Great Apple said:
Does it remember information if you manually rename a unit?

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.
 
Zuul said:
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)


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.
 
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.)
 
Nexushyper said:
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.)

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.
 
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.
 
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).
 
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.
 
Teg_Navanis said:
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).

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.
 
Nexushyper said:
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.


Nexushyper, let me know if you need help integrating the two, I would be more than happy to help.
 
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.
 
Jeff1787 said:
I seem to have it installed correctly, but it doesn't show unit promotions...:confused:

thanks, that bug slipped in in the version 1.02
 
Top Bottom