Mod-Modders Guide to Fall Further

In regards to the bug I mentioned above with my custom summonable civ;

I made the following changes to CIV4TechInfos.xml:

-Removed the Ashen Veil as a prereq religion for Infernal Pact
-Set Infernal Pact to require 1 beaker.

I started a game, randomly assigned civ (it was the Kuriotates) and gave myself Corruption of Spirit via worldbuilder. I then started researching Infernal Pact after founding a city and fortifying my units. The next turn, I had to set my city to build something, speak with Hyborem (he appeared right next to me) and set a new technology to research. At that point, it offered me to flip to Hyborem, and I said yes.

The screenshot below is the result. As you can see, there's the same "terrain not being revealed/de-revealed correctly" problem, at least on my computer. I still don't know if this is just a problem on my computer or something wrong with the actual code- but now we have confirmation it isn't something wrong with onProjectBuilt.

A friend of mine had the same problem. Xien, you are welcome.
 
@ Xienwolf: when you changed the mod to have multiple barbarian factions did you by chance include a way to add more barbarian factions? or is there no easy way to add, say, 2 more?

Assuming I remember correctly, he set it up so that you CAN add more, and relatively easily if comfortable with the DLL. Again, from memory, the only limitation is that only the 'main' barb civ can control cities.
 
Yes, More can be added "easily."

DLL modification is required, lots of one-liners in InitCore which will essentially be duplicates of what is already there, then rules for spawning and tech advancement if you want either to happen, as well as any other special rules you wish to enforce (like Animals not being allowed to enter borders from the wild). If you want all units to come from some other source, like Frostlings from Python after/during Samhain, you can skip most everything except for the one-liners (which are primarily in InitCore, but also in a few other places, I think CvPlayerAI and CvTeamAI).

A search for DEMON_ should show you every place in which a change is required, plus a FEW places where it is optional. Basically if ANIMAL_ is the line right above it and the line with DEMON_ is the last line, it is probably required.
 
I just met a new problem concerning the support for unit outside cities.
While I can easily make unit free for the cost, I cannot find a way to make unit support also costs nothing. Indeed when I check the DLL function it gives:

Code:
int CvPlayer::calculateUnitSupply(int& iPaidUnits, int& iBaseSupplyCost) const
{
	int iSupply;

	iPaidUnits = std::max(0, (getNumOutsideUnits() - GC.getDefineINT("INITIAL_FREE_OUTSIDE_UNITS")));

	iBaseSupplyCost = iPaidUnits * GC.getDefineINT("INITIAL_OUTSIDE_UNIT_GOLD_PERCENT");
	iBaseSupplyCost /= 100;

	iSupply = iBaseSupplyCost;

	if (!isHuman() && !isBarbarian())
	{
		iSupply *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIUnitSupplyPercent();
		iSupply /= 100;

		iSupply *= std::max(0, ((GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIPerEraModifier() * getCurrentEra()) + 100));
		iSupply /= 100;
	}

	FAssert(iSupply >= 0);

	return iSupply;
}

Do you know a way to do it ?
Or can I at least change the value of INITIAL_OUTSIDE_UNIT_GOLD_PERCENT or INITIAL_FREE_OUTSIDE_UNITS either for one civ or for the whole game ?
 
OK I found how to completely remoe the Gold calculation throught Python, so t solves my problem:

Code:
	def doGold(self,argsList):
		ePlayer = argsList[0]
		if gc.getPlayer(ePlayer).hasTrait(gc.getInfoTypeForString('TRAIT_TEAR'))):
			return True
		return False
 
For others who encounter the same issue in the future, you can just use the bFreeUnit tag and it blocks unit cost for that unit, and makes it provide you with 1 additional free support for units outside borders whenever it leaves borders for you. I cannot remember why I went that route instead of making it simply not increase the number of units outside of borders, I probably had some plans which required tracking that to remain accurate in the future though.
 
For others who encounter the same issue in the future, you can just use the bFreeUnit tag and it blocks unit cost for that unit, and makes it provide you with 1 additional free support for units outside borders whenever it leaves borders for you. I cannot remember why I went that route instead of making it simply not increase the number of units outside of borders, I probably had some plans which required tracking that to remain accurate in the future though.

Actually all my units have the bFreeUnit tag on in their race, but they still cost supply.
From the DLL code I do not see the behavior you describe concerning supply. Was it implemented elsewhere ?

