Enhanced hero system

First, did you follow the directions on the first post:

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.

Second, click on a hero. Does an "Inventory" button appear at the bottom (with the move, promotion upgrade, spell cast buttons)? If not, something's probably wrong with my mod.
 
No problem :)

10/23/06 update: I'm getting swamped with projects and tests at the moment, so progress has been slow. No clue, I'll probably release the next version after 0.16 is released...
 
Well, it's officially on hiatus. Various things happened... Academic stuff, roommate bringing over his PS2, more academic stuff. And now, I recently reformatted my harddrive, and I left my Civ4 CDs back at home so I can't reinstall Civ4, so until the next time I make a trip home, I can't mod Civ4 (safely at least).
 
I'm gonna test your mod to see how the Equipment system works, to possibly incorporate it into cIVRPG if you do not mind.
 
Go ahead, Grey Fox :) I've attached the latest changes Python changes I made before I reformatted my HD. They should work, but I'm not 100% sure.

Some notes:
  • You'll have to have FfH2 0.15k installed, and install the patch on the first post of this thread. Make sure you follow the installation instructions carefully.
  • I hope you know what diff files are - they just show the changes between two versions of a text file. The ones I packaged in the attached file show the differences from the old patch (ffh2-015k-mods-inventory), rather than FfH2 0.15k itself.
  • Some of the files are specific to FfH, and some are for the old retreat code. The files that you probably won't need are: CustomFunctions.py, TempSDK.py, FFHSpells.py, and UnitStatisticsUtils\CvUnitStatisticsEventManager.py.
  • The heart of the inventory code lies in FFHInventory.py and screens\CvInventoryScreen.py.
  • The changes made in FFHSpells.py and screens\CvMainInterface.py just hide the item promotions and add an Inventory action button. This obviously relies on FfH's spell system, so unless your mod is based off FfH's dll, you'll need to find another way to do this.
  • Utils\CyUID.py and Utils\DragDrop.py are libraries. CyUID provides a way to hash Cv objects (CvPlayer, CvUnit, etc.) into "Unique IDs", and a way to get the object from that hash value. DragDrop is a framework for adding drag drop functionality to screens. I hope I documented them well enough.
  • Utils\SdToolkitAdvanced.py is a heavily modified version of Stone-D's and Teg Navanis's object variable library. The API remains unchanged. From the changelog: "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)." As noted, depends on CvFFHSpellsEventManager.
  • The changes I made to CvFFHSpellsEventManager are actually changes to Gillmer J. Derge's CvCustomEventManager. Ideally, CvFFHSpellsEventManager should derive from a seperate CvCustomEventManager class, but Teg just merged the two. From the changelog: "Added new features to CvFFHSpellsEventManager (CvCustomEventManager)'s event handler system: 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 a Cv* object in any other way is dangerous)." Depends on CyUID.
  • The only relevant changes in CvEventManager.py that you'll need are the addition of the itemMove, itemCreated, and itemDestroyed events.
  • Likewise, the only relevant changes in entrypoints\CvGameInterface.py that you'll need are the addition of the cannotMoveItem, cannotCreateItem, and cannotDestroyItem functions.
  • Items are added via XML. They are composed of two parts: the promotion the item grants and the item itself. The promotion part (PITEM_*) goes in CIV4PromotionInfos.xml. The item info (ITEM_*) goes in the new file CIV4ItemInfos.xml. Look at the FFH editor spreadsheet. CIV4ItemInfos.xml is read via Python in FFHInventory.py. It uses Utils\CvPath.py, which in turn needs CvModName.py.
  • FFHInventory.py contains some example code that demonstrates how to add and remove items from inventories.
  • Units can be automatically given items when they are created by adding the item promotion as a FreePromotion to the unit in CIV4ItemInfos.xml.
  • Any file (both Python and XML) not discussed above makes misc. changes that are probably necessary, so look at them.

Changelog since last update:
  • Fixed all FfH 0.15k merge issues hopefully.
  • Functions added to CvGameInterface: cannotMoveItem, cannotCreateItem, cannotDestroyItem.
  • Events added to CvEventManager: 'itemMove', 'itemCreated', 'itemDestroyed', with corresponding functions: onItemMove, onItemCreated, onItemDestroyed.
  • All the market and equipment behavior code moved out of the GUI code and into the above functions.
  • When items are moved, created, or destroyed, and the inventory screen is active, the item icons representing those items are automatically moved, created, or destroyed.
  • Fixed a bug where the "put into first empty slot" feature didn't work for markets and vaults.
  • Other misc. internal changes and fixes.
 

Attachments

I was wondering whatever happened to this. I think it would be an excellent addition.
 
I've included the equipment system in cIVRPG. Check it out in the future. (not released yet)
 
Back
Top Bottom