Modmodding Q&A Thread

When an Independent City produces more than 4 culture per turn, it instead produces 1. Where is this defined in the code? I would like to remove it.
 
I don't know.
 
Culture rate, commerce rate? I tried the obvious ones myself already though.
 
Culture rate, commerce rate? I tried the obvious ones myself already though.
I just found this block, don't know how I missed it earlier today.
Code:
if     (getCommerceRate(COMMERCE_CULTURE) <= 4)
    {
        changeCultureTimes100(getOwnerINLINE(), getCommerceRateTimes100(COMMERCE_CULTURE), false, true);
        return;
    }
Though I'm not sure how it would affect Indies and not players, I'm going to look further into it. This is less of a "I think I found what will fix it" and more of "update on my progress"

EDIT: Looking at it, it's probably not the culprit, but it reminded me that <= 4 and < 5 is a thing, It didn't occur to me to look for an inversion.
 
I figured it out. As I looked more into the line above I noticed it was to make it so that modifiers are not applied when their culture per turn is 4 or less. When I bumped the Indy's culture modifier up to 100 it was fixed. I was going off of the ctr z command, and when I selected Indy cities it was displaying what the culture would be with either no modifier or with the modifier of my current nation. So that's probably a bug. The fact that city view while using ctr z doesn't take into count the modifier of the selected city's nation.
 
Why is it that Gilgamesh refuses to allow their Bowmen to have the Attack City AI? Even when I remove the bowmen's city defense modifier and set the only available AI to be attack city they just build them as Reserves instead of as City Attackers.

Spoiler Gilgamesh :

