Modders Guide to FfH2

You can never add anything to the schema and have it do something without first adding it to the DLL. Adding to the schema means that Microsoft won't yell at you for an XML that fails to match the Schema attached to it. Adding it to the DLL means that Civilization will actually do something with the numbers placed there (even if that is just informing the Python what the number is)

I uploaded my own personal button maker to this thread a while ago, feel free to use it. You can either paste in a real picture and get the borders you want, or you can use the nifty Layer setup to get the standard Civ Gold icon.
 
Thank you for the answer Xienwolf, I appreciate you taking your time. And thank you for the button maker will look at it.

I guess I need to learn C++.

To bad you can't just steal a tag from another file since the game already knows what it is supposed to do with that tag.
 
Again I was wondering what I need to do to get a leader that is only playable by a player and not the AI?

You can't do a leader but you can set the civilization tags

Code:
            <bPlayable>1</bPlayable>
            <bAIPlayable>0</bAIPlayable>

So that only the human can choose that civilization.
 
Yeah I got that much but i swear it used to be in the Leaderheadinfos too. I am gonna have to find someone who can instruct me on how to add it.
 
Yeah I got that much but i swear it used to be in the Leaderheadinfos too. I am gonna have to find someone who can instruct me on how to add it.

It used to be in CIV4LeaderheadInfos.xml instead of CIV4CivilizationInfos.xml; this was changed either when FfH moved or BtS or when Shadow was released (I forget which). I think this was done to prevent the Infernals and Mercurians from entering the game in the beginning and again at the research of Infernal Pact/completion of Mercurian Gate, in Unrestricted Leaders games.
 
Do any of the promotions modify air combat strength?

No; the schema does not currently allow this, but I did just request xienwolf add the ability in his xml modcomp

Promotions can modify Air Range, interception chance, and evasion chance, but none do; FfH currently does not use AirCombat at all.
 
Something I've found that might help with those doing modmodding for improvements and promotions:

Naming the IMPROVEMENT_#### or PROMOTION_#### sometimes messes the index in which the values are stored. I was experimenting last night and after adding an improvement with the name IMPROVEMENT_ZZZZ_BLAH, I found that cottages did not break and the game ran fine. I believe that naming so that the new modular promotions are stored at the last of the index might be a short term work around for the problem.

Long term, it would be nice if the promotion and improvement fields worked by type instead of index.
 
The source for 0.32 patch "b" is linked in the first post.
 
can anyone see a reason why this never returns true?
Code:
def reqBuyArmorMI(pCaster):
	if pCaster.getLevel() > 0 and not pCaster.isHasPromotion(gc.getInfoTypeForString('PROMOTION_METEORIC_IRON_ARMOUR')):
		pCity = pCaster.plot().getPlotCity()
		if pCity.hasBonus(gc.getInfoTypeForString('BONUS_METEORIC_IRON')) == true:
			if pCity.getNumRealBuilding(gc.getInfoTypeForString('BUILDING_MASTERSMITH')) > 0:
				lUnitcombats = ['UNITCOMBAT_ARCHER','UNITCOMBAT_CHARIOT','UNITCOMBAT_DIVINE','UNITCOMBAT_MELEE','UNITCOMBAT_MOUNTED','UNITCOMBAT_RECON']
				lUnitcombatTypes = [ CvUtil.findInfoTypeNum(gc.getUnitCombatInfo, gc.getNumUnitCombatInfos, item ) for item in lUnitcombats]
				if pCaster.getUnitCombatType() in lUnitcombats:
					return true
	return false
 
if pCaster.getUnitCombatType() in lUnitcombatsTypes:
 
I was looking at Guardsman from the bug thread and I noticed that all of the new Boolean values which you added to the Promotions are set as hard booleans.

What I mean is that you have it set so that if I get a promotion with that ability, then my unit how has the ability. But if I get a second one, the unit still just has that ability.

That is good and proper.

Now, if I lose 1 of those 2 promotions, the way you have it coded (hard boolean), my unit loses the ability.

That is not so good.

For the majority of the fields, there is currently only one way to get it. So it isn't qutie so noticeable. In fact, the one field I could find where it IS noticeable, isn't actually a boolean, it was just set up with the same hard logic. That is the Invisible types. If my unit loses ANY invisible type, he loses ALL invisibility the way that it is now written. That means if I get Hidden on a unit that has Invisisble, then when Hidden is removed by combat/casting I will be completely visible, even though I still have Invisible.


These really ought to be re-written to use a count function, the same as how Blitz works. If Blitz were written the way that the new Booleans are written, then taking Orthus's Axe away from a unit that has been promoted to Blitz would result in that unit only being able to attack once per turn.

