Mod-Modders Guide to Fall Further

The research you gain will be toward the TechPrereq of the unit you killed or any promotions on the unit. It is meant as a "reverse engineering" concept, so you won't wind up learning Omniscience after killing a warrior.

I see. Wondering how you know so much :)
It seems the mechanic is not used however (not found in the XML files).
I will have to find another way to get beaker from combat then.

Thank you nonetheless.

EDIT: While you're online, I'm sure you know where to look for the mechanic creating the "emperor's mark" in every scions cities, and the "demonic citizen" in every infernal cities ?
I was planning to implement a similar mechanic but I cannot seem to locate the entry point for choosing the building to create.
 
The Emperor's mark is in def OnCityBuilt in CvEventManager.py.

Code:
if pPlayer.getLeaderType() == gc.getInfoTypeForString('LEADER_RISEN_EMPEROR'):
	city.setNumRealBuilding(gc.getInfoTypeForString('BUILDING_EMPERORS_MARK'), 1)

I don't understand how my windows search did not find it ! :(
Thank you ! :)
 
Do you know a way to know the list of available functions/members for a python object ?

I would like to add some beaker to a player through a spell, but I don't know how to add science to his research (I plan to use the PyResult in the spell info):

def spellAnalyze(caster):
pPlayer = gc.getPlayer(caster.getOwner())
...?

EDIT: I used the following copy from existing code:

def spellAnalyze(caster):
pPlayer = gc.getPlayer(caster.getOwner())
eTeam = gc.getTeam(pPlayer.getTeam())
iTech = pPlayer.getCurrentResearch()
iNum = 100
eTeam.changeResearchProgress(iTech, iNum, caster.getOwner())

But I can see no change in the progress bar of the tech when casting the spell.
Help ?
 
I'm not sure if your tech progress updates between turns. Some things the game is set to only update at the start of each turn. Check in the F6 menu doing a mouseover of the tech in question, that might update immediately upon gaining research (or test your spell so early in the game that 100 is FAR more than you gain by yourself and just end the turn and check the change)
 
