Modmodding Q&A Thread

The art works correctly in the city screen and civilopedia. But if you click the icon in the city screen so as to build it then the game crashes. :confused:
If the button tag has just one entry, you need to remove the initial comma as well.

How would I get the return 1 to give all of the unique great people.
Code:
	def getUnitType(self, iUnit):
		if (isNationalWonderClass(gc.getBuildingInfo(iBuilding).getBuildingClassType())):
			return 1
		else:
			return 0
How would I change the code below to access the 1 instead of all units? I've tried "return self.pediaUnit.getUnitSortedList(1)" but it doesn't work because it need the units to be sorted in the sevopedia which they aren't.
Code:
	def getUnitGreatList(self):
		return self.getSortedList(gc.getNumUnitInfos(), gc.getUnitInfo)
Using buildings and national wonders as criteria to do something with units obviously won't work. What is even your goal here?

I couldn't find the Secularism code so I'll just ask. Are there any other wonders that Secularism doesn't allow other than Apostolic Palace and all the Pantheon Wonders?
Don't think so. It only removes the state religion requirement from wonders that have such a requirement (except the AP because that wouldn't make sense).
 
How would I get the return 1 to give all of the unique great people.

If you apply this code, it will skip all unit which have graphical only. (Which are the slave types, old UU (like Navy SEAL) and all unique GP) So the unique GP won't show up in the list of unique units.

I would place it directly after the for loop.

Code:
	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()):
[COLOR="Blue"]			if gc.getUnitInfo(iUnit).isGraphicalOnly(): continue[/COLOR]
			iUniqueUnit = gc.getCivilizationInfo(self.iCivilization).getCivilizationUnits(iUnit)
			iDefaultUnit = gc.getUnitClassInfo(iUnit).getDefaultUnitIndex()
			if (iDefaultUnit > -1 and iUniqueUnit > -1 and iDefaultUnit != iUniqueUnit):
				screen.attachImageButton(panelName, "", gc.getUnitInfo(iUniqueUnit).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, iUniqueUnit, 1, False)
 
Sorry terribly explained. I want to split the units into two groups 0 (all units except unique great people) and 1 (all unique great people). Similar to what I've done to the Embassies.
2014-11-28_00006.jpg
I want 0 to be the Units category and 1 to be the Great People.
What I want to know is what code do I put in the emboldened sections.
Code:
	def getUnitType(self, iUnit):
		if ([B]all Unique great people[/B]):
			return 1
		else:
			return 0
This is the code used for the buildings but it is based on sorting them by National, Team, World or normal so I'm not sure if it will work.
Code:
	def placeUnits(self):
		self.list = self.getUnitList()
		self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, gc.getUnitInfo)
	
	def getUnitList(self):
		return ([B]All units in 0[/B])


	def placeUnitGreats(self):
		self.list = self.getUnitGreatList()
		self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_UNIT, gc.getUnitInfo)
	
	def getUnitGreatList(self):
		return ([B]all units in 1[/B])
 
Okay, that makes more sense. It's kind of hard to come up with code when I don't know what it's supposed to be used for.

I don't think you need a method that decides between unique GPs and regular units, you just need those two methods that create a list for both. I think there is a simple criterion selecting great people, but I don't have the code at hand right now so I cannot say. Let's assume right now that it is gc.getUnitInfo(iUnit).isGreatPerson(), then you could get a list of all units that are great people as follows:

Code:
[iUnit for iUnit in range(con.iNumUnits) if gc.getUnitInfo(iUnit).isGreatPerson()

Combine with isGraphicalOnly() if you only want unique GPs, negate to get a list without them. I'll follow up with the correct method once I can look it up.
 
Okay, the best way to check is probably:
Code:
gc.getUnitInfo(iUnit).getSpecialUnitType() == GC.getInfoTypeForString("SPECIALUNIT_PEOPLE")
 
That will also allow scouts scouts and missionaries.

This should work.

Code:
	if (gc.getUnitInfo(iUnit).getProductionCost() == -1 and not gc.getUnitInfo(iUnit).isAnimal()):
 
True. You could also go via tech discovery points and join experience.
 
Code:
	def getUnitType(self, iUnit):
		if (gc.getUnitInfo(iUnit).getProductionCost() == -1 and not gc.getUnitInfo(iUnit).isAnimal()):
			return (1)
		else:
			return (0)

[B]Different File:[/B]

	def getUnitList(self):
		return self.getSortedList(gc.getNumUnitInfos(), gc.getUnitInfo)
So what do I have to change in the def getUnitlist to access getUnitType? I've tried some combinations but It always creates errors.
Code:
	def getProjectType(self, iProject):
		if (isTeamProject(iProject)):
			return (3)
		elif (isWorldProject(iProject)):
			return (2)
		else:
			return (1)

[B]Different File:[/B]

	def placeProjects(self):
		self.list = self.getProjectList()
		self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, gc.getProjectInfo)
	
	def getProjectList(self):
		return self.pediaProject.getProjectSortedList(3)

		
	def placeWorldProjects(self):
		self.list = self.getWorldProjectList()
		self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, gc.getProjectInfo)
	
	def getWorldProjectList(self):
		return self.pediaProject.getProjectSortedList(2)
This brings the error "TypeError: getProjectSortedList() takes exactly 1 argument (2 given)". What does this mean?
 
Exactly what it says. Look up the definition of getProjectSortedList to see what kind of arguments it expects.

And as I said, an extra method is kind of pointless, just create the list of units directly like I explained above.
 
I finally got the World Project and National Project working by using your advice:
Code:
	def placeProjects(self):
		self.list = self.getProjectList()
		self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, gc.getProjectInfo)
	
	def getProjectList(self):
		lExceptions = [con.iManhattanProject, con.iTheInternet]
		return self.getSortedList(gc.getNumProjectInfos(), gc.getProjectInfo, False, lExceptions)

		
	def placeWorldProjects(self):
		self.list = self.getWorldProjectList()
		self.placeItems(WidgetTypes.WIDGET_PEDIA_JUMP_TO_PROJECT, gc.getProjectInfo)
	
	def getWorldProjectList(self):
		lExceptions = [con.iSDI, con.iApolloProgram, con.iSSCasing, con.iSSThrusters, con.iSSEngine, con.iSSDockingBay, con.iSSCockpit, con.iSSLifeSupport, con.iSSStasisChamber, con.iPersecutionProject]
		return self.getSortedList(gc.getNumProjectInfos(), gc.getProjectInfo, False, lExceptions)
The problem is when you select a World Project 2014-12-15_00004.jpgit will go to the world project in the national project2014-12-15_00005.jpg section. Because the national project section has just hidden them not removed them. Any easy way to fix this?
 
Hmm I guess not, the responsible code is under WIDGET_PEDIA_JUMP_TO_PROJECT in the DLL.
 
Do you have the same problem when selecting Great People? IIRC, it works with the same principle. So if that works, the PEDIA_JUMP_TO_PROJECT isn't the problem I guess.
 
Do foreign cores of death civs still count for the calculation of the stability of a tile?

Example:
Southern Italy is historical for Byzantium. However, it is in the core of Rome. So you would expect it to be contested for Byzantium.
 
Foreign cores only apply if their civilizations are alive or can still respawn.
 
Related question:

I loaded a Persian game. The cores of all civs showed up as foreign core (I WB'd myself visibility of every tile), except Tibet, Aztecs and Congo. (And maybe some others I didn't notice) Why don't they show up as foreign core?
 
Not sure right now.
 
How can you define that every citizent consumes 3 food?
 
Back
Top Bottom