Code:
        <LeaderHeadInfo>
            <Type>LEADER_GILGAMESH</Type>
            <Description>TXT_KEY_LEADER_GILGAMESH</Description>
            <Civilopedia>TXT_KEY_LEADER_GILGAMESH_PEDIA</Civilopedia>
            <ArtDefineTag>ART_DEF_LEADER_GILGAMESH</ArtDefineTag>
            <iWonderConstructRand>1</iWonderConstructRand>
            <iBaseAttitude>0</iBaseAttitude>
            <iBasePeaceWeight>2</iBasePeaceWeight>
            <iPeaceWeightRand>3</iPeaceWeightRand>
            <iWarmongerRespect>2</iWarmongerRespect>
            <iEspionageWeight>100</iEspionageWeight>
            <iRefuseToTalkWarThreshold>8</iRefuseToTalkWarThreshold>
            <iNoTechTradeThreshold>15</iNoTechTradeThreshold>
            <iTechTradeKnownPercent>20</iTechTradeKnownPercent>
            <iMaxGoldTradePercent>5</iMaxGoldTradePercent>
            <iMaxGoldPerTurnTradePercent>10</iMaxGoldPerTurnTradePercent>
            <iMaxWarRand>100</iMaxWarRand>
            <iMaxWarNearbyPowerRatio>120</iMaxWarNearbyPowerRatio>
            <iMaxWarDistantPowerRatio>30</iMaxWarDistantPowerRatio>
            <iMaxWarMinAdjacentLandPercent>1</iMaxWarMinAdjacentLandPercent>
            <iLimitedWarRand>100</iLimitedWarRand>
            <iLimitedWarPowerRatio>110</iLimitedWarPowerRatio>
            <iDogpileWarRand>50</iDogpileWarRand>
            <iMakePeaceRand>30</iMakePeaceRand>
            <iDeclareWarTradeRand>40</iDeclareWarTradeRand>
            <iDemandRebukedSneakProb>25</iDemandRebukedSneakProb>
            <iDemandRebukedWarProb>25</iDemandRebukedWarProb>
            <iRazeCityProb>0</iRazeCityProb>
            <iBuildUnitProb>200</iBuildUnitProb>
            <iBaseAttackOddsChange>4</iBaseAttackOddsChange>
            <iAttackOddsChangeRand>8</iAttackOddsChangeRand>
            <iWorseRankDifferenceAttitudeChange>-2</iWorseRankDifferenceAttitudeChange>
            <iBetterRankDifferenceAttitudeChange>0</iBetterRankDifferenceAttitudeChange>
            <iCloseBordersAttitudeChange>-3</iCloseBordersAttitudeChange>
            <iLostWarAttitudeChange>-1</iLostWarAttitudeChange>
            <iAtWarAttitudeDivisor>-5</iAtWarAttitudeDivisor>
            <iAtWarAttitudeChangeLimit>5</iAtWarAttitudeChangeLimit>
            <iAtPeaceAttitudeDivisor>60</iAtPeaceAttitudeDivisor>
            <iAtPeaceAttitudeChangeLimit>1</iAtPeaceAttitudeChangeLimit>
            <iSameReligionAttitudeChange>1</iSameReligionAttitudeChange>
            <iSameReligionAttitudeDivisor>10</iSameReligionAttitudeDivisor>
            <iSameReligionAttitudeChangeLimit>4</iSameReligionAttitudeChangeLimit>
            <iDifferentReligionAttitudeChange>-1</iDifferentReligionAttitudeChange>
            <iDifferentReligionAttitudeDivisor>-5</iDifferentReligionAttitudeDivisor>
            <iDifferentReligionAttitudeChangeLimit>-1</iDifferentReligionAttitudeChangeLimit>
            <iBonusTradeAttitudeDivisor>50</iBonusTradeAttitudeDivisor>
            <iBonusTradeAttitudeChangeLimit>2</iBonusTradeAttitudeChangeLimit>
            <iOpenBordersAttitudeDivisor>25</iOpenBordersAttitudeDivisor>
            <iOpenBordersAttitudeChangeLimit>2</iOpenBordersAttitudeChangeLimit>
            <iDefensivePactAttitudeDivisor>12</iDefensivePactAttitudeDivisor>
            <iDefensivePactAttitudeChangeLimit>2</iDefensivePactAttitudeChangeLimit>
            <iShareWarAttitudeChange>1</iShareWarAttitudeChange>
            <iShareWarAttitudeDivisor>8</iShareWarAttitudeDivisor>
            <iShareWarAttitudeChangeLimit>3</iShareWarAttitudeChangeLimit>
            <iFavoriteCivicAttitudeChange>1</iFavoriteCivicAttitudeChange>
            <iFavoriteCivicAttitudeDivisor>10</iFavoriteCivicAttitudeDivisor>
            <iFavoriteCivicAttitudeChangeLimit>4</iFavoriteCivicAttitudeChangeLimit>
            <DemandTributeAttitudeThreshold>ATTITUDE_CAUTIOUS</DemandTributeAttitudeThreshold>
            <NoGiveHelpAttitudeThreshold>ATTITUDE_CAUTIOUS</NoGiveHelpAttitudeThreshold>
            <TechRefuseAttitudeThreshold>ATTITUDE_FURIOUS</TechRefuseAttitudeThreshold>
            <StrategicBonusRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</StrategicBonusRefuseAttitudeThreshold>
            <HappinessBonusRefuseAttitudeThreshold>ATTITUDE_ANNOYED</HappinessBonusRefuseAttitudeThreshold>
            <HealthBonusRefuseAttitudeThreshold>ATTITUDE_ANNOYED</HealthBonusRefuseAttitudeThreshold>
            <MapRefuseAttitudeThreshold>ATTITUDE_ANNOYED</MapRefuseAttitudeThreshold>
            <DeclareWarRefuseAttitudeThreshold>ATTITUDE_PLEASED</DeclareWarRefuseAttitudeThreshold>
            <DeclareWarThemRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</DeclareWarThemRefuseAttitudeThreshold>
            <StopTradingRefuseAttitudeThreshold>ATTITUDE_PLEASED</StopTradingRefuseAttitudeThreshold>
            <StopTradingThemRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</StopTradingThemRefuseAttitudeThreshold>
            <AdoptCivicRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</AdoptCivicRefuseAttitudeThreshold>
            <ConvertReligionRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</ConvertReligionRefuseAttitudeThreshold>
            <OpenBordersRefuseAttitudeThreshold>ATTITUDE_CAUTIOUS</OpenBordersRefuseAttitudeThreshold>
            <DefensivePactRefuseAttitudeThreshold>ATTITUDE_ANNOYED</DefensivePactRefuseAttitudeThreshold>
            <PermanentAllianceRefuseAttitudeThreshold>ATTITUDE_PLEASED</PermanentAllianceRefuseAttitudeThreshold>
            <VassalRefuseAttitudeThreshold>ATTITUDE_PLEASED</VassalRefuseAttitudeThreshold>
            <iVassalPowerModifier>0</iVassalPowerModifier>
            <iFreedomAppreciation>10</iFreedomAppreciation>
            <FavoriteCivic>CIVIC_DEIFICATION</FavoriteCivic>
            <FavoriteReligion>NONE</FavoriteReligion>
            <Traits/>
            <Flavors>
                <Flavor>
                    <FlavorType>FLAVOR_MILITARY</FlavorType>
                    <iFlavor>100</iFlavor>
                </Flavor>
            </Flavors>
            <ContactRands>
                <ContactRand>
                    <ContactType>CONTACT_RELIGION_PRESSURE</ContactType>
                    <iContactRand>250</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_CIVIC_PRESSURE</ContactType>
                    <iContactRand>1000</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_JOIN_WAR</ContactType>
                    <iContactRand>20</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_STOP_TRADING</ContactType>
                    <iContactRand>50</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_GIVE_HELP</ContactType>
                    <iContactRand>50</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_ASK_FOR_HELP</ContactType>
                    <iContactRand>100</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_DEMAND_TRIBUTE</ContactType>
                    <iContactRand>500</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_OPEN_BORDERS</ContactType>
                    <iContactRand>20</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_DEFENSIVE_PACT</ContactType>
                    <iContactRand>80</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_PERMANENT_ALLIANCE</ContactType>
                    <iContactRand>80</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_PEACE_TREATY</ContactType>
                    <iContactRand>20</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_TRADE_TECH</ContactType>
                    <iContactRand>5</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_TRADE_BONUS</ContactType>
                    <iContactRand>5</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_TRADE_MAP</ContactType>
                    <iContactRand>20</iContactRand>
                </ContactRand>
                <ContactRand>
                    <ContactType>CONTACT_TRADE_SLAVE</ContactType>
                    <iContactRand>10</iContactRand>
                </ContactRand>
            </ContactRands>
            <ContactDelays>
                <ContactDelay>
                    <ContactType>CONTACT_RELIGION_PRESSURE</ContactType>
                    <iContactDelay>50</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_CIVIC_PRESSURE</ContactType>
                    <iContactDelay>50</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_JOIN_WAR</ContactType>
                    <iContactDelay>20</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_STOP_TRADING</ContactType>
                    <iContactDelay>20</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_GIVE_HELP</ContactType>
                    <iContactDelay>50</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_ASK_FOR_HELP</ContactType>
                    <iContactDelay>50</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_DEMAND_TRIBUTE</ContactType>
                    <iContactDelay>50</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_OPEN_BORDERS</ContactType>
                    <iContactDelay>20</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_DEFENSIVE_PACT</ContactType>
                    <iContactDelay>20</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_PERMANENT_ALLIANCE</ContactType>
                    <iContactDelay>20</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_PEACE_TREATY</ContactType>
                    <iContactDelay>10</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_TRADE_TECH</ContactType>
                    <iContactDelay>15</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_TRADE_BONUS</ContactType>
                    <iContactDelay>20</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_TRADE_MAP</ContactType>
                    <iContactDelay>50</iContactDelay>
                </ContactDelay>
                <ContactDelay>
                    <ContactType>CONTACT_TRADE_SLAVE</ContactType>
                    <iContactDelay>20</iContactDelay>
                </ContactDelay>
            </ContactDelays>
            <MemoryDecays>
                <MemoryDecay>
                    <MemoryType>MEMORY_GIVE_HELP</MemoryType>
                    <iMemoryRand>200</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_REFUSED_HELP</MemoryType>
                    <iMemoryRand>100</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_ACCEPT_DEMAND</MemoryType>
                    <iMemoryRand>50</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_REJECTED_DEMAND</MemoryType>
                    <iMemoryRand>150</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_ACCEPTED_RELIGION</MemoryType>
                    <iMemoryRand>100</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_DENIED_RELIGION</MemoryType>
                    <iMemoryRand>50</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_ACCEPTED_CIVIC</MemoryType>
                    <iMemoryRand>100</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_DENIED_CIVIC</MemoryType>
                    <iMemoryRand>50</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_ACCEPTED_JOIN_WAR</MemoryType>
                    <iMemoryRand>150</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_DENIED_JOIN_WAR</MemoryType>
                    <iMemoryRand>100</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_ACCEPTED_STOP_TRADING</MemoryType>
                    <iMemoryRand>100</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_DENIED_STOP_TRADING</MemoryType>
                    <iMemoryRand>50</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_STOPPED_TRADING_RECENT</MemoryType>
                    <iMemoryRand>30</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_MADE_DEMAND_RECENT</MemoryType>
                    <iMemoryRand>20</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_CANCELLED_OPEN_BORDERS</MemoryType>
                    <iMemoryRand>10</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_TRADED_TECH_TO_US</MemoryType>
                    <iMemoryRand>100</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_RECEIVED_TECH_FROM_ANY</MemoryType>
                    <iMemoryRand>20</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_VOTED_AGAINST_US</MemoryType>
                    <iMemoryRand>10</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_VOTED_FOR_US</MemoryType>
                    <iMemoryRand>10</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_EVENT_GOOD_TO_US</MemoryType>
                    <iMemoryRand>50</iMemoryRand>
                </MemoryDecay>
                <MemoryDecay>
                    <MemoryType>MEMORY_EVENT_BAD_TO_US</MemoryType>
                    <iMemoryRand>50</iMemoryRand>
                </MemoryDecay>
            </MemoryDecays>
            <MemoryAttitudePercents>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_DECLARED_WAR</MemoryType>
                    <iMemoryAttitudePercent>-300</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_DECLARED_WAR_ON_FRIEND</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_HIRED_WAR_ALLY</MemoryType>
                    <iMemoryAttitudePercent>-200</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_NUKED_US</MemoryType>
                    <iMemoryAttitudePercent>-200</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_NUKED_FRIEND</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_RAZED_CITY</MemoryType>
                    <iMemoryAttitudePercent>-250</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_RAZED_HOLY_CITY</MemoryType>
                    <iMemoryAttitudePercent>-200</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_SPY_CAUGHT</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_GIVE_HELP</MemoryType>
                    <iMemoryAttitudePercent>100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_REFUSED_HELP</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_ACCEPT_DEMAND</MemoryType>
                    <iMemoryAttitudePercent>100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_REJECTED_DEMAND</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_ACCEPTED_RELIGION</MemoryType>
                    <iMemoryAttitudePercent>100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_DENIED_RELIGION</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_ACCEPTED_CIVIC</MemoryType>
                    <iMemoryAttitudePercent>100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_DENIED_CIVIC</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_DENIED_JOIN_WAR</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_ACCEPTED_STOP_TRADING</MemoryType>
                    <iMemoryAttitudePercent>50</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_DENIED_STOP_TRADING</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_STOPPED_TRADING</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_HIRED_TRADE_EMBARGO</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_MADE_DEMAND</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_TRADED_TECH_TO_US</MemoryType>
                    <iMemoryAttitudePercent>15</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_VOTED_AGAINST_US</MemoryType>
                    <iMemoryAttitudePercent>-200</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_VOTED_FOR_US</MemoryType>
                    <iMemoryAttitudePercent>200</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_EVENT_GOOD_TO_US</MemoryType>
                    <iMemoryAttitudePercent>100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_EVENT_BAD_TO_US</MemoryType>
                    <iMemoryAttitudePercent>-100</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
                <MemoryAttitudePercent>
                    <MemoryType>MEMORY_LIBERATED_CITIES</MemoryType>
                    <iMemoryAttitudePercent>150</iMemoryAttitudePercent>
                </MemoryAttitudePercent>
            </MemoryAttitudePercents>
            <NoWarAttitudeProbs>
                <NoWarAttitudeProb>
                    <AttitudeType>ATTITUDE_ANNOYED</AttitudeType>
                    <iNoWarProb>10</iNoWarProb>
                </NoWarAttitudeProb>
                <NoWarAttitudeProb>
                    <AttitudeType>ATTITUDE_CAUTIOUS</AttitudeType>
                    <iNoWarProb>60</iNoWarProb>
                </NoWarAttitudeProb>
                <NoWarAttitudeProb>
                    <AttitudeType>ATTITUDE_PLEASED</AttitudeType>
                    <iNoWarProb>90</iNoWarProb>
                </NoWarAttitudeProb>
                <NoWarAttitudeProb>
                    <AttitudeType>ATTITUDE_FRIENDLY</AttitudeType>
                    <iNoWarProb>100</iNoWarProb>
                </NoWarAttitudeProb>
            </NoWarAttitudeProbs>
            <UnitAIWeightModifiers>
                <UnitAIWeightModifier>
                    <UnitAIType>UNITAI_ATTACK_CITY</UnitAIType>
                    <iWeightModifier>1000</iWeightModifier>
                </UnitAIWeightModifier>
                <UnitAIWeightModifier>
                    <UnitAIType>UNITAI_SETTLE</UnitAIType>
                    <iWeightModifier>-1000</iWeightModifier>
                </UnitAIWeightModifier>
            </UnitAIWeightModifiers>
            <ImprovementWeightModifiers/>
            <DiplomacyIntroMusicPeace>
                <DiploMusicPeaceEra>
                    <EraType>ERA_ANCIENT</EraType>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_CLASSICAL</EraType>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_MEDIEVAL</EraType>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_RENAISSANCE</EraType>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_INDUSTRIAL</EraType>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_GLOBAL</EraType>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_DIGITAL</EraType>
                </DiploMusicPeaceEra>
            </DiplomacyIntroMusicPeace>
            <DiplomacyMusicPeace>
                <DiploMusicPeaceEra>
                    <EraType>ERA_ANCIENT</EraType>
                    <DiploScriptId>AS2D_DIPLO_GILGAMESH_EARLY</DiploScriptId>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_CLASSICAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_GILGAMESH_EARLY</DiploScriptId>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_MEDIEVAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_GILGAMESH_MIDDLE</DiploScriptId>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_RENAISSANCE</EraType>
                    <DiploScriptId>AS2D_DIPLO_GILGAMESH_MIDDLE</DiploScriptId>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_INDUSTRIAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_GILGAMESH_LATE</DiploScriptId>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_GLOBAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_GILGAMESH_LATE</DiploScriptId>
                </DiploMusicPeaceEra>
                <DiploMusicPeaceEra>
                    <EraType>ERA_DIGITAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_GILGAMESH_LATE</DiploScriptId>
                </DiploMusicPeaceEra>
            </DiplomacyMusicPeace>
            <DiplomacyIntroMusicWar>
                <DiploMusicWarEra>
                    <EraType>ERA_ANCIENT</EraType>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_CLASSICAL</EraType>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_MEDIEVAL</EraType>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_RENAISSANCE</EraType>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_INDUSTRIAL</EraType>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_GLOBAL</EraType>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_DIGITAL</EraType>
                </DiploMusicWarEra>
            </DiplomacyIntroMusicWar>
            <DiplomacyMusicWar>
                <DiploMusicWarEra>
                    <EraType>ERA_ANCIENT</EraType>
                    <DiploScriptId>AS2D_DIPLO_WARDRUMS_EARLY</DiploScriptId>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_CLASSICAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_WARDRUMS_EARLY</DiploScriptId>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_MEDIEVAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_WARDRUMS_MIDDLE</DiploScriptId>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_RENAISSANCE</EraType>
                    <DiploScriptId>AS2D_DIPLO_WARDRUMS_MIDDLE</DiploScriptId>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_INDUSTRIAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_WARDRUMS_LATE</DiploScriptId>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_GLOBAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_WARDRUMS_LATE</DiploScriptId>
                </DiploMusicWarEra>
                <DiploMusicWarEra>
                    <EraType>ERA_DIGITAL</EraType>
                    <DiploScriptId>AS2D_DIPLO_WARDRUMS_LATE</DiploScriptId>
                </DiploMusicWarEra>
            </DiplomacyMusicWar>
        </LeaderHeadInfo>
