Add effects to civics when running the right religion

NotSoGood

Emperor
Joined
Jan 25, 2009
Messages
1,077
Location
Finland
I had another idea how to improve ideologies(religions) in my mod.
The problem was that civics are trying to be forms of covernment, no reason to have two things to do the same.
But what if I add another effects to civics if you're running a specific ideology(religion). Like if you have Hereditary Rule you get + :) in every city. But if you have monarchy, you get production bonus in your capital too.
But how should it be done? If I wanted to add many different effects, I would need to add many different arrays. Is it the easiest way or can it be done differently?
 
Is it easy to create array like this?
Code:
			<UnitMeshGroups>
				<iGroupSize>3</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>3</iMeleeWaveSize>
				<iRangedWaveSize>0</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>3</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_INFANTRY</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
This way there wouldn't be need for many different arrays but one big. The first tag would be what relgion it requires, then some tags that will work only if you have the state religion.
Code:
			<ReligionChanges>
				<ReligionChange>
					<StateReligionReqs>RELIGION_WHATEVER</StateReligionReqs>
					<iIntegerTag>100</iIntegerTag>
					<bBooleanTag>0</bBooleanTag>
					...
				</ReligionChange>
				<ReligionChange>
					<StateReligionReqs>RELIGION_ANOTHER</StateReligionReqs>
					<iIntegerTag>-10</iIntegerTag>
					<bBooleanTag>1</bBooleanTag>
					...
				</ReligionChange>
			</ReligionChanges>
So, would those arrays work like the normal ones, or will they be harder to handle?
 
What they usually are is pairs of arrays, or more. If you look at my Civic Attitude Changes, for an example, it's layed out like this:
Code:
<CivicAttitudeChanges>
				<CivicAttitudeChange>
					<CivicType>CIVIC_REPUBLIC</CivicType>
					<iAttitudeChange>1</iAttitudeChange>
					<Description>TXT_KEY_CIVIC_ATTITUDE_FREEDOM</Description>
				</CivicAttitudeChange>
				<CivicAttitudeChange>
					<CivicType>CIVIC_FEDERAL</CivicType>
					<iAttitudeChange>1</iAttitudeChange>
					<Description>TXT_KEY_CIVIC_ATTITUDE_FREEDOM</Description>
				</CivicAttitudeChange>
				<CivicAttitudeChange>
					<CivicType>CIVIC_DEMOCRACY</CivicType>
					<iAttitudeChange>1</iAttitudeChange>
					<Description>TXT_KEY_CIVIC_ATTITUDE_FREEDOM</Description>
				</CivicAttitudeChange>
				<CivicAttitudeChange>
					<CivicType>CIVIC_FASCIST</CivicType>
					<iAttitudeChange>-2</iAttitudeChange>
					<Description>TXT_KEY_CIVIC_ATTITUDE_OPPRESSION</Description>
				</CivicAttitudeChange>
			</CivicAttitudeChanges>

And the Attitude Change is in one array, and the Description is in another.

However, the example you posted works a bit differently. An easier example would be to look at BonusStructs in CvInfos.
 
My bad, I used the name from memory, in CvInfos, it's called "CvImprovementBonusInfo". It's coded a special way in CvStructs and read in the XML by a special function in CvXMLLoadUtility...

The code looks similar to what you want in the XML though:
Code:
				<BonusTypeStruct>
					<BonusType>BONUS_RICE</BonusType>
					<bBonusMakesValid>1</bBonusMakesValid>
					<bBonusTrade>1</bBonusTrade>
					<iDiscoverRand>10000</iDiscoverRand>
					<YieldChanges>
						<iYieldChange>1</iYieldChange>
						<iYieldChange>0</iYieldChange>
						<iYieldChange>0</iYieldChange>
					</YieldChanges>
				</BonusTypeStruct>
				<BonusTypeStruct>
					<BonusType>BONUS_WHEAT</BonusType>
					<bBonusMakesValid>1</bBonusMakesValid>
					<bBonusTrade>1</bBonusTrade>
					<iDiscoverRand>10000</iDiscoverRand>
					<YieldChanges>
						<iYieldChange>2</iYieldChange>
						<iYieldChange>0</iYieldChange>
						<iYieldChange>0</iYieldChange>
					</YieldChanges>
				</BonusTypeStruct>
 
That is done as a struct I'd bet because it contains another array inside it. What you're trying to do looks exactly like what Afforess did with Civics. It would be easier to tell if you gave an XML snippet that had real names instead of iIntegerTag and bBooleanTag.
 
That is done as a struct I'd bet because it contains another array inside it. What you're trying to do looks exactly like what Afforess did with Civics. It would be easier to tell if you gave an XML snippet that had real names instead of iIntegerTag and bBooleanTag.

I actually managed to add the code from bonus struct and got it work with one tag, bNoUnhappinessInCapital and will be testing others soon. I can't provide any more precise information about the tags I'm going to use, because I have no idea what different things I'm going to add. But I'll check how the code Afforess used works.

"To Afforess:" Are the newest source codes in SVN?
 
I looked at Afforess' sources and I think the bonus struct system works better for my needs. I can add almost anything to it without changing it, I even might add an array in the future, and I know how it works so it's easier to use. That's why I think it suits better for my uses. But if you know something more than I do, please tell me.

BTW, how do you loop the player's civics? They work little differently because every player doesn't have the same civics. I would like to check if any civic the player has, has this new array/struct thing and a proper value there.
 
Back
Top Bottom