Civic Infos Plus v0.2BtS

Joined
Jul 21, 2003
Messages
7,807
Location
Adelaide, South Australia
Civic Infos Plus for Beyond the Sword
By: Aussie_Lurker

Last Updated 08/30/10

Version: v0.2BtS
Patch Compatibility: Beyond the Sword v3.1
Download Mod v0.2BtS


Description for BtS:
Spoiler:

This mod adds a number of new tags to the Civic Infos file, to give additional flexibility to modders. These tags include <BuildingYieldChange> & <BuildingCommerceChange>-which allows your civics to directly effect the output of buildings. <StateReligionExtraHealth> & <NonStateReligionExtraHealth>-which allows civics to impact the health of your cities dependent on the presence of religion. <StateReligionCommerceModifier> & <StateReligionYieldModifier>-which allows civics to impact the output of your cities dependent on the presence of State Religion (& their Non-State Religion equivalents). <FreeSpecialistCounts> & <SpecialistExtraYield> which allows your civics to give you bonus specialists, & which allows your civics to grant bonus yields to any specialists you have assigned to a city.




-----Notes to Modmakers-----

If you want to use this mod component in your mod I have tried to make things
as easy as possible for you. In the XML files I have added

In the SDK files I have added
// < Civic Infos Plus Start > and
// < Civic Infos Plus End > in all of the places where
changes were made.

-----v0.2BtS------

- Updated to be compatible with Beyond the Sword v3.19 patch.

Known Issues: For some reason, half of the new tags don't work on the 1st tier civics, yet work on *all* the others. Still, for most modders this shouldn't be too big an issue (as most of the time 1st tier civics grant no additional bonuses or penalties).

Future tasks: Now that this has been updated, I'm hoping to incorporate some of TheLopez's brilliant CivicsTags-especially the ones regulating the construction of units & buildings.

-----===Credits & Thanks===-----

- For this version, I cannot thank TheLopez enough. Without his extremely insightful eye, & attention to detail, I doubt that I would have had all the tags working sufficiently to post this update. You really are *da man* ;)!
 
A few in-game images of the tag effects to be going on with....except I can't seem to get pictures to load up as an image link. Anyone know why this might be?

Oh well, I'll just upload them directly instead for now!

So the 1st Screenie (on the top left) shows the usefulness of the <SpecialistExtraYield> tag; the 2nd screenie shows the usefulness of both <BuildingYieldChange> & <BuildingCommerceChange>; 3rd image shows <StateReligionHealth> in action; 4th image shows <NonStateReligionCommerceModifier>; 5th image shows <StateReligionYieldModifier> & the final image shows <FreeSpecialistCount>. That pretty much covers the tags, as obviously the <StateReligionCommerceModifier> & <NonStateReligionYieldModifier> are not dissimilar to their opposite number.

Aussie_Lurker.
 

Attachments

  • Civ4ScreenShot0001.JPG
    Civ4ScreenShot0001.JPG
    99.3 KB · Views: 379
  • Civ4ScreenShot0002.JPG
    Civ4ScreenShot0002.JPG
    105.2 KB · Views: 295
  • Civ4ScreenShot0003.JPG
    Civ4ScreenShot0003.JPG
    100.8 KB · Views: 258
  • Civ4ScreenShot0004.JPG
    Civ4ScreenShot0004.JPG
    99.8 KB · Views: 234
  • Civ4ScreenShot0005.JPG
    Civ4ScreenShot0005.JPG
    99.7 KB · Views: 239
  • Civ4ScreenShot0006.JPG
    Civ4ScreenShot0006.JPG
    99.9 KB · Views: 246
Will do, when I get some time ;)!

Aussie.
 
Congrats on getting this out, Aussie, I'm really glad The Lopez could help you get those code issues you were having.

Cheers,
ripple1

Interestingly, Ripple, I'm beginning to wonder if most of my code issues were due to me testing them on 1st tier civics ;).

Aussie.
 
Interestingly, Ripple, I'm beginning to wonder if most of my code issues were due to me testing them on 1st tier civics ;).

Aussie.

The question now is how to solve that problem :)
 
So what do you think The_J, do those screenshots above help?

Aussie.
 
What's this doing in the SDK:

"Tech Bonus Mod" :confused:

Hey Arian. That's a left over from my TechInfosBonus mod. Basically it allows you to give techs the ability to boost yields & commerces in all cities (so you might have Scientific Method boost Science Output in all cities for instance). I'm pretty sure everything is there, but I'm not 100% certain that it all works. It certainly won't have any detrimental impact on the Civics Tags & their effects.

Aussie.
 