Code:
        <UnitInfo>
            <Class>UNITCLASS_ARCHER</Class>
            <Type>UNIT_BABYLONIAN_ASHARITTU_BOWMAN</Type>
            <Combat>UNITCOMBAT_ARCHER</Combat>
            <Domain>DOMAIN_LAND</Domain>
            <DefaultUnitAI>UNITAI_ATTACK_CITY</DefaultUnitAI>
            <Description>TXT_KEY_UNIT_BABYLONIAN_ASHARITTU_BOWMAN</Description>
            <Civilopedia>TXT_KEY_UNIT_BABYLONIAN_ASHARITTU_BOWMAN_PEDIA</Civilopedia>
            <Strategy>TXT_KEY_UNIT_BABYLONIAN_ASHARITTU_BOWMAN_STRATEGY</Strategy>
            <Advisor>ADVISOR_MILITARY</Advisor>
            <bMilitaryHappiness>1</bMilitaryHappiness>
            <bMilitarySupport>1</bMilitarySupport>
            <bMilitaryProduction>1</bMilitaryProduction>
            <bPillage>1</bPillage>
            <UnitClassUpgrades>
                <UnitClassUpgrade>
                    <UnitClassUpgradeType>UNITCLASS_LONGBOWMAN</UnitClassUpgradeType>
                    <bUnitClassUpgrade>1</bUnitClassUpgrade>
                </UnitClassUpgrade>
                <UnitClassUpgrade>
                    <UnitClassUpgradeType>UNITCLASS_CROSSBOWMAN</UnitClassUpgradeType>
                    <bUnitClassUpgrade>1</bUnitClassUpgrade>
                </UnitClassUpgrade>
            </UnitClassUpgrades>
            <UnitAIs>
                <UnitAI>
                    <UnitAIType>UNITAI_ATTACK_CITY</UnitAIType>
                    <bUnitAI>1</bUnitAI>
                </UnitAI>
                <UnitAI>
                    <UnitAIType>UNITAI_CITY_DEFENSE</UnitAIType>
                    <bUnitAI>1</bUnitAI>
                </UnitAI>
                <UnitAI>
                    <UnitAIType>UNITAI_COLLATERAL</UnitAIType>
                    <bUnitAI>1</bUnitAI>
                </UnitAI>
            </UnitAIs>
            <PrereqTech>TECH_TANNING</PrereqTech>
            <iCost>25</iCost>
            <iAdvancedStartCost>100</iAdvancedStartCost>
            <iMinAreaSize>-1</iMinAreaSize>
            <iMoves>1</iMoves>
            <iNukeRange>-1</iNukeRange>
            <FeatureImpassables>
                <FeatureImpassable>
                    <FeatureType>FEATURE_JUNGLE</FeatureType>
                    <bFeatureImpassable>1</bFeatureImpassable>
                </FeatureImpassable>
                <FeatureImpassable>
                    <FeatureType>FEATURE_RAINFOREST</FeatureType>
                    <bFeatureImpassable>1</bFeatureImpassable>
                </FeatureImpassable>
                <FeatureImpassable>
                    <FeatureType>FEATURE_MARSH</FeatureType>
                    <bFeatureImpassable>1</bFeatureImpassable>
                </FeatureImpassable>
            </FeatureImpassables>
            <iCombat>3</iCombat>
            <iCombatLimit>100</iCombatLimit>
            <iXPValueAttack>4</iXPValueAttack>
            <iXPValueDefense>2</iXPValueDefense>
            <UnitClassAttackMods>
                <UnitClassAttackMod>
                    <UnitClassType>UNITCLASS_ARCHER</UnitClassType>
                    <iUnitClassMod>50</iUnitClassMod>
                </UnitClassAttackMod>
            </UnitClassAttackMods>
            <iCityAttack>50</iCityAttack>
            <iCityDefense>25</iCityDefense>
            <iFirstStrikes>1</iFirstStrikes>
            <iCollateralDamage>100</iCollateralDamage>
            <iCollateralDamageLimit>40</iCollateralDamageLimit>
            <iCollateralDamageMaxUnits>4</iCollateralDamageMaxUnits>
            <iCultureGarrison>4</iCultureGarrison>
            <iAsset>1</iAsset>
            <iPower>4</iPower>
            <UnitMeshGroups>
                <iGroupSize>3</iGroupSize>
                <fMaxSpeed>1.75</fMaxSpeed>
                <fPadTime>1</fPadTime>
                <iMeleeWaveSize>3</iMeleeWaveSize>
                <iRangedWaveSize>3</iRangedWaveSize>
                <UnitMeshGroup>
                    <iRequired>3</iRequired>
                    <EarlyArtDefineTag>ART_DEF_UNIT_BABYLONIAN_ASHARITTU_BOWMAN</EarlyArtDefineTag>
                </UnitMeshGroup>
            </UnitMeshGroups>
            <FormationType>FORMATION_TYPE_DEFAULT</FormationType>
        </UnitInfo>
 
