Modders Guide to FfH2

Got another problem, a weird one this time.

I have added The White Hand as an adoptable religion, but my version differs in several points from RifE version.

I have added a code to allow religion to modify terrain yields. Plusd I do not want it to stack with bonuses that Illians & doviello already get from winter terrain.
It is working fine on vista and win7, while on XP it causes UI crash (i.e. when founding a city)

The added code is in CvPlot::calculateNatureYield my addition is marked in red

Code:
/*************************************************************************************************/
/**	CivPlotMods								03/23/09								Jean Elcard	**/
/**			Civilization Terrain Yield Changes																					**/
/**				No longer needed. Replaced (in a better way) by Civ-specific Yields.			**/
/*************************************************************************************************/
/**								---- Start Original Code ----									**
//FfH: Added by Kael 09/25/2008
    if (isOwned())
    {
        if (GET_PLAYER(getOwnerINLINE()).getCivilizationType() == GC.getTerrainInfo((TerrainTypes)getTerrainType()).getCivilizationYieldType())
        {
            iYield += GC.getTerrainInfo((TerrainTypes)getTerrainType()).getCivilizationYieldChange(eYield);
        }
    }
//FfH: End Add
/**								----  End Original Code  ----									**/
	if (eTeam != NO_TEAM)
	{
		for (int iI = 0; iI < MAX_CIV_PLAYERS; iI++)
		{
			if (GET_PLAYER((PlayerTypes)iI).isAlive())
			{
				if (GET_PLAYER((PlayerTypes)iI).getTeam() == eTeam)
				{
					iYield += GC.getCivilizationInfo(GET_PLAYER((PlayerTypes)iI).getCivilizationType()).getTerrainYieldChanges(getTerrainType(), eYield);

[COLOR="Red"]					if (GC.getCivilizationInfo(GET_PLAYER((PlayerTypes)iI).getCivilizationType()).getTerrainYieldChanges(getTerrainType(), eYield) == 0)
					{
						if (GET_PLAYER(getOwnerINLINE()).getStateReligion() != NO_RELIGION)
						{
							iYield += GC.getReligionInfo(GET_PLAYER(getOwnerINLINE()).getStateReligion()).getReligionTerrainYields(getTerrainType(), eYield);
						}
					}[/COLOR]

				}
			}
		}
	}
/*************************************************************************************************/
/**	CivPlotMods								END													**/
/*************************************************************************************************/
Any ideas what is wrong?
 
What, if any, is the code in CvRandomEventInterface.py to check to see if a city is actually a Kuriotates settlement?
I tried below

Code:
def canTriggerCityKuriotatesWorkboat(argsList):
	eTrigger = argsList[0]
	ePlayer = argsList[1]
	iCity = argsList[2]
	pPlayer = gc.getPlayer(ePlayer)
	pCity = pPlayer.getCity(iCity)
	if pCity.isHasRealBuilding(iSettlement) == False:
		return False
	return True

but the iSettlement line specifically fails and the py file doesn't load when I test fire the event with this code.
 
You are using getOwner instead of PlayerTypes)iI like the rest of the function is doing. Since you seem to have removed the isOwned() check from Kael's code, that means this can crash when run on an unowned tile.

Thanks a lot! That is exactly what was wrong - now works as intended :)
Another lesson learned...
 
Code:
totalmages=pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_ADEPT'),pCity.area())+pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_MAGE'),pCity.area())
						totalmelee=pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_AXEMAN'),pCity.area())+pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_CHAMPION'),pCity.area())
						totalarchers=pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_LONGBOWMAN'),pCity.area())+pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_ARCHER'),pCity.area())
						totalrecon=pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_HUNTER'),pCity.area())+pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_RANGER'),pCity.area())
						totalsiege=pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_CATAPULT'),pCity.area())+pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_CANNON'),pCity.area())
						totalmounted=pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_HORSEMAN'),pCity.area())+pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_HORSE_ARCHER'),pCity.area())

What units is this counting? Compared to a normal getUnitClassCount?
 
That code is creating six different variables to count units with. It does seem to be missing quite a few units though, such as Warriors and Scouts.

Where did you pull this code from?

It's from AiChooseproduction in CvGameUtils, under civspecific and conquestmode.

What i wanto know is what the differance between
pPlayer.getConquestUnitClassCount(gc.getInfoTypeForString('UNITCLASS_X'),pCity.area())
and
pPlayer.getUnitClassCountPlusMaking(gc.getInfoTypeForString('UNITCLASS_X'))

I have studied the following functions (not the ones I quoted but ones built on it) and it produces a sort of chain reaction, the more units being built, the higher units are being valued. I am trying to remedy that by altering the functions, but without knowing what getConquestUnitClassCount counts it´s hard to getting to work as i intend.
 
counts all units in an area with the conquest groupflag. So no city defense archers, only stack defender archers, no terraforming wizards, only warwizards.
 
How hard is it to change the leader for a civ mid-game? I just got to thinking I might want to make Auric Ulvin not start a game as the leader of the Illians, but instead take over once they find Letum Frigus.
 