Hey Arian. That's a left over from my TechInfosBonus mod. Basically it allows you to give techs the ability to boost yields & commerces in all cities (so you might have Scientific Method boost Science Output in all cities for instance). I'm pretty sure everything is there, but I'm not 100% certain that it all works. It certainly won't have any detrimental impact on the Civics Tags & their effects.

Aussie.

Thanks, I had to merge it anyway, otherwise the DLL couldn't be compiled. It's only a bit confusing. I hope to test it soon!
 
Aussie_Lurker, can you plz give an example of the XML-tags for BuildingYieldChanges and BuildingCommerceChanges?

I haven't tested BuildingCommerceChanges but this is what I did for BuildingYieldChanges, granaries and terraces should give +1 food:

Code:
			<BuildingYieldChanges>
				<BuildingYieldChange>
					<BuildingType>BUILDING_GRANARY</BuildingType>
					<BuildingYields>1</BuildingYields>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>0</BuildingYields>
				</BuildingYieldChange>
				<BuildingYieldChange>
					<BuildingType>BUILDING_INCAN_TERRACE</BuildingType>
					<BuildingYields>1</BuildingYields>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>0</BuildingYields>
				</BuildingYieldChange>
			</BuildingYieldChanges>

Here's a pic:
Spoiler :
Did the same for castles that should give +1 production and markets that should give +1 commerce. Here's the XML-tags for the castle:
Code:
			<BuildingYieldChanges>
				<BuildingYieldChange>
					<BuildingType>BUILDING_CASTLE</BuildingType>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>1</BuildingYields>
					<BuildingYields>0</BuildingYields>
				</BuildingYieldChange>
				<BuildingYieldChange>
					<BuildingType>BUILDING_SPANISH_CITADEL</BuildingType>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>1</BuildingYields>
					<BuildingYields>0</BuildingYields>
				</BuildingYieldChange>
				<BuildingYieldChange>
					<BuildingType>BUILDING_FRENCH_CHATEAU</BuildingType>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>1</BuildingYields>
					<BuildingYields>0</BuildingYields>
				</BuildingYieldChange>
				<BuildingYieldChange>
					<BuildingType>BUILDING_HOLY_ROMAN_KAISERPFALZ</BuildingType>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>1</BuildingYields>
					<BuildingYields>0</BuildingYields>
				</BuildingYieldChange>
			</BuildingYieldChanges>
and the market:
Code:
			<BuildingYieldChanges>
				<BuildingYieldChange>
					<BuildingType>BUILDING_MARKET</BuildingType>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>1</BuildingYields>
				</BuildingYieldChange>
				<BuildingYieldChange>
					<BuildingType>BUILDING_ROMAN_FORUM</BuildingType>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>1</BuildingYields>
				</BuildingYieldChange>
				<BuildingYieldChange>
					<BuildingType>BUILDING_ARABIAN_SOUK</BuildingType>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>1</BuildingYields>
				</BuildingYieldChange>
				<BuildingYieldChange>
					<BuildingType>BUILDING_GREEK_AGORA</BuildingType>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>0</BuildingYields>
					<BuildingYields>1</BuildingYields>
				</BuildingYieldChange>
			</BuildingYieldChanges>
and the pics:
Spoiler :

What's wrong?
 
Here we go again. I wanted to give each jail +2 espionage under police state so I added this:
Code:
			<BuildingCommerceChanges>
				<BuildingCommerceChange>
					<BuildingType>BUILDING_JAIL</BuildingType>
					<BuildingCommerces>
						<iCommerce>0</iCommerce>
						<iCommerce>0</iCommerce>
						<iCommerce>0</iCommerce>
						<iCommerce>2</iCommerce>
					</BuildingCommerces>
				</BuildingCommerceChange>
				<BuildingCommerceChange>
					<BuildingType>BUILDING_RUSSIAN_GULAG</BuildingType>
					<BuildingCommerces>
						<iCommerce>0</iCommerce>
						<iCommerce>0</iCommerce>
						<iCommerce>0</iCommerce>
						<iCommerce>2</iCommerce>						
					</BuildingCommerces>
				</BuildingCommerceChange>
				<BuildingCommerceChange>
					<BuildingType>BUILDING_SPANISH_DUNGEON</BuildingType>
					<BuildingCommerces>
						<iCommerce>0</iCommerce>
						<iCommerce>0</iCommerce>
						<iCommerce>0</iCommerce>
						<iCommerce>2</iCommerce>						
					</BuildingCommerces>
				</BuildingCommerceChange>
				<BuildingCommerceChange>
					<BuildingType>BUILDING_ETHIOPIAN_AMBA</BuildingType>
					<BuildingCommerces>
						<iCommerce>0</iCommerce>
						<iCommerce>0</iCommerce>
						<iCommerce>0</iCommerce>
						<iCommerce>2</iCommerce>						
					</BuildingCommerces>
				</BuildingCommerceChange>
			</BuildingCommerceChanges>