I've turned Scouts into a skirmisher unit but now have no idea how to bar independent states from using the UNITAI_EXPLORE, does making a unique unit for them and inserting the following code not work?
Code:
<UnitAI>
    <UnitAIType>UNITAI_EXPLORE</UnitAIType>
    <bUnitAI>0</bUnitAI>
</UnitAI>
 
I've turned Scouts into a skirmisher unit but now have no idea how to bar independent states from using the UNITAI_EXPLORE, does making a unique unit for them and inserting the following code not work?
Code:
<UnitAI>
    <UnitAIType>UNITAI_EXPLORE</UnitAIType>
    <bUnitAI>0</bUnitAI>
</UnitAI>

If you want the AI to NEVER use them with UNITAI_EXPLORE, you need to use this: (Note that this is under NotUnitAIs which is directly following UnitAIs.)
Code:
<NotUnitAIs>
    <UnitAI>
        <UnitAIType>UNITAI_EXPLORE</UnitAIType>
        <bUnitAI>1</bUnitAI>
     </UnitAI>
</NotUnitAIs>
If you want the AI to just not consider them specially suited for exploration then it is enough to remove the reference to UNITAI_EXPLORE in their xml entry.
 
Last edited:
If you want the AI to NEVER use them with UNITAI_EXPLORE, you need to use this: (Note that this is under NotUnitAIs which is directly following UnitAIs.)
Code:
<NotUnitAIs>
    <UnitAI>
        <UnitAIType>UNITAI_EXPLORE</UnitAIType>
        <bUnitAI>1</bUnitAI>
     </UnitAI>
