Resource appearance dependent on number of cities?

JacenSaracen

Chieftain
Joined
Mar 26, 2011
Messages
36
Is it possible to edit a resource, or create a custom resource where the specific event that makes it appear on the map is when the player creates a specific number of cities?

For example, could you make IRON (or any other resource) appear only after the player has created their 10th city?
 
You could do probably do this in the DLL by adding an extra tag to the bonus info that contains the minimum city count and exposed this via something like CvBonusInfo::getMinCities() then making the following update would probably work:
Code:
BonusTypes CvPlot::getBonusType(TeamTypes eTeam) const
{
	if (eTeam != NO_TEAM)
	{
		if (m_eBonusType != NO_BONUS)
		{
			if [COLOR="Red"][B]([/B][/COLOR](!GET_TEAM(eTeam).isHasTech((TechTypes)(GC.getBonusInfo((BonusTypes)m_eBonusType).getTechReveal())) && !GET_TEAM(eTeam).isForceRevealedBonus((BonusTypes)m_eBonusType))[COLOR="Red"][B] || GET_TEAM(eTeam).getNumCities() < GC.getBonusInfo((BonusTypes)m_eBonusType).getMinCities())[/B][/COLOR]
			{
				return NO_BONUS;
			}
		}
	}

	return (BonusTypes)m_eBonusType;
}
I haven't tested this, but it may well do what you are looking for. The obvious difference is that it works at the team level rather than the player, but given that bonuses are revealed to teams rather than players it makes more sense.

If you want to remove the requirement for a tech to have been researched then you should change the <TechReveal> value to NONE for the bonus in the CIV4BonusInfos.xml file:
Code:
<BonusInfo>
	<Type>BONUS_IRON</Type>
		<Description>TXT_KEY_BONUS_IRON</Description>
		<Civilopedia>TXT_KEY_BONUS_IRON_PEDIA</Civilopedia>
		<BonusClassType>BONUSCLASS_RUSH</BonusClassType>
		<ArtDefineTag>ART_DEF_BONUS_IRON</ArtDefineTag>
		<TechReveal>[COLOR="Red"][B]NONE[/B][/COLOR]</TechReveal>
		<TechCityTrade>TECH_MINING</TechCityTrade>
		<TechObsolete>NONE</TechObsolete>
		...
 
Back
Top Bottom