Conflict between spies and 2nd <Civilization_FreeBuildingClasses> building

LeeS

Imperator
Joined
Jul 23, 2013
Messages
7,241
Location
Illinois, USA
I was experimenting around with adding a 2nd building for a civ (in addition to the palace) to the <Civilization_FreeBuildingClasses> and hit a wall in the Renaissance era. Spies wouldn't accept assignment to cities either as counter-agent within my own cities or as diplomats/spies in foriegn cities.

My 1st suspicion was that it was the red-highlighted espionage modifier command, but commenting it as shown in the spoiler made no difference in a quick test I ran. Only removing the whole file from the list of 'OnModActivated's allowed spies to function properly.

Spoiler :
Code:
<GameData>
	<Civilization_FreeBuildingClasses>
		<Row>
			<CivilizationType>CIVILIZATION_AMERICA</CivilizationType>
			<BuildingClassType>BUILDINGCLASS_WASHINGTON_CAPITAL</BuildingClassType>
		</Row>
	</Civilization_FreeBuildingClasses>

	<Buildings>

		<!-- HIDDEN BUILDING In the Capital FOR NEW WASHINGTON TRAIT -->

		<Row>
			<Type>BUILDING_WASHINGTON_CAPITAL</Type>
			<BuildingClass>BUILDINGCLASS_WASHINGTON_CAPITAL</BuildingClass>
			<Cost>-1</Cost>
			<FaithCost>-1</FaithCost>
			<GreatWorkCount>-1</GreatWorkCount>
			<PrereqTech>NULL</PrereqTech>
			<ArtDefineTag>NONE</ArtDefineTag>
			<MinAreaSize>-1</MinAreaSize>
			<SpecialistType>SPECIALIST_MERCHANT</SpecialistType>
			<GreatPeopleRateChange>1</GreatPeopleRateChange>
			<Defense>200</Defense>
			<ExtraCityHitPoints>25</ExtraCityHitPoints>
			<NeverCapture>true</NeverCapture>
			<HurryCostModifier>-1</HurryCostModifier>
			<TradeRouteSeaGoldBonus>200</TradeRouteSeaGoldBonus>
			<TradeRouteLandGoldBonus>200</TradeRouteLandGoldBonus>
			<TradeRouteRecipientBonus>2</TradeRouteRecipientBonus>
			[COLOR="Red"]<!--	<EspionageModifier>-25</EspionageModifier> -->[/COLOR]
			<Happiness>1</Happiness>
			<NukeImmune>true</NukeImmune>
			<NukeModifier>-75</NukeModifier>
			<GreatPeopleRateModifier>10</GreatPeopleRateModifier>
			<Gold>1000</Gold>
			<CityStateTradeRouteProductionModifier>1</CityStateTradeRouteProductionModifier>
			<PortraitIndex>0</PortraitIndex>
			<IconAtlas>CIV_COLOR_ATLAS</IconAtlas>
		</Row>
	</Buildings>

	<BuildingClasses>
		<Row>
			<Type>BUILDINGCLASS_WASHINGTON_CAPITAL</Type>
			<DefaultBuilding>BUILDING_WASHINGTON_CAPITAL</DefaultBuilding>
		</Row>
	</BuildingClasses>

	<Building_FreeUnits>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<UnitType>UNIT_ARCHER</UnitType>
			<NumUnits>2</NumUnits>
		</Row>
	</Building_FreeUnits>

	<Building_YieldChanges>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_YieldChanges>

	<Building_YieldChangesPerPop>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>25</Yield>
		</Row>
	</Building_YieldChangesPerPop>

	<Building_RiverPlotYieldChanges>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_RiverPlotYieldChanges>

	<Building_SeaPlotYieldChanges>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_SeaPlotYieldChanges>

	<Building_LakePlotYieldChanges>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_LakePlotYieldChanges>

	<Building_SeaResourceYieldChanges>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<YieldType>YIELD_CULTURE</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_SeaResourceYieldChanges>

	<Building_FeatureYieldChanges>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<FeatureType>FEATURE_JUNGLE</FeatureType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<FeatureType>FEATURE_FLOOD_PLAINS</FeatureType>
			<YieldType>YIELD_FAITH</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<FeatureType>FEATURE_ATOLL</FeatureType>
			<YieldType>YIELD_CULTURE</YieldType>
			<Yield>2</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<FeatureType>FEATURE_FOREST</FeatureType>
			<YieldType>YIELD_PRODUCTION</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<FeatureType>FEATURE_OASIS</FeatureType>
			<YieldType>YIELD_GOLD</YieldType>
			<Yield>2</Yield>
		</Row>
	</Building_FeatureYieldChanges>

	<Building_TerrainYieldChanges>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<TerrainType>TERRAIN_DESERT</TerrainType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
		<Row>
			<BuildingType>BUILDING_WASHINGTON_CAPITAL</BuildingType>
			<TerrainType>TERRAIN_TUNDRA</TerrainType>
			<YieldType>YIELD_FOOD</YieldType>
			<Yield>1</Yield>
		</Row>
	</Building_TerrainYieldChanges>

	<Belief_BuildingClassYieldChanges>
		<Row>
			<BeliefType>BELIEF_INITIATION_RITES</BeliefType>
			<BuildingClassType>BUILDINGCLASS_WASHINGTON_CAPITAL</BuildingClassType>
			<YieldType>YIELD_CULTURE</YieldType>
			<YieldChange>1</YieldChange>
		</Row>
		<Row>
			<BeliefType>BELIEF_RELIQUARY</BeliefType>
			<BuildingClassType>BUILDINGCLASS_WASHINGTON_CAPITAL</BuildingClassType>
			<YieldType>YIELD_CULTURE</YieldType>
			<YieldChange>1</YieldChange>
		</Row>
	</Belief_BuildingClassYieldChanges>

	<Policy_BuildingClassYieldChanges>
		<Row>
			<PolicyType>POLICY_PIETY</PolicyType>
			<BuildingClassType>BUILDINGCLASS_WASHINGTON_CAPITAL</BuildingClassType>
			<YieldType>YIELD_FAITH</YieldType>
			<YieldChange>2</YieldChange>
		</Row>
	</Policy_BuildingClassYieldChanges>

	<Policy_BuildingClassHappiness>
		<Row>
			<PolicyType>POLICY_LIBERTY</PolicyType>
			<BuildingClassType>BUILDINGCLASS_WASHINGTON_CAPITAL</BuildingClassType>
			<Happiness>1</Happiness>
		</Row>
		<Row>
			<PolicyType>POLICY_LIBERTY_FINISHER</PolicyType>
			<BuildingClassType>BUILDINGCLASS_WASHINGTON_CAPITAL</BuildingClassType>
			<Happiness>1</Happiness>
		</Row>
	</Policy_BuildingClassHappiness>

	<Policy_BuildingClassCultureChanges>
		<Row>
			<PolicyType>POLICY_LIBERTY</PolicyType>
			<BuildingClassType>BUILDINGCLASS_WASHINGTON_CAPITAL</BuildingClassType>
			<CultureChange>1</CultureChange>
		</Row>
		<Row>
			<PolicyType>POLICY_TRADITION</PolicyType>
			<BuildingClassType>BUILDINGCLASS_WASHINGTON_CAPITAL</BuildingClassType>
			<CultureChange>1</CultureChange>
		</Row>
	</Policy_BuildingClassCultureChanges>
