NOTE: This is a proof of concept, not meant to be played in real games. Many of the features, namely the equipment/item/inventory system, are not fully implemented (in fact, the equipment system has no impact on gameplay currently). There may also be odd behavior and possibly even crashes.
Download ffh2-015k-mods-inventory.zip
To install: Make sure you have the latest version of Fall from Heaven 0.15k. Extract to the Civilization 4 folder (by default, it's C:\Program Files\Sid Meier's Civilization 4\). The archive also includes diff files that include the exact changes in the source code from the official version.
NOTE: I just found out that the above patch extracts to the wrong Fall from Heaven 2 directory. The FfH2 0.15k patch extracts to "Mods\Fall from Heaven 2 015k" instead of "Mods\Fall from Heaven 2 015". So all folders and files extracted to "Mods\Fall from Heaven 2 015" from my patch must be moved to "Mods\Fall from Heaven 2 015k". In addition, the CvModName.py file needs to be edited: change "Fall from Heaven 2 015" to "Fall from Heaven 2 015k".
Alternatively, rename the "Mods\Fall from Heaven 2 015k" directory to "Mods\Fall from Heaven 2 015". The shortcut to the mod will also have to be edited so that it starts 015 rather than 015k.
I'll post a new patch later that will fix this issue (along with other changes).
To uninstall: Reinstall the 0.15k patch. If you're updating to a new version of this mod, you should reinstall the 0.15k patch before installing the new version.
This patch is NOT compatible with 0.15 save games.
The features:
Items and inventory system:
Indefinitely removed: Retreating, a.k.a. defensive withdrawals:
Some additional ideas I've been considering:
This is only a test. It's completely written in Python with some XML changes. The code is hacky (but not as much as my first implementation). Much of the code should go in the SDK, but since I don't have access to FfH's SDK source, I had to come up with hacky workarounds. Specifically, the retreat code should go in CvUnit::updateCombat, or rather CvUnit::updateCombat needs better Python hooks.
There are a couple limitations that I can't think up workarounds for at the moment:
New files:
Changed files:
Changelog:
0.15k (09/18/06):
0.15j (09/17/06):
Download ffh2-015k-mods-inventory.zip
To install: Make sure you have the latest version of Fall from Heaven 0.15k. Extract to the Civilization 4 folder (by default, it's C:\Program Files\Sid Meier's Civilization 4\). The archive also includes diff files that include the exact changes in the source code from the official version.
NOTE: I just found out that the above patch extracts to the wrong Fall from Heaven 2 directory. The FfH2 0.15k patch extracts to "Mods\Fall from Heaven 2 015k" instead of "Mods\Fall from Heaven 2 015". So all folders and files extracted to "Mods\Fall from Heaven 2 015" from my patch must be moved to "Mods\Fall from Heaven 2 015k". In addition, the CvModName.py file needs to be edited: change "Fall from Heaven 2 015" to "Fall from Heaven 2 015k".
Alternatively, rename the "Mods\Fall from Heaven 2 015k" directory to "Mods\Fall from Heaven 2 015". The shortcut to the mod will also have to be edited so that it starts 015 rather than 015k.
I'll post a new patch later that will fix this issue (along with other changes).
To uninstall: Reinstall the 0.15k patch. If you're updating to a new version of this mod, you should reinstall the 0.15k patch before installing the new version.
This patch is NOT compatible with 0.15 save games.
The features:
Items and inventory system:
- Inventory GUI (screen) that can be opened by clicking a button in a hero's action button list (the bottom part of the screen).
- Two display modes: one for resolutions with less than 1280, and the other for 1280+ width.
- Each hero has 10 equipment slots: head, body, feet, hands, weapon, shield, mount, misc1, misc2, misc3
- Each hero also has a backpack that has 18 slots.
- Each player has a 36 slot vault. Any item can be stored in the vault.
- Each player has an 18 slot market. Tech-based items are introduced to the market whenever the tech for those items are researched. A tech-based item is infinite in supply in the market if you have the tech for that item.
- Several items. However, none of them do anything and are preset in this POC.
- Proficiency system where heroes with a certain proficiency gets bonuses with items related to that proficiency. System in place, but currently has no effect in this POC.
- Items can be dragged and dropped in the inventory GUI.
- Items can be transferred from hero to hero, hero to vault/market, and vice versa.
- Items are retained thru game loads/saves.
- New sheet added to FfH editor named Items. Promotions still need to be added for each item, but it's a step toward seperating items and promotions.
- Indefinitely removed: Combat odds hint is adjusted to factor in the new combat mechanics. System in place, but since the new combat mechanics aren't in, this does nothing in this POC.
- Known issue: Blank entries appear in Civilopedia under Promotions.
Indefinitely removed: Retreating, a.k.a. defensive withdrawals:
- First some terminology. "Withdrawal" means the unit is attacking and withdraws. "Retreat" means the unit is attacked and withdraws. "Hero" is a bit of a misnomer - this system works for all unique units, including dragons.
- Note that these retreat rules below now apply to ALL units that have withdrawal, in addition to heroes. The only difference is the hero's 100% withdrawal bonus.
- If a unit is defeated it tries to win a withdrawal roll (using its withdrawal probability). If it wins the roll, it tries to find a safe plot to retreat to. If it can't find one, it dies. Otherwise, it will retreat to that safe plot with barely any health left. The attacker's group then advances into the defender's old plot.
- A hero starts off with a 100% withdrawal bonus. Every turn, the hero regains 50% of the bonus up to the 100% maximum.
- Every attack the hero makes reduces that bonus by 50%. Once the bonus is depleted, the hero only has his "normal" withdrawal chance left (the hero's base withdrawal + bonuses from promotions like Flanking). The net withdrawal chance will never go below this normal withdrawal chance.
- Every time a unit retreats, its withdrawal chance is reduced by 50% and MPs are wasted depending on where the unit moves (1 MP for plains, 2 MP for forest and hills, etc.).
- If a unit has no MPs left, it can't retreat.
- The MPs lost to retreating remain lost the next turn. This now hopefully works for multiplayer games and AI heroes who have engaged the human player in combat.
- Withdraw failure message is displayed if the hero fails to retreat (and dies).
Some additional ideas I've been considering:
- Fortify, sleep, and sentry would result in different withdrawal behavior. Heroes on fortify mode will fight to the last moment before withdrawing (as it is now). Heroes on sleep mode will try to retreat when they lose half their original HP. Heroes on sentry mode will try to retreat immediately.
- A rock-paper-scissors counter system: assassins vs. heroes vs. guards. Assassins would preferably target heroes and reduce their withdrawal chance. Guards would try to block assassins from attacking heroes. And heroes are just plain powerful. Some combat-oriented heroes can act as assassins too.
This is only a test. It's completely written in Python with some XML changes. The code is hacky (but not as much as my first implementation). Much of the code should go in the SDK, but since I don't have access to FfH's SDK source, I had to come up with hacky workarounds. Specifically, the retreat code should go in CvUnit::updateCombat, or rather CvUnit::updateCombat needs better Python hooks.
There are a couple limitations that I can't think up workarounds for at the moment:
- It's inefficient, but there's little I can do about that without using the SDK.
- Doesn't apply right now: Game may stutter if you force a barbarian hero to retreat. A unit has a chance of winning automatically against a barbarian, depending on the game difficulty level, and so the game stubbornly refuses to let the attacker withdraw to allow the barbarian to retreat (the attacker needs to withdraw to let the defender live, then the retreat code kicks in) for a while until it finally gives up, which can happen tens or even hundreds of combat rounds later.
- Doesn't apply right now: Although the combat odds for heroes with armor are correctly displayed in the help text area, the calculation of the best defender in a plot or best attacker in a group doesn't take armor into account. Also, there's a very rare chance of the combat odds being listed for the wrong hero in the same plot.
- AI will be completely clueless on how to use these new features.
New files:
Spoiler :
- <FfH path>\Assets\python\FFHInventory.py
- <FfH path>\Assets\python\screens\CvInventoryScreen.py
- <FfH path>\Assets\python\CvModName (for CvPath)
- <FfH path>\Assets\python\Utils\CyUID.py
- <FfH path>\Assets\python\Utils\DragDrop.py
- <FfH path>\Assets\xml\units\CIV4ItemInfos.xml
- <FfH path>\Assets\art\interface\buttons\Promotions\transparent.dds
- <Civ4 path>\Assets\python\system\xml\* (Python XML libraries)
- <Civ4 path>\Assets\python\system\pyexpat.pyd (Python expat XML parser)
Changed files:
Spoiler :
- <FfH path>\Assets\python\CustomFunctions.py
- <FfH path>\Assets\python\CvEventManager.py
- <FfH path>\Assets\python\CvFFHSpellsEventManager.py
- <FfH path>\Assets\python\FFHSpells.py
- <FfH path>\Assets\python\entrypoints\CvGameInterface.py
- <FfH path>\Assets\python\entrypoints\CvScreensInterface.py
- <FfH path>\Assets\python\screens\CvMainInterface.py
- <FfH path>\Assets\python\screens\CvScreenEnums.py
- <FfH path>\Assets\python\UnitStatisticsUtils\CvUnitStatisticsEventManager.py
- <FfH path>\Assets\python\Utils\sdToolKitAdvanced.py
- <FfH path>\Assets\xml\GlobalDefinesAlt.xml
- <FfH path>\Assets\xml\text\CIV4GameText_FFH2.xml
- <FfH path>\Assets\xml\units\CIV4PromotionInfos.xml
- <FfH path>\Assets\xml\units\CIV4SpellInfos.xml
- <FfH path>\Assets\xml\units\CIV4UnitInfos.xml
- <FfH path>\Assets\xml\units\CIV4UnitSchema.xml
- <FfH path>\FfH Editor.xls
Changelog:
Spoiler :
0.15k (09/18/06):
- Merged with FfH 0.15k.
- Market is nearly fully functional now. Tech-based items are introduced to the market whenever the tech for those items are researched. A tech-based item is infinite in supply in the market if you have the tech for that item.
- Forgot to add CvUnitStatisticsEventManager.py in previous patch.
- Added prices for each item.
- Misc. internal changes.
0.15j (09/17/06):
- Merged with FfH 0.15j. Removed a bunch of old fixes that no longer apply.
- Factored out the drag&drop code from CvInventoryScreen into a new library called DragDrop.
- Merged my old ScriptDataCache library into sdToolKitAdvanced: Sped up the object variable functions in sdToolKitAdvanced (from O(n) to O(1) amortized). Downsides: sdToolKitAdvanced now depends on CvCustomEventManager (or rather CvFFHSpellsEventManager), and if sdToolKitAdvanced is reloaded, all changes to object variables since the last load are lost (only makes debugging more difficult; no impact on real games).
- Merged my old event handler/listener library into CvCustomEventManager/CvFFHSpellsEventManager. Features: event handler priority (this can also be used to determine whether a handler fires before or after the default event handler), removeEventHandler(), hasEventHandler(), generic way to prevent subsequent handlers from firing, a way to get a handler to unregister itself, a way to specify extra arguments for a handler, Cv* objects can be passed safely via those extra arguments (accessing it in any other way is dangerous).
- Added CyUID library. Has two functions that are inverses of each other: getCyUID and getCyObject. getCyUID accepts a Cy* object and returns a tuple that contains the information needed to get the object. getCyObjects accepts such as "unique ID" and returns a Cy* object. Useful in situations where the Cy* object cannot be stored/passed since it would be invalid.
- Split FFHFindSafePlot into FFHFindSafestPlot and FFHFindSafePlot, where FFHFindSafestPlot intelligently finds a safe plot and FFHFindSafePlot simply finds an arbitrary safe plot.
- Indefinitely removed the retreat code.
- Indefinitely removed the ability to customize combat result messages.
- Indefinitely removed the unit conversion code and the related classes it depends on.
- A bunch of other refactoring to make the code easier to maintain, merge, and reuse.