So stupid, forgot to change the spell name from another doing the same without the beaker gain! :(
 
Ok, running into just one more minor problem.

I've used [PARAGRAPH:1] to add linebreaks in my strategy text for sabathiel. And it works perfectly in thepedia

But in the popup that appears when heroes are built, it says "tab" where I've done that.
It doesn't seem to only be my problem. Quite a lot of the hero popups have that in them.

Is there any way to work around this? It's kind of annoying.
 
So stupid, forgot to change the spell name from another doing the same without the beaker gain! :(

Don't feel bad, I've done it so many times I've lost count. Or added it to the wrong unit while trying to test it, or forgot to add a ':' at the end of a line.... :crazyeye:
 
Oh, and two farther problems.

I want sabathiel to abandon the Bannor if their alignment drops from good. I set bAbandon, and prereq alignment good, but it doesn't seem to be working. Is this only for religion?

I don't want to lock them into Order, just to maintaining a good alignment. Converting to Ashen Veil isn't making him abandon them though.


Second problem. Sabathiel's unit religion is Order, but he doesn't seem to be able to learn Command IV. Is that a state religion prereq? I thought it just required an Order unit...
 
Ugh. Trying to add a Baron only Hero, Varulv. Got him in game, only Baron can build him, everything works... Except for the werewolf part. He stubbornly refuses to create werewolves from combat... What am I doing wrong?

Code:
<UnitInfo>		<!-- Beastmaster -->
	<Class>UNITCLASS_DOVIELLO_WEREWOLF</Class>
	<Type>UNIT_DOVIELLO_WEREWOLF</Type>
	<Combat>UNITCOMBAT_BEAST</Combat>
	<DefaultUnitAI>UNITAI_EXPLORE</DefaultUnitAI>
	<SeeInvisible>INVISIBLE_ANIMAL</SeeInvisible>
	<Description>TXT_KEY_UNIT_DOVIELLO_WEREWOLF</Description>
	<Civilopedia>TXT_KEY_UNIT_PLACEHOLDER_PEDIA</Civilopedia>
	<Strategy>TXT_KEY_UNIT_WEREWOLF_STRATEGY</Strategy>
	<Advisor>ADVISOR_GROWTH</Advisor>
	<bMilitaryHappiness>1</bMilitaryHappiness>
	<bMilitarySupport>1</bMilitarySupport>
	<bMilitaryProduction>1</bMilitaryProduction>
	<UnitAIs>
		<UnitAI>
			<UnitAIType>UNITAI_ATTACK</UnitAIType>
			<bUnitAI>1</bUnitAI>
		</UnitAI>
		<UnitAI>
			<UnitAIType>UNITAI_PILLAGE</UnitAIType>
			<bUnitAI>1</bUnitAI>
		</UnitAI>
	</UnitAIs>
	<PrereqTech>TECH_ANIMAL_MASTERY</PrereqTech>
	<iCost>400</iCost>
	<iMoves>3</iMoves>
	<iCombat>11</iCombat>
	<iCityAttack>-20</iCityAttack>
	<iAsset>16</iAsset>
	<iPower>33</iPower>
	<UnitMeshGroups>
		<iGroupSize>3</iGroupSize>
		<iMeleeWaveSize>3</iMeleeWaveSize>
		<iRangedWaveSize>0</iRangedWaveSize>
		<UnitMeshGroup>
			<iRequired>1</iRequired>
			<EarlyArtDefineTag>ART_DEF_UNIT_DUIN</EarlyArtDefineTag>
		</UnitMeshGroup>
		<UnitMeshGroup>
			<iRequired>1</iRequired>
			<EarlyArtDefineTag>ART_DEF_UNIT_GREATER_WEREWOLF</EarlyArtDefineTag>
		</UnitMeshGroup>
		<UnitMeshGroup>
			<iRequired>1</iRequired>
			<EarlyArtDefineTag>ART_DEF_UNIT_GREATER_WEREWOLF</EarlyArtDefineTag>
		</UnitMeshGroup>
	</UnitMeshGroups>
	<FreePromotions>
		<FreePromotion>
			<PromotionType>PROMOTION_WEREWOLF</PromotionType>
			<bFreePromotion>1</bFreePromotion>
		</FreePromotion>
	</FreePromotions>
	<iTier>4</iTier>
	<UnitCreateFromCombat>UNIT_RAVENOUS_WEREWOLF</UnitCreateFromCombat>
	<iUnitCreateFromCombatChance>75</iUnitCreateFromCombatChance>
</UnitInfo>
 
bAbandon works for religion and civics only, assuming Xienwolf hasn't changed that from FfH


Command IV uses the default BtS method of having a state religion as a promotion prereq. I think that Xienwolf added the ability to make it depend on the unit's religion instead/too, but didn't use it here.
 
Some questions about the Venomous Web spell

I'd like to give it to Mother. Or rather, a stronger version.

I noticed first of all, that there are two copies of it in the spellinfos. One for haruspex, and one for textus spiders

Why is this? Can't one spell be used for both?

Also, what is the <iResistModify>30</iResistModify> tag for? In my experience of using it, it seemed to be resisted a lot more than 30% of the time.

In which direction should I adjust this value if I wanted to make it work more often?
 
Ugh. Trying to add a Baron only Hero, Varulv. Got him in game, only Baron can build him, everything works... Except for the werewolf part. He stubbornly refuses to create werewolves from combat... What am I doing wrong?

Code:
<UnitInfo>		<!-- Varulv -->
	<Class>UNITCLASS_DOVIELLO_WEREWOLF</Class>
	<Type>UNIT_DOVIELLO_WEREWOLF</Type>
	<Combat>UNITCOMBAT_BEAST</Combat>
	<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
	<Description>TXT_KEY_UNIT_DOVIELLO_WEREWOLF</Description>
	<Civilopedia>TXT_KEY_UNIT_PLACEHOLDER_PEDIA</Civilopedia>
	<Strategy>TXT_KEY_UNIT_WEREWOLF_STRATEGY</Strategy>
	<Advisor>ADVISOR_MILITARY</Advisor>
	<bMilitaryHappiness>1</bMilitaryHappiness>
	<bMilitaryProduction>1</bMilitaryProduction>
	<bPillage>1</bPillage>
	<UnitAIs>
		<UnitAI>
			<UnitAIType>UNITAI_ATTACK</UnitAIType>
			<bUnitAI>1</bUnitAI>
		</UnitAI>
		<UnitAI>
			<UnitAIType>UNITAI_PILLAGE</UnitAIType>
			<bUnitAI>1</bUnitAI>
		</UnitAI>
		<UnitAI>
			<UnitAIType>UNITAI_RESERVE</UnitAIType>
			<bUnitAI>1</bUnitAI>
		</UnitAI>
		<UnitAI>
			<UnitAIType>UNITAI_COUNTER</UnitAIType>
			<bUnitAI>1</bUnitAI>
		</UnitAI>
		<UnitAI>
			<UnitAIType>UNITAI_CITY_DEFENSE</UnitAIType>
			<bUnitAI>1</bUnitAI>
		</UnitAI>
	</UnitAIs>
	<PrereqTech>TECH_ANIMAL_MASTERY</PrereqTech>
	<iAIWeight>200</iAIWeight>
	<iCost>500</iCost>
	<iMoves>3</iMoves>
	<iCombat>11</iCombat>
	<iXPValueAttack>32</iXPValueAttack>
	<iXPValueDefense>16</iXPValueDefense>
	<iCultureGarrison>16</iCultureGarrison>
	<iAsset>16</iAsset>
	<iPower>33</iPower>
	<UnitMeshGroups>
		<iGroupSize>3</iGroupSize>
		<iMeleeWaveSize>3</iMeleeWaveSize>
		<iRangedWaveSize>0</iRangedWaveSize>
		<UnitMeshGroup>
			<iRequired>1</iRequired>
			<EarlyArtDefineTag>ART_DEF_UNIT_DUIN</EarlyArtDefineTag>
		</UnitMeshGroup>
		<UnitMeshGroup>
			<iRequired>1</iRequired>
			<EarlyArtDefineTag>ART_DEF_UNIT_GREATER_WEREWOLF</EarlyArtDefineTag>
		</UnitMeshGroup>
		<UnitMeshGroup>
			<iRequired>1</iRequired>
			<EarlyArtDefineTag>ART_DEF_UNIT_GREATER_WEREWOLF</EarlyArtDefineTag>
		</UnitMeshGroup>
	</UnitMeshGroups>
	<FreePromotions>
		<FreePromotion>
			<PromotionType>PROMOTION_WEREWOLF</PromotionType>
			<bFreePromotion>1</bFreePromotion>
		</FreePromotion>
		<FreePromotion>
			<PromotionType>PROMOTION_CANNIBALIZE</PromotionType>
			<bFreePromotion>1</bFreePromotion>
		</FreePromotion>
	</FreePromotions>
	<iTier>3</iTier>
	<Image>Art/Interface/Popups/Baron Duin Halfmorn.dds</Image>
	<Quote>TXT_KEY_POPUP_BARON_DUIN_CREATION</Quote>
	<UnitCreateFromCombat>UNIT_RAVENOUS_WEREWOLF</UnitCreateFromCombat>
	<iUnitCreateFromCombatChance>75</iUnitCreateFromCombatChance>
</UnitInfo>

Aggh. Still not working, whether I put it in a modular xml file or the full file. Searched all the python to see if it's handled there, couldn't find anything... What am I doing wrong? It's an exact clone of Duin, all I changed was the name, tech, and artstyle.... :confused::confused:
 
Hi,

I am trying to mod FF, everything was fine until i run into problem.

The problem: I added few new tags to xml and modified the dll to load those new tags, but on the starting at the game, when it is loading xml info, game crashes.

I narrowed down to point where it stopped crashing, the part i commented out:
Code:
bool CvPromotionInfo::read(CvXMLLoadUtility* pXML)
{
...	
[B]pXML->GetChildXmlValByName(&m_fExtraXPValueAttack, "iExtraXPValueAttack");
pXML->GetChildXmlValByName(&m_fExtraXPValueDefense, "iExtraXPValueDefense");[/B]
but I don't see anything wrong here. I am using FF patch N source code.
I had similar problem before the patch N (i think it was patch M or L) and oddly the crashing stopped when i relocated the code.


Here is all the code i have added:
Spoiler :

XML Scheme:
Code:
[B]	<ElementType name="iExtraXPValueAttack" content="textOnly" dt:type="float"/>
	<ElementType name="iExtraXPValueDefense" content="textOnly" dt:type="float"/>[/B]

<ElementType name="PromotionInfo" content="eltOnly">
...
[B]	<element type="iExtraXPValueAttack" minOccurs="0"/>
	<element type="iExtraXPValueDefense" minOccurs="0"/>[/B]

CvInfos.h:
Code:
class CvPromotionInfo :	public CvHotkeyInfo
public:
...
[B]	DllExport int getExtraXPValueAttack() const;			// Exposed to Python
	DllExport int getExtraXPValueDefense() const;			// Exposed to Python[/B]
...
protected:
...
[B]	float m_fExtraXPValueAttack;
	float m_fExtraXPValueDefense;[/B]
Cv.Infos.cpp:
Code:
CvPromotionInfo::CvPromotionInfo() :
...
[B]m_fExtraXPValueAttack(0.0f),
m_fExtraXPValueDefense(0.0f),[/B]
...
Code:
[B]int CvPromotionInfo::getExtraXPValueAttack() const
{
	return (int)(m_fExtraXPValueAttack*100);
}

int CvPromotionInfo::getExtraXPValueDefense() const
{
	return (int)(m_fExtraXPValueDefense*100);
}[/B]
Code:
void CvPromotionInfo::read(FDataStreamBase* stream)
{
...
[B]	stream->Read(&m_fExtraXPValueAttack);
	stream->Read(&m_fExtraXPValueDefense);[/B]
...
Code:
void CvPromotionInfo::write(FDataStreamBase* stream)
{
...
[B]	stream->Write(m_fExtraXPValueAttack);
	stream->Write(m_fExtraXPValueDefense);[/B]
...
Code:
bool CvPromotionInfo::read(CvXMLLoadUtility* pXML)
{
...
[B]	pXML->GetChildXmlValByName(&m_fExtraXPValueAttack, "iExtraXPValueAttack");
	pXML->GetChildXmlValByName(&m_fExtraXPValueDefense, "iExtraXPValueDefense");[/B]
 
Include at least 3 lines before and after everything which you added. Context can be quite important sometimes, like if you accidentally placed yourself inside of a loop or conditional, or before/after some major (re)definition of key variables. If relocating the code had solved the issue, it is fairly likely something along those lines may be happening.

I would advise that you make the XML field be called fExtraXPValueAttack/Defense though, so that people know it will accept float values without having to read the schema. Currently all the other XP values violate this rule of thumb only because it would be a bit of a nuisance to update all of the entries appropriately (well, with find/replace not THAT much of a nuisance actually...)

Also, do you have any promotions trying to use this field already? If so, what values do you have entered? And did you test the XML changes without the DLL changes?
 
Another thing to try: If your are using Visual Studio and you add a new variable to CvInfos you have to rebuild the whole project, not only your changed files. I ran into quite some trouble because of this behaviour in my early modding days. Got errors at the strangest of places.
 
I'd suspect that something has caused that entire function to go buggy, as someone has posted in the bug thread that their air elemental wasn't popping out lightning elementals. But I haven't got time to debug anything right now.
 
Back
Top Bottom