Yes, this isn't a "real issue" for the mod RIGHT NOW, which is why I bring it up here instead of in th ebugthread. But if you ever add new promotions which can be lost and share these tags, it will cause bugs.
 
I was looking at Guardsman from the bug thread and I noticed that all of the new Boolean values which you added to the Promotions are set as hard booleans.

What I mean is that you have it set so that if I get a promotion with that ability, then my unit how has the ability. But if I get a second one, the unit still just has that ability.

That is good and proper.

Now, if I lose 1 of those 2 promotions, the way you have it coded (hard boolean), my unit loses the ability.

That is not so good.

For the majority of the fields, there is currently only one way to get it. So it isn't qutie so noticeable. In fact, the one field I could find where it IS noticeable, isn't actually a boolean, it was just set up with the same hard logic. That is the Invisible types. If my unit loses ANY invisible type, he loses ALL invisibility the way that it is now written. That means if I get Hidden on a unit that has Invisisble, then when Hidden is removed by combat/casting I will be completely visible, even though I still have Invisible.


These really ought to be re-written to use a count function, the same as how Blitz works. If Blitz were written the way that the new Booleans are written, then taking Orthus's Axe away from a unit that has been promoted to Blitz would result in that unit only being able to attack once per turn.

Yes, this isn't a "real issue" for the mod RIGHT NOW, which is why I bring it up here instead of in th ebugthread. But if you ever add new promotions which can be lost and share these tags, it will cause bugs.

Yeah, thats really good advice. I'll add it to the want list to review these values and switch them to a count mechanic.
 
Twincast works that way too. It doesn't matter as much in the main game, since there is only one promotion with the effect, but it is annoying when I added an equipment with the same (and additional) effect.

Also, I'd really like it if having multiple promotions with twincast stacked. I don't care if each such promo doubles the number or just adds +1, but it should do something. Also, Twincast should really be made to boost direct damage spells, inctead of just summons.


You should also really change Marksman so that it doesn't target workers, hawks, equipment, etc.
 
Why does this code:

Code:
	def onCityRazed(self, argsList):
		'City Razed'
		city, iPlayer = argsList
		iOwner = city.findHighestCulture()

		pPlayer = gc.getPlayer(iPlayer)
		if gc.getPlayer(city.getOriginalOwner()).getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
			for i in range(city.getPopulation()/5 + 1):
				cf.giftUnit(gc.getInfoTypeForString('UNIT_ENSLAVED'), gc.getInfoTypeForString('CIVILIZATION_LEGION'), 0, city.plot(), city.getOwner())


		pPlayer = gc.getPlayer(iPlayer)
		if gc.getPlayer(city.getOriginalOwner()).getAlignment() == gc.getInfoTypeForString('ALIGNMENT_NEUTRAL'):
			for i in range(city.getPopulation()/5 + 1):
				cf.giftUnit(gc.getInfoTypeForString('UNIT_ENSLAVED'), gc.getInfoTypeForString('CIVILIZATION_LEGION'), 0, city.plot(), city.getOwner())


		pPlayer = gc.getPlayer(iPlayer)
		if gc.getPlayer(city.getOriginalOwner()).getAlignment() == gc.getInfoTypeForString('ALIGNMENT_GOOD'):
			for i in range(city.getPopulation()/5 + 1):
				cf.giftUnit(gc.getInfoTypeForString('UNIT_ENSLAVED'), gc.getInfoTypeForString('CIVILIZATION_LEGION'), 0, city.plot(), city.getOwner())

		CvUtil.pyPrint("City Razed Event: %s" %(city.getName(),))

cause units to appear both in the city site I raze and the capital of the Legion? I do know this happens on the razing of any city (that's intended).
 
any chance of adding a Scorched Earth game option? i.e. that makes everyone auto-raze any new cities they acquire

for scenarios sometimes i like to set it up that you cant gain any other cities than those you start with, usually i achieve this by One City Challenge (human players cant build settlers and automatically raze any captured cities) or No Settlers, or both, but One City Challenge only applies to humans, not AIs. would be nice to be able to make games where the AI doesnt super expand via conquering barb cities or other players.
 
@Xienwolf: Yeah, that's exactly what I'm looking for.

Just my luck; I looked through the SDK code, and it turns out there already is a getWeaponTier() function, it's just not exposed to python. Now my only issue is actually compiling the SDK; it's giving me an undeclared identifier error right now. I think it's got something to do with the Undercouncil's gambling ring resolution. Is there an easy way to fix this?
Code:
CvGame.cpp(576) : error C2065: 'm_pabGamlbingRing' : undeclared identifier
 
Back
Top Bottom