How hard is it to change the leader for a civ mid-game? I just got to thinking I might want to make Auric Ulvin not start a game as the leader of the Illians, but instead take over once they find Letum Frigus.

I was able to enable it in python with a few lines of C++. There may be another way, but this is easiest if you feel like making a new DLL.

Spoiler code :
cyplayerinterface1.cpp
Code:
/*************************************************************************************************/
/**	QuickChange								08/24/09	Written: Cyther							**/
/**																								**/
/**	Allows switching leader and civ																**/
/*************************************************************************************************/
		.def("setLeaderType", &CyPlayer::setLeaderType, "void (int eTargetPlayer, int eNewValue)")
/*************************************************************************************************/
/**	QuickChange								END													**/
/*************************************************************************************************/

cyplayer.h
Code:
/*************************************************************************************************/
/**	QuickChange								08/24/09	Written: Cyther							**/
/**																								**/
/**	Allows switching leader and civ																**/
/*************************************************************************************************/
	void setLeaderType(int /*PlayerTypes*/ eTargetPlayer, int /*LeaderHeadTypes*/ eLeader);
/*************************************************************************************************/
/**	QuickChange								END													**/
/*************************************************************************************************/

cyplayer.cpp
Code:
/*************************************************************************************************/
/**	QuickChange								08/24/09	Written: Cyther							**/
/**																								**/
/**	Allows switching leader and civ																**/
/*************************************************************************************************/
void CyPlayer::setLeaderType(int eTargetPlayer, int eLeader)
{
	if (m_pPlayer)
	{
		m_pPlayer->setLeaderType((PlayerTypes)eTargetPlayer, (LeaderHeadTypes)eLeader);
	}
}

/*************************************************************************************************/
/**	QuickChange								END													**/
/*************************************************************************************************/

cvplayer.h
Code:
/*************************************************************************************************/
/**	QuickChange								08/23/09	Written: Cyther							**/
/**																								**/
/**	Allows switching leader and civ																**/
/*************************************************************************************************/
	void setLeaderType(PlayerTypes eTargetPlayer,LeaderHeadTypes eLeader);																									// Exposed to Python
/*************************************************************************************************/
/**	QuickChange								END													**/
/*************************************************************************************************/

cvplayer.cpp
Code:
/*************************************************************************************************/
/**	QuickChange								08/24/09	Written: Cyther							**/
/**																								**/
/**	Allows switching leader and civ																**/
/*************************************************************************************************/

void CvPlayer::setLeaderType(PlayerTypes eTargetPlayer, LeaderHeadTypes eLeader)
{
	GC.getInitCore().setLeader((PlayerTypes)eTargetPlayer, (LeaderHeadTypes)eLeader);
}

/*************************************************************************************************/
/**	QuickChange								END													**/
/*************************************************************************************************/

cvplayer1.h
Code:
/*************************************************************************************************/
/**	QuickChange								08/23/09	Written: Cyther							**/
/**																								**/
/**	Allows switching leader and civ																**/
/*************************************************************************************************/
	void setLeaderType(PlayerTypes eTargetPlayer,LeaderHeadTypes eLeader);																									// Exposed to Python
/*************************************************************************************************/
/**	QuickChange								END													**/
/*************************************************************************************************/

I put them in under getLeaderType.
 
If I have a single promotion or a set of promotions give a unit +1 Mana Afinity and -50% strenth, do the two colide or ignore each other.

For example, if I have a strenth 4 unit and 2 Mana nodes will the result with said promotion be a total of (4/2)+2 or (4+2)/2.
 
I am working on improving the AI for the Illians and of course then rituals are becoming an issue. Like many are saying "if you can build Ascend you have already won", but the isn't really true for the AI. Anyway i think it's a challenge to see if i a can improve the the AI for this.

What i am thinking on is that teching for Omnisence is pretty sttep if you have not started on The Draw yet. On the other hand building The Draw and the not being close to Omniscense isn't very smart either.

So i have two quistions.
1) How can I check if a ritual is completed in CvGameUtils? Is there a way see if the AI have started a ritual and how far it have progressed?