</NotUnitAIs>
If you want the AI to just not consider them specially suited for exploration then it is enough to remove the reference to UNITAI_EXPLORE in their xml entry.
Did not know you could do that, thanks!
 
Suppose I made a pull request that Leoreth does not like. How can I cancel my pull request on github? And how then I can sync my fork to look like main develop copy? So that I can make some other new request based on latest official version of this mod?
 
In general, it is good practice not to make pull requests from your develop branch, but to create a feature branch first. Suppose you want to change uranium locations on the map, you first create a branch e.g. "uranium-locations". This new branch will be identical to your current develop, but when you make changes they only apply to the branch but not to your develop. This way you can keep develop synched to my repository while working on your current changes. If you don't like the branch anymore, you can delete or abandon it, and even work on multiple features at the same time.

However, in case your not aware, if you update a branch of an ongoing pull request these changes will become part of the pull request. So no need to close and reopen it after your changes.

I assume though that you have now made changes to your local develop branch. You should get rid of that by setting your origin to "https://github.com/dguenms/Dawn-of-Civilization.git" and doing a force pull. This will overwrite your changes with my develop state (irretrievably!). The command line is "git pull --force https://github.com/dguenms/Dawn-of-Civilization.git develop".
 
Has the administrative center + palace bug already been fixed? I can recall a commit which automatically removes an administrative center when it becomes a capital city. It still does not work for me, but maybe I just messed up my copy of the mod.

