Modders Guide to FfH2

You need to make a new unit class for your vampire warrior. A civ can only have build one unit from each unit class, so they need to be different classes if you want to have both available. See the CIV4UnitClassInfos.xml file.
 
Also, if you don't want any other civ to have access to this new unitclass (and the unit is supposed to be built or upgraded to instead of created in python, in whch case given them a cost of -1 will do), they will need to have NONE as their UU for it.
 
Can someone tell me is the number in "iSpellCasterXP-" is a % of add xp per turn or what? couse i dont understand this, if given "0" it will not gain any xp? I will be grateful for help.
 
Each turn, the unit has a % chance to gain SpellCaster XP based on a simple formula:

iSpellCasterXP - currentXP

That is the percent chance. So with iSpellCasterXP of 25, you can get up to 25XP before the free XP stops, but you have a 1% chance of gaining that XP point when at 24 XP on the unit, though a 5% chance to gain an XP while the unit was back at 20XP
 
Thanks Xienwolf, i have one more question, dose vampires gain xp from "iSpellCasterXP"
channeling I and channeling II, becouse from i saw channeling gives that bonus XP.
 
Is there a reason why the barbarian trait isn't the Clan of Embers civ trait and is instead given to each of their leaders?
 
I'm trying to add something similar to the Domination ability for a non-Fall from Heaven 2 mod (vanilla civ DLL). But I don't really understand, exactly, how the code works:

Code:
def spellDomination(caster):
	iSpell = gc.getInfoTypeForString('SPELL_DOMINATION')
	iX = caster.getX()
	iY = caster.getY()
	pPlayer = gc.getPlayer(caster.getOwner())
	iResistMax = 95
	iBestValue = 0
	pBestUnit = -1
	if pPlayer.isHuman() == false:
		iResistMax = 20
	iTeam = pPlayer.getTeam()
	eTeam = gc.getTeam(iTeam)
	for iiX in range(iX-1, iX+2, 1):
		for iiY in range(iY-1, iY+2, 1):
			pPlot = CyMap().plot(iiX,iiY)
			for i in range(pPlot.getNumUnits()):
				pUnit = pPlot.getUnit(i)
				iValue = 0
				if pUnit.isAlive():
					if pUnit.isDelayedDeath() == False:
						if eTeam.isAtWar(pUnit.getTeam()):
							iResist = pUnit.getResistChance(caster, iSpell)
							if iResist <= iResistMax:
								iValue = pUnit.baseCombatStr() * 10
								iValue = iValue + (100 - iResist)
								if iValue > iBestValue:
									iBestValue = iValue
									pBestUnit = pUnit
	if pBestUnit != -1:
		pPlot = caster.plot()
		if pBestUnit.isResisted(caster, iSpell) == false:
			CyInterface().addMessage(pBestUnit.getOwner(),true,25,CyTranslator().getText("TXT_KEY_MESSAGE_DOMINATION", ()),'',1,'Art/Interface/Buttons/Spells/Domination.dds',ColorTypes(7),pBestUnit.getX(),pBestUnit.getY(),True,True)
			CyInterface().addMessage(caster.getOwner(),true,25,CyTranslator().getText("TXT_KEY_MESSAGE_DOMINATION_ENEMY", ()),'',1,'Art/Interface/Buttons/Spells/Domination.dds',ColorTypes(8),pPlot.getX(),pPlot.getY(),True,True)
			newUnit = pPlayer.initUnit(pBestUnit.getUnitType(), pPlot.getX(), pPlot.getY(), UnitAITypes.NO_UNITAI, DirectionTypes.DIRECTION_SOUTH)
			newUnit.convert(pBestUnit)
			newUnit.changeImmobileTimer(1)

Can someone explain how this works?
 
If you are using the Vanilla civ dll, then you don't have the code allowing the game to call the CIV4SpellInfos.xml or the CvSpellInterface.py files so your units would not have the ablity to cast anything.
 
If you are using the Vanilla civ dll, then you don't have the code allowing the game to call the CIV4SpellInfos.xml or the CvSpellInterface.py files so your units would not have the ablity to cast anything.

You can if you use a python action button to do your ability (like Gods of Old, Afterworld, etc.) Or I could just do it in FFH, I suppose.


But what I guess I'm asking is how does the actual capturing code work? The "initUnit" and the "convert".
 
init unit creates for the player a new unit of that type on that plot with that UnitAI and facing that direction. (I believe the last 2 parameters were added with BtS, and tend to case problems if you actually try to give it an AI or a direction other than south.)


convert kills the unit referenced in the parenthesis and transfers its promotions, xp, levels, religion, etc, to the unit before the period.


I haven't modded much except based on FfH, but I assume these are normal functions and not ones Kael added (although some times, like convert taking the old unit's religion, were almost certainly changed by him).
 
Just a general AI modding question: Is there any way I can influence AI unit behavior in XML/python only? Specifically, I want Elohim units (played by AI) to visit un-visited unique features. Is this even possible to influence in python?
 
Just a general AI modding question: Is there any way I can influence AI unit behavior in XML/python only? Specifically, I want Elohim units (played by AI) to visit un-visited unique features. Is this even possible to influence in python?

You can control AI behavior via python to some degree, but in general, AI modding should be done in SDK, and I think that the SDK is where this would have to be done.
 
I would like to make a spell castable multiple times per turn, but become progressively more expensive each time, i.e., first costs 80 gold, second is 120, third is 180, fourth is 270, etc. Any idea how?
 
To do it right you would need some DLL modification. Otherwise you could make do with just python and the scenario counter. Set the spell to bIgnoreHasCasted, and set up a Python Require and Python Do field which will allow you to check fi they have enough money, and deduct some cash from their stores on casting.
 
Is there a reason why the barbarian trait isn't the Clan of Embers civ trait and is instead given to each of their leaders?
And what about that? Would it be equal to remove it from every single Clan leader and to pass it as their civTrait?
 
And what about that? Would it be equal to remove it from every single Clan leader and to pass it as their civTrait?

It would be the same either way. I use civ traits to indicate traits that are specific to one civilization. Barbarian is also used for other leaders so I left it as a leader trait.

The only real difference is if you were playing unrestricted leaders would you want this trait passed to "Varn of the Clan" or not? Likewise would you want "Jonus of the Malakim" to be friendly with the barbs or not? I opted to keep it with the leaders because it made mix and matching more interesting.
 
My main interest would be in improving the AI (mostly naval ability). Before I get too far into looking into how to do this however, I would like to ask a few questions.

1) Is there a reason the naval AI in FFH is so poor (not sending settlers to other continents, no real continent to continent naval battles)?

2) What tools/files (if any) do I need to get started?

3) Is this a realistic goal for a first time civ modder?
 
1) Is there a reason the naval AI in FFH is so poor (not sending settlers to other continents, no real continent to continent naval battles)?

It doesn't understand the crew promotions. In my version, I've increased the cargo of all naval units by 2 and the AI is a bit more competent with this.

And there are already heaps of AI mods in the modmods section.
 
Back
Top Bottom