2) How high should the AI value the Illian ritual and the techs required? Any general suggestions? Maybe this isn't the forum for this question and i don't intend to start a discussion about it. But a hint if anyone answers the other question or a PM would be appresiated.
Attaching the endresearch prioroty
Spoiler :
Code:
# Final Research		
			
		if (bTier3 and bEcon2):
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_FUTURE_TECH')) == False:
				iTech = gc.getInfoTypeForString('TECH_FUTURE_TECH')				
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_THEOLOGY')) == False:
				iTech = gc.getInfoTypeForString('TECH_THEOLOGY')				
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_RAGE')) == False:
				if iCiv != gc.getInfoTypeForString('CIVILIZATION_SVARTALFAR') and iCiv != gc.getInfoTypeForString('CIVILIZATION_LUCHUIRP') and iCiv != gc.getInfoTypeForString('CIVILIZATION_LJOSALFAR') and iCiv != gc.getInfoTypeForString('CIVILIZATION_SHEAIM'):
					iTech = gc.getInfoTypeForString('TECH_RAGE')				
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MITHRIL_WEAPONS')) == False and iCiv != gc.getInfoTypeForString('CIVILIZATION_SHEAIM'):
				iTech = gc.getInfoTypeForString('TECH_MITHRIL_WEAPONS')				
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MACHINERY')) == False:
				iTech = gc.getInfoTypeForString('TECH_MACHINERY')
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_ASTRONOMY')) == False:
				iTech = gc.getInfoTypeForString('TECH_ASTRONOMY')
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MEDICINE')) == False:
				iTech = gc.getInfoTypeForString('TECH_MEDICINE')
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_GUILDS')) == False:
				iTech = gc.getInfoTypeForString('TECH_GUILDS')
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MERCANTILISM')) == False:
				iTech = gc.getInfoTypeForString('TECH_MERCANTILISM')
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_ANIMAL_HANDLING')) and iCiv != gc.getInfoTypeForString('CIVILIZATION_LUCHUIRP'):
				if eTeam.isHasTech(gc.getInfoTypeForString('TECH_ANIMAL_MASTERY')) == False:
					iTech = gc.getInfoTypeForString('TECH_ANIMAL_MASTERY')				
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_BOWYERS')):
				if eTeam.isHasTech(gc.getInfoTypeForString('TECH_PRECISION')) == False:
					if iCiv != gc.getInfoTypeForString('CIVILIZATION_LUCHUIRP') and iCiv != gc.getInfoTypeForString('CIVILIZATION_KHAZAD') and iCiv != gc.getInfoTypeForString('CIVILIZATION_DOVIELLO'):				
						iTech = gc.getInfoTypeForString('TECH_PRECISION')				
			if bHasHorse:
				if eTeam.isHasTech(gc.getInfoTypeForString('TECH_WARHORSES')) == False:
					iTech = gc.getInfoTypeForString('TECH_WARHORSES')				
			if pPlayer.getAlignment() == gc.getInfoTypeForString('ALIGNMENT_EVIL'):
				if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MALEVOLENT_DESIGNS')) == False:
					iTech = gc.getInfoTypeForString('TECH_MALEVOLENT_DESIGNS')
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_STRENGTH_OF_WILL')) == False:
				iTech = gc.getInfoTypeForString('TECH_STRENGTH_OF_WILL')
			if eTeam.isHasTech(gc.getInfoTypeForString('TECH_POISONS')) == False:
				iTech = gc.getInfoTypeForString('TECH_POISONS')
			if pPlayer.hasTrait(gc.getInfoTypeForString('TRAIT_SPIRITUAL')):
				if eTeam.isHasTech(gc.getInfoTypeForString('TECH_THEOLOGY')) == False:
					iTech = gc.getInfoTypeForString('TECH_THEOLOGY')				
			if pPlayer.canResearch(gc.getInfoTypeForString('TECH_ENGINEERING'),False):																				
				iTech = gc.getInfoTypeForString('TECH_ENGINEERING')
			if bHasMithril and iCiv != gc.getInfoTypeForString('CIVILIZATION_SHEAIM'):
				if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MITHRIL_WORKING')) == False:
					iTech = gc.getInfoTypeForString('TECH_MITHRIL_WORKING')				
			if iFavRel!=ReligionTypes.NO_RELIGION:
				if iFavRel== gc.getInfoTypeForString('RELIGION_OCTOPUS_OVERLORDS'):
					if eTeam.isHasTech(gc.getInfoTypeForString('TECH_FANATICISM')) == False:
						iTech = gc.getInfoTypeForString('TECH_FANATICISM')				
				if iFavRel== gc.getInfoTypeForString('RELIGION_THE_ASHEN_VEIL'):
					if eTeam.isHasTech(gc.getInfoTypeForString('TECH_MALEVOLENT_DESIGNS')) == False:
						iTech = gc.getInfoTypeForString('TECH_MALEVOLENT_DESIGNS')
 
1) CyGame::getProjectCreatedCount(int /*ProjectTypes*/ eIndex)
 
Is there any unit in any of the FFH versions that has no knee or foot joints or in fact bones but rather has simple stick like legs with the only bone being the one starting at the pelvis and ending on the ground?
 
Hey, is it possible to effectively create world/national promotions? I'm wanting to do something with allowing Luchuirp golems be imbued with particular named entities, but I've run into the problem of having multiple versions of Utocur the Mildly Unpleasant running around.

Edit: I'm doing this with the RiFE code.
 
I am trying to make it so that if a faction has a pair of resources they automatically get a third one for free.

Essentially if you have resources A and B for each A+B you get 1 C

So 2A and 2B = 2C, 10A and 10B = 10C and so on.

Can this be done on a civ wide level and how? Also it should be limited to one single faction only.
 
Back
Top Bottom