Code:
			<Type>PROMOTION_TEAR</Type>
			<Description>TXT_KEY_PROMOTION_TEAR</Description>
			<Button>Modules\NormalModules\Tears\Art\Buttons\Promotions\Tear.dds</Button>
			<PrereqCivilizations>
				<PrereqCivilization>CIVILIZATION_TEARS</PrereqCivilization>
			</PrereqCivilizations>
			<bFreeUnit>1</bFreeUnit>
			<bImmuneToCapture>1</bImmuneToCapture>
			<bImmuneToFear>1</bImmuneToFear>
			<bNotAlive>1</bNotAlive>
			<bRace>1</bRace>
			<DamageTypeResists>
				<DamageTypeResist>
					<DamageType>DAMAGE_FIRE</DamageType>
					<iResist>5</iResist>
				</DamageTypeResist>
			</DamageTypeResists>

EDIT : actually it may have worked in 0.50 :)
 
Not 100% certain I set it up to work in UnitInfos, but the PromotionInfos tag works as described.

I would give you a savegame to show you but then you would need the modmodmod.
I assure you however that while all units have the racial promotion TEAR which has the tag bFreeUnit on, I'm paying unit supply but no unit cost.

Maybe it works in UnitInfo and not in PromotionInfo ?
 
Ah, I am remembering the wrong dang tag.

<bFreeUnit> is a BtS tag which already existed in UnitInfos, and makes them immune to Military Unit Costs (which only happen under Pacifism)

<bNoSupport> is my tag, and it makes the unit not cost normal unit maintenance, nor unit Supply (but doesn't affect Military Costs IIRC)
 
<bNoSupport> is my tag, and it makes the unit not cost normal unit maintenance, nor unit Supply (but doesn't affect Military Costs IIRC)

I'll try this one :)
Thanks !

EDIT : although I do not understand why it doesn't appear in the DLL source I have.
 
I'll try this one :)
Thanks !

EDIT : although I do not understand why it doesn't appear in the DLL source I have.

Working !

I just found (edit : ) a piece of (end edit :)) code about it ;)

Code:
	if (m_pUnitInfo->isMilitarySupport() && !isNoSupport())
/*************************************************************************************************/
/**	MilSupport 									END												**/
/*************************************************************************************************/
	{
		GET_PLAYER(getOwnerINLINE()).changeNumMilitaryUnits(-1);
	}

I'll just take care to have only military units.
 
The m_pUnitInfo->isMilitarySupport() checks if the unit is actually marked as a military unit. If it is not, then this doesn't happen. Or if it is, and it is flagged NoSupport, then this doesn't happen. There should be more code than just that one snippet though. I would say this one is from CvUnit::kill, there ought to be one in ::init and another 2 in ::setXY
 
How do I apply multiple promotions to units given through events using the <UnitPromotion></UnitPromotion> tag in EventInfos? When I try to add multiple promotions it only seems to add the first one in the list.
 
Question: if a unit that can cast Dominate loses Mind III as a promotion, does it lose control of the Dominated units? Or, say, if it has a miscast fire off and loses the ability to cast spells?
 
Nope. Nothing but death or willingly letting the units go stops domination. You could write a python function to execute on miscasts which strips Dominated units, but would have to apply it to every spell individually, there is no generic miscast python call. Or you could create a python event upon gaining the Miscast promotion (Fizzled?) which does it for you, that'd be a bit easier. Could also write a python event upon losing Mind III which strips you of Dominated units. But you cannot lose Mind III once you have gained it, unless you mod that function back into the code for some bizarre reason, so it doesn't matter much that we haven't written any pythonOnRemove function (don't think we have a pythonOnGain function yet either)
 
But you cannot lose Mind III once you have gained it, unless you mod that function back into the code for some bizarre reason, so it doesn't matter much that we haven't written any pythonOnRemove function (don't think we have a pythonOnGain function yet either)

One could lose Mind III by failing a domination attempt:

Code:
else:
	CyInterface().addMessage(caster.getOwner(),true,25,CyTranslator().getText("TXT_KEY_MESSAGE_DOMINATION_FAILED", ()),'',1,'Art/Interface/Buttons/Spells/Domination.dds',ColorTypes(7),pPlot.getX(),pPlot.getY(),True,True)
	caster.setHasPromotion(gc.getInfoTypeForString('PROMOTION_MIND3'), False)

I'm guessing you intended to change it, but forgot.
 
To be clear. Can anyone confirm whether or not you currently lose the Mind III promotion if a Domination casting fails.

For the sake of honesty, I've always thought that penalty was slly, and would be glad to see it gone.
 
Back
Top Bottom