I get this XML Error during starting up the mod:

"For loop iterator is greater than array size
Current XML file is xml\Gamenfo/CivicInfos.xml
"

Hitting 4x return, the main screen appears and the civilopedia entry for police state is looks like this:
Spoiler :
This looks OK, but because of the XML Error I think something is wrong. Any ideas??
 
Hmm Arrian, these are very unusual errors you're getting, & I confess that I've never seen them before myself. I'm pretty sure I did mine as follows:

Code:
<BuildingYieldChanges>
        <BuildingYieldChange>
          <BuildingType>BUILDING_CASTLE</BuildingType>
          <BuildingYields>
            <iYield>0</iYield>
            <iYield>2</iYield>
            <iYield>0</iYield>
          </BuildingYields>
        </BuildingYieldChange>
      </BuildingYieldChanges>

Hope that helps.

Aussie.
 
Hmm Arrian, these are very unusual errors you're getting, & I confess that I've never seen them before myself. I'm pretty sure I did mine as follows:

Code:
<BuildingYieldChanges>
        <BuildingYieldChange>
          <BuildingType>BUILDING_CASTLE</BuildingType>
          <BuildingYields>
            <iYield>0</iYield>
            <iYield>2</iYield>
            <iYield>0</iYield>
          </BuildingYields>
        </BuildingYieldChange>
      </BuildingYieldChanges>

Hope that helps.

Aussie.

Thanks, it's working fine now except for XML-error when giving espionage to a building. Hope you can fix that...
 
Hey Ripple. I'm not an expert on AI behaviour but, in my play-tests of the Civics Mod, I have seen the AI happily adopt this altered Civics. Hope that makes sense.

Aussie.
 
Hey Aussie,

I've got this merged with my mod based on RevDCM and it seems to be working well for the most part. I am getting some exceptions popping up when using a Debug DLL, and wanted to see if you or someone else could help me in figuring these out:

The relevant blocks of code:

CvCity.cpp

Code:
void CvCity::setBaseYieldRate(YieldTypes eIndex, int iNewValue)
{
	FAssertMsg(eIndex >= 0, "eIndex expected to be >= 0");
	FAssertMsg(eIndex < NUM_YIELD_TYPES, "eIndex expected to be < NUM_YIELD_TYPES");

	if (getBaseYieldRate(eIndex) != iNewValue)
	{
		FAssertMsg(iNewValue >= 0, "iNewValue expected to be >= 0");
		FAssertMsg(((iNewValue * 100) / 100) >= 0, "((iNewValue * 100) / 100) expected to be >= 0");

		m_aiBaseYieldRate[eIndex] = iNewValue;
		FAssert(getYieldRate(eIndex) >= 0);

		updateCommerce();

		if (getTeam() == GC.getGameINLINE().getActiveTeam())
		{
			setInfoDirty(true);

			if (isCitySelected())
			{
				gDLL->getInterfaceIFace()->setDirty(CityScreen_DIRTY_BIT, true);
				gDLL->getInterfaceIFace()->setDirty(InfoPane_DIRTY_BIT, true );
			}
		}
	}
}

I'm triggering the final 3 asserts in this block of code.

and


CvPlayer.cpp

Code:
void CvPlayer::changeBuildingYieldChange(BuildingTypes eIndex1, YieldTypes eIndex2, int iChange)
{
	FAssertMsg(eIndex1 >= 0, "eIndex1 is expected to be non-negative (invalid Index)");
	FAssertMsg(eIndex1 < GC.getNumBuildingInfos(), "eIndex1 is expected to be within maximum bounds (invalid Index)");
	FAssertMsg(eIndex2 >= 0, "eIndex2 is expected to be non-negative (invalid Index)");
	FAssertMsg(eIndex2 < NUM_YIELD_TYPES, "eIndex2 is expected to be within maximum bounds (invalid Index)");

	if (iChange != 0)
	{
		m_ppaaiBuildingYieldChange[eIndex1][eIndex2] = (m_ppaaiBuildingYieldChange[eIndex1][eIndex2] + iChange);
		FAssert(getBuildingYieldChange(eIndex1, eIndex2) >= 0);
	}
}

and I'm triggering the final assert in this block of code.

Does this make any sense to you or anyone else?

Many thanks,
J
 
Currently starting to merge this with RevDCM+Unique Civics. If get same errors and fix them I'll post. At moment only just started merging the dll :)
 
Top Bottom