Btw, while randomly investigating it, I found the code which is supposed to trigger it in CvRFCEventHandler.py:

Code:
def onBuildingBuilt(self, argsList):
    if city.isHasRealBuilding(iAdministrativeCenter): city.setHasRealBuilding(iAdministrativeCenter, False)

I notice that it uses the isHasRealBuilding() function. How is it different from hasBuilding() function?

EDIT: Oh okay, I understand, the trigger is onBuildingBuilt and not onCityAcquired. :lol:
 
What is the issue you're having? Do cities become capitals when acquired and then not lose their Administrative Center because technically they did not build a palace?
 
Yes. Mexican spawn, for instance. Again, I may have messed up my copy of the mod because it's so dirty, so I'm not sure if that one has already been accounted for, as well.
 
Probably not, I've made a note.
 
My first modding attempt, adding Israel, is nearing completion. The main missing piece is the UP, which is not trivial to code. Do you have any advice on how/where I should code an effect that gives extra yields to the capital city based on the number of Jewish cities with open borders? Finding the list of these cities seems fairly straightforward, there's similar code in UniquePowers.py, but I'm not sure if I check for the UP each turn, and how to actually change the yields. Any help is appreciated.

In my opinion extra yield for capital is best implemented by changing the building yields of the palace building.

I put this on the back burner for a while, but I'm trying do work (and finish) my Israel mod once again. I'm still confused about this. I know how to change the yields of a building in the XML, and I suppose one (poor) solution could be to create a unique building that is identical to the palace, except it has extra yields. But I want to change the yields dynamically. Where in the code should I go? I can't find anything already implemented that looks like what I want to do, and my poor familiarity with most of the code makes it hard to get started.
 
You can change the yield and commerce outputs of all buildings you control (programmatically, i.e. Python or C++). The game actually uses this for some event effects like extra research for monasteries. Since Palaces are unique and always exist in the capital, that's a good way to do capital based effects. I'm using this for the Colonialism and Tributaries effects for example, see CvPlayer::updateCapitalCommerce() in the DLL. Another place where I use it is wonders since they are also unique, for example Empire State Building and Machu Picchu. Those are controlled by Python.

If your UP depends on a dynamically changing variable, you need to update the Palace yield every time this variable changes. What the precise triggers are depends on the effect. For example, for Empire State Building the initial gold output is set to city size when the wonder is built and then changed when the city shrinks/grows, every time using the right event handler in RFCEventHandlers.py.

In your case it would involve handling every time Judaism spreads to or disappears from a city (combined with an OB check) to increment/decrement the output. The same is required when you open/close borders where you would need to add/subtract the total number of Jewish cities they have.
 
Top Bottom