</GameData>

Anyone else experimented much with adding a 2nd building for a civ to the <Civilization_FreeBuildingClasses> table? If so have you seen the same behavior? Or perhaps the problem is in the amount of crazy stuff I stuck into the file for the building ? Though I wouldn't expect the last to be true since for the most part so far as the game is concerned a building is just a building and I haven't encountered any limits to how much stuff a single building can have assigned to it.

Note: this is not a OMG I need to get this to work !!! question/thread. This is more of a huh! I didn't expect it to work that way, kind of thread.
 
I don't believe the problem is of the second building provided by <Civilization_FreeBuildingClasses> as I just ran a quick test on this myself.

I gave myself a free Shrine to start with using that table, then used IGE to rapidly speed myself toward the Renaissance to unlock the Spies. This Spy was able to perform actions in my own city, in a city-state, as well as spy on an enemy Civ.

It might just be the sheer amount of stuff you have there, maybe?
 
I don't believe the problem is of the second building provided by <Civilization_FreeBuildingClasses> as I just ran a quick test on this myself.

I gave myself a free Shrine to start with using that table, then used IGE to rapidly speed myself toward the Renaissance to unlock the Spies. This Spy was able to perform actions in my own city, in a city-state, as well as spy on an enemy Civ.

It might just be the sheer amount of stuff you have there, maybe?

Could very well be. I'll have to de-stuff the file and see what happens. Though it might be the hidden building effect.
 
Well, since I have everything here anyway and you brought it up, I went ahead and tested that, too.

I'm pretty sure it's just the amount of stuff you have going on. I replaced the free Shrine with a free hidden building I have whose only effect is +1 global happiness. This was granted properly, and it was hidden in my Capital, yet again speeding myself over to the Renaissance for a Spy allowed me full use of him. He was able to set up in my own city, in a city state, and operate in enemy cities as both a Spy and a Diplomat.
 
Actually I think it's a conflict with some other mod I had running. I'll have to look at them one at a time and see which one it is. Stumper as to why and what, as all those other mods have never given me a bizarre conflict like this. Removing everything but the basic definition of the building and the buildingclasses and civ-freebuildingclasses table had no effect on my end. Spies still not wanted to be useful.

As I mentioned it's not anything I was basing all my mod hopes on, just something I was playing around with.

I also re-defined as a non-hidden building. No change.
 
Hrmm, interesting to know.
I would be interested in finding out what mod caused that, when you figure that one out.
Otherwise, for the moment I guess it's not really the amount of stuff in a building. Perhaps I can copy that building code into a new temporary building and try that on my end.
 
