Modders Guide to FfH2

To add a scenario to the game itself, you'd need to use ScenarioFunctions.py, and then add functions that were unique for your scenario. To accomplish this, the game runs a different game option for each scenario and in the above file it checks which game option is enabled. So you either have to add a new game option (via SDK) or use GAMEOPTION_WB_EXTRA, an empty game option left around for that purpose.
 
On another subject,

Why doesn't the AI try to convince me to stop waring with them? I never see them pleading for peace or capitulation...
 
I don't know. I hear that the BtS AI did but in FfH they don't.

I guess that in BtS a unit's power depended more on strength than promotions. The AI doesn't really value an elite group led by a hero or archmage > many champions. I think that the AI thinks it is winning by having huge numbers but not an effective army.
 
Ai considers primarily 2 things when checking for "chances to win a war" first: Number of Units. So if you have lots of powerhouses, but they have LOTS AND LOTS of wimps, they think they can win. Second, number of cities lost. Unfortunately this value is a bit low, so you have to take a ton of cities to balance against how many units they have before they will think that you are actually stronger than they are.
 
So this needs tweaking. I guess it could be done with iAsset and iPower for promotions and counting that?
 
The big problem is HOW to use that? Combat I on a 2 strength scout means far less than Combat I on a 22 strength Acheron. And Mobility promotions on a unit with Blitz and cannibalize mean a LOT, while Mobility on a disciple (ie Acolyte and his lowest tier brethren) means... almost nothing.

I implemented an iPower and iAsset for promotions in FF, and I made them work as a percentage modification to the unit's base Power. Things really aren't set up to handle that too well with the basic code, but I think I sorted it out fairly decently in the end. But as to how much it helped... not sure.
 
Hm, yeah... Lowering the threshold to which the AI considers itself winning might not be a good idea either. At least, tweaking the city thing.
 
Well, a little application of statistics/heuristics would go a long way there. Choose some number of turns and have them compare number of units gained/lost by each side during that time. If they have lost a significant portion of their army, and you have not, then they are losing. What constitutes a significant portion would vary based on conflict happening in your lands or in their lands. You would have to add tracking for number of units possessed each turn for that to work effectively, but as long as you have chosen a number of turns to analyze you can simply keep an array of that size and compare the first and last elements of the array to one another (array starting at 0 and pushing itself back each turn to always add latest numbers at the end of the array)

The main gist of the exercise would be that ratios tell you a LOT more than raw numbers ever can.

20 turns ago I had you outnumbers 30:1, now I have you outnumbered 10:1. I am getting TRASHED.
 
I'm looking for the part of the code that deals with stealth. Mainly the part where promotions can make a unit invisible. Also I'm looking to have the stealth be dependant on the tile the unit is on. Like if the unit is in friendly territory or not, or possibly if the unit is in a city. That seems like it should be doable. Has anyone tried having conditional stealth like this before?
 
Yes. FfH had it before it moved to BtS, but it was considered too resource intensive. It is more fully implemented in FF.
 
Where's the code that removes non-AV religions from Infernal cities?
 
It doesn't exist. The Empyrean, the Runes of Kilmorph, the Felloship of the Leaves, the Council of Esus, and the Octopus Overlords can all thrive in Infernal cities. The code that removes The Order from Infernal cities in CvEventManager.py

Code:
	def onCityAcquired(self, argsList):
		'City Acquired'
		iPreviousOwner,iNewOwner,pCity,bConquest,bTrade = argsList
		pPlayer = gc.getPlayer(iNewOwner)

		pCity.setNumRealBuilding(gc.getInfoTypeForString('BUILDING_DEMONIC_CITIZENS'), 0)

		if pPlayer.getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_INFERNAL'):
			pCity.setHasReligion(gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'), True, True, True)
			pCity.setHasReligion(gc.getInfoTypeForString('RELIGION_THE_ORDER'), False, True, True)
			pCity.setNumRealBuilding(gc.getInfoTypeForString('BUILDING_ELDER_COUNCIL'), 1)
			pCity.setNumRealBuilding(gc.getInfoTypeForString('BUILDING_TRAINING_YARD'), 1)
			pCity.setNumRealBuilding(gc.getInfoTypeForString('BUILDING_OBSIDIAN_GATE'), 1)
			pCity.setNumRealBuilding(gc.getInfoTypeForString('BUILDING_FORGE'), 1)
			pCity.setNumRealBuilding(gc.getInfoTypeForString('BUILDING_MAGE_GUILD'), 1)
			pCity.setNumRealBuilding(gc.getInfoTypeForString('BUILDING_DEMONIC_CITIZENS'), 1)



...........


	def onCityDoTurn(self, argsList):
...
		if gc.getPlayer(pCity.getOwner()).getCivilizationType() == gc.getInfoTypeForString('CIVILIZATION_INFERNAL'):
			if pCity.isHasReligion(gc.getInfoTypeForString('RELIGION_THE_ORDER')):
				pCity.setHasReligion(gc.getInfoTypeForString('RELIGION_THE_ORDER'), False, True, True)
			if pCity.isHasReligion(gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL')) == False:
				pCity.setHasReligion(gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'), True, True, True)
 
It doesn't exist. The Empyrean, the Runes of Kilmorph, the Felloship of the Leaves, the Council of Esus, and the Octopus Overlords can all thrive in Infernal cities.

Ah, so these beautiful Fellowship temples in Infernal cities I constantly see are not a glitch. Well, I'll change that - that doesn't make much sense.
 
Leaving OO and CoE makes sense though, especially CoE since it gives special spells to you recon units.

I tend to think the Mercurians shouldn't tolerate OO either (as it uses demons and the undead), but I'm unaware of them having a real conflict with CoE. Esus doesn't even use demons much, even in his hell most his servants are alive.
 
Are feats defined in python, XML or the dll? I want to use the function pPlayer.setFeatAccomplished(FeatTypes.FEAT_MY_NEW_FEAT, True), but I get an attribute not defined error. I can't find already existing feats anywhere in python or XML.
 
I believe that Feats are entirely in the DLL in normal Civ IV and FfH2, but that Xienwolf tried to move them to xml. He was not entirely successful, and FF is left with a hybrid system where they are mostly in the DLL but there is also an xml file that you can use to change the names of the feats (for display in promotion that have feats as a prereq, for example).

--------


How would I go about modding Somnium to play with my house rules, i.e., making it so that drawing the Death card simply ends the game and makes whoever was ahead at the time the winner instead of making whoever draws it loose all his current cards and then playing on as normal?

Edit: I figured it out. First I got it to declare a winner, but it was still making us play until the deck was empty. I eventually figured out how to empty the deck when death is drawn. I think I should probably only empty the deck and not force the game to end otherwise, as it declared me winner twice in a row. Interestingly, the first time I got it working right without making me play though a lost game the first card drawn was death.
 
It was always like that, DLL side that is REQUIRED is just 1 line. 2 if you are going to access the feat in python. Then you place it where needed to execute the function you want it for. MC described the FF method properly. I believe I know how to remove it from the DLL completely now, but it is unfortunately a fair way down the list of things for me to do. Higher on the list is to create a global feat system, at which time if I am right about how to move to pure XML for player feats, I will probably do so, since the work will be parallel in nature.

Pazyryk: There should still be quite a few BtS feats which are no longer used by FfH which you can use instead. The names won't be exactly what you would prefer, but they will still serve their purpose for you.
 
I believe Orbis reverted the FEAT commented out by Kael. I'm not sure but I remember seeing them non commented...
 
Back
Top Bottom