Unique Units in the Pedia

WCH

Prince
Joined
Mar 26, 2008
Messages
491
When you open up, say, Bannor in the Pedia, it tells you that they have no unique units and makes them look exceptionally boring. Text mentions how they're good at all-out war, but doesn't explain why.

I know this is because "unique unit" is a holdover from base Civ and means a normal unit has been replaced, but it's misleading in the extreme: stuff like Demagogues, which only Bannor can build, are absolutely unique units, and absolutely should be displayed. Failing to do so means it's impossible to learn about what your options are going to be prior to trying them out, and that people will look at the Civ and assume it sucks because it gets nothing.

So how can we get it to display units that only that empire can build as "unique units?" Anyone have any ideas?
 
First, a word of warning: This method works perfectly in FF, FFPlus, and Orbis. I do not believe it uses anything unique to those mods, and instead just expands the search for unique units, but it may well turn out that it does NOT work. Use at your own risk. :p I'm not testing this for FfH, nor even particularly looking at the code... I know for a fact it works in the modmods. ;)



Go into Assets/Python/Screens, and open up CvPediaCivilization.py. BACK UP THIS FILE! Copy and paste a new one. This will enable you to back out these changes.

Find def PlaceBuilding and def PlaceUnit.

Select them both, and paste over them with the following code...

Code:
	def placeBuilding(self):
		screen = self.top.getScreen()

		panelName = self.top.getNextWidgetName()
		screen.addPanel( panelName, localText.getText("TXT_KEY_UNIQUE_BUILDINGS", ()), "", false, true,
				self.X_BUILDING, self.Y_BUILDING, self.W_BUILDING, self.H_BUILDING, PanelStyles.PANEL_STYLE_BLUE50 )
		screen.attachLabel(panelName, "", "  ")

		for iBuilding in range(gc.getNumBuildingClassInfos()):
			iUniqueBuilding = gc.getCivilizationInfo(self.iCivilization).getCivilizationBuildings(iBuilding);
			iDefaultBuilding = gc.getBuildingClassInfo(iBuilding).getDefaultBuildingIndex();
			if (iDefaultBuilding > -1 and iUniqueBuilding > -1 and iDefaultBuilding != iUniqueBuilding) or (iUniqueBuilding > -1 and gc.getBuildingClassInfo(iBuilding).isUnique()):
				screen.attachImageButton( panelName, "", gc.getBuildingInfo(iUniqueBuilding).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_BUILDING, iUniqueBuilding, 1, False )

	def placeUnit(self):
		screen = self.top.getScreen()

		panelName = self.top.getNextWidgetName()
		screen.addPanel( panelName, localText.getText("TXT_KEY_FREE_UNITS", ()), "", false, true,
				 self.X_UNIT, self.Y_UNIT, self.W_UNIT, self.H_UNIT, PanelStyles.PANEL_STYLE_BLUE50 )
		screen.attachLabel(panelName, "", "  ")

		for iUnit in range(gc.getNumUnitClassInfos()):
			iUniqueUnit = gc.getCivilizationInfo(self.iCivilization).getCivilizationUnits(iUnit);
			iDefaultUnit = gc.getUnitClassInfo(iUnit).getDefaultUnitIndex();
			if (iDefaultUnit > -1 and iUniqueUnit > -1 and iDefaultUnit != iUniqueUnit) or (iUniqueUnit > -1 and gc.getUnitClassInfo(iUnit).isUnique()):
				szButton = gc.getUnitInfo(iUniqueUnit).getButton()
				if self.top.iActivePlayer != -1:
					szButton = gc.getPlayer(self.top.iActivePlayer).getUnitButton(iUniqueUnit)
				screen.attachImageButton( panelName, "", szButton, GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, iUniqueUnit, 1, False )
 
Demagogues and Flagbearers .... along with melee units gaining the GUARDSMAN promotion, although I suppose that might be listed as a civ-trait, also to list Crusade as a unique civic would be nice.

Edit: :ninja:
 
They have Demagogues and Flagbearers, but neither one replaces another standard unit so they don't show up as unique units in the pedia.
 
Back
Top Bottom