Okay, so I just tested this as well.

I copied your entire building code as it was posted above into a new file, and added it into my Civ. It's currently the only mod loaded, besides IGE.

With the EspionageModifier line uncommented, it seemed to have broken the Spy assignment window a bit, but it was still technically possible to use the spies on city-states and enemy cities with a bit of clicking around the column sorting headers first, but I wasn't able to get it working in my own city.

Commenting out that EspionageModifier line allows regular use of the Spy assignment window.
As far as I can tell, all other effects were being applied properly from that long list of stuff.

The weird thing is that my Civ's regular UB makes use of EspionageModifier and it doesn't break the Spy assignment window, I don't think.

Edit:
Verified; My UB correctly applies its espionage modifier and doesn't break the Spy assignment window.
 
Yeah, well, even more confusion on top. The problem as I was seeing it appears to have been in a hidden building I was giving for free to all cities in Civ America. I forgot I even had that mod turned on. That hidden building for all cities had an <EspionageModifier>-25</EspionageModifier>. Commenting that line restored proper function to spies so far as being able to assign them to tasks in friendly or foriegn cities. I think the issue is related to the espionage modifier for an empire-wide <FreeBuilding> and probably also for a building given by <Civilization_FreeBuildingClasses>. If your UB wasn't given in either of these two methods it might not affect spies in the same way. After all, Constabularies and Police Stations have the same commands.*

* or perhaps it's just another one of those irksome Firaxis hard-coding deals that makes everything work properly with Constabularies, Police Stations, and I think Great Firewall also has this command.
 
I just did some more testing based on your assumptions there, and I think I am pretty confident in that the issue is simply: nameless buildings with EspionageModifier.

To test, I set my Civ to automatically supply my UB alongside the Palace. The UB works fine when built and given normally, so knowing it is a working base, I used it to test the scenario of just a building being given by Civilization_FreeBuildingClasses. In this case, it worked fine. Therefore, it shouldn't be that a building given by that table with espionage modifier that breaks the Spy assignment window.

Next up, I created a new "Test Dummy" building which had 2 effects:
1) It is a hidden building.
2) It provides the same EspionageModifier as my UB, and nothing else.

Assigning this to be handed out by the Civilization_FreeBuildingClasses table caused the Spy assignment window to break again. However, using IGE, I manually removed this building from my Capital. Immediately thereafter, the Spy assignment window worked as normal. I then used IGE to manually add back this building into my Capital, upon which the Spy assignment window broke again.

As for why this is the case, I believe it's because the hidden building has no name / description.
When my UB stood in the city, the Spy assignment window (if you hover over the "stars" in order to find the city's potential) lists any effects to espionage occurring in that city.

However, it must be able to have a building name in order to properly render the effect. With my UB in place, hovering over my Capital revealed a -15% modifier alongside the name of my UB. Since the hidden building has no name, it failed to render, and screwed up the window. Removing the hidden building meant there was no longer any reason to try and grab a non-existent name, and the window began working normally.

To verify this, I went back to my hidden building definition and manually added in a Description: Test Espionage Dummy.
I saved, rebuilt, and loaded the game, sped to Spies, and as expected, Spy assignments were working as normal, without being broken, and the building remained hidden from the city info screen.

Civ5HiddenEspionageTest.png

This "name" issue came to mind, because it fits with my discovery about a week or so ago, when I approached you for some help regarding why my Civilopedia became broken.

It seems the game crashes and burns when it attempts to find the name/description of buildings that don't have any. In this case, EspionageModifier causes the game to try to find the name of the building that provides the modifier in the Spy assignment window.
 
And I just replicated your test and saw essentially the same thing so I updated all my tutorials and templates on hidden buildings to reflect adding a description tag and a throw-away building name, such as 'hidden' to avoid this problem in future. Only one I haven't gotten to yet is the tutorial here on the forum.

I guess JFD was right a couple months ago when he kept insisting a description tag was necessary and I kept saying I made successful buildings without one. He was thinking it would break the civilopedia, and I kept saying it doesn't. But he was more right than I was since it does whomp the spy system if you add an espionage modifier. It's just in a few conditions where it's needed, apparently, but much easier to avoid the whole issue by including a description even if it's never going to show anywhere.
 
Well, at least it's a simple enough fix for this issue, as opposed to some ridiculous Firaxis logic.

For the most part, completely hidden buildings are fine without it, though as you say, there are still a few instances where it's necessary. I found this out as well, with my trying to create a unique building class and breaking the Civilopedia in the process with it. Just know that there is still the odd scenario where this description would force the hidden building to appear in the Civilopedia, but that's only because the Civilopedia has been instructed to go looking for this building for one reason or another.

Otherwise, glad I could help verify your findings; Your Buildings tutorial was an immense help for me, so I'm happy I can reciprocate and provide some help here.
 
Back
Top Bottom