Quick Modding Questions Thread

Setting one tag on each thing you want to hide is complicated?

Try it with one. If that one disappears from the 'pedia (whichever one you are using) then it works.

As I recall, with the regular Civilopedia it only works for some things without modifications. I don't think it worked at all for the Sevopedia - I had to modify the 'pedia code in FFP to get it to work.

It's a pretty easy change in the Sevopedia to get it to apply to everything since it uses a single function to get the lists of things to display. One line changed in getSortedList and one 2 line member function added to the TraitInfo class it uses to deal with the traits.

Here are the changes you need to add to SevoPediaMain.py. Add the things in red (the comments are what are int he FFP version of this file, which I just copied these from):
Code:
	def getTraitInfo(self, id):
		info = gc.getNewConceptInfo(id)
		if self.isTraitInfo(info):
			
			class TraitInfo:
				def __init__(self, conceptInfo):
					self.conceptInfo = conceptInfo
					sKey = conceptInfo.getType()
					sKey = sKey[sKey.find("TRAIT_"):]
					self.eTrait = gc.getInfoTypeForString(sKey)
					self.traitInfo = gc.getTraitInfo(self.eTrait)
				def getDescription(self):
					return u"%c %s" % (TraitUtil.getIcon(self.eTrait), self.traitInfo.getDescription())
				def getButton(self):
					return self.traitInfo.getButton()
				[B][COLOR="DarkRed"]def isGraphicalOnly(self):	# FFP : do not show items with bGraphicalOnly set to 1
					return self.traitInfo.isGraphicalOnly()[/COLOR][/B]
			
			return TraitInfo(info)
		return None

and

Code:
	def getSortedList(self, numInfos, getInfo, noSort=False):
		list = []
		for i in range(numInfos):
			item = getInfo(i)
			if item [B][COLOR="darkred"]and not item.isGraphicalOnly()[/COLOR][/B]: # FFP : do not show items with bGraphicalOnly set to 1
				list.append((item.getDescription(), i))
		if self.isSortLists() and not noSort:
			list.sort()
		return list
Ive never messed with schemas, which one is this being borrowed from?Resources right? Also speaking of the python code in there, J provided me with this code that if a unit is only buildable once it goes into seperate sheet
Code:
###world units - part 7
	def getSortedUnitList(self, numInfos, getInfo,bWorld):
		list1 = []
		iNumInfos = 0
		for i in range(numInfos):
                        cvUnit = gc.getUnitInfo(i)
                        cvUnitClass = gc.getUnitClassInfo(cvUnit.getUnitClassType ())
                        if cvUnitClass.getMaxGlobalInstances ()=1 and bWorld:                      
                                list1.append(i)
                                iNumInfos += 1
                        elif cvUnitClass.getMaxGlobalInstances ()!=1 and not bWorld:
                                list1.append(i)
				iNumInfos += 1
		list2 = [(0,0)] * iNumInfos
		i = 0
		for iUnit in list1:
			list2[i] = (gc.getUnitInfo(iUnit).getDescription(), iUnit)
			i += 1                                
		if self.bSortLists:
			list2.sort()
		return list2z
###world units - part 7
I want to change it though so that every unit that has any world restrictions goes in there. So it would make sense to set the first one as !=-1 and the second =-1, but the neagative doesnt turn red in notepad so im assuing I need to do it another way?
 
:hmm: don't really understand what you want to do now.

Nope. No effect. Also, after switching back to old folder structure it doesn't work there anymore either.

This has been stumping me for a while now. The XML appears correct, the folder structure also appears fine and art isn't the problem (I've tried it with working buttons):mad:.

:hmm: please .zip the whole thing, I want to take a look at it.
 
:hmm: don't really understand what you want to do now.
Simply put - it is checking if the unit is only buildable once in the world, I want it to check to see if there is any restriction above 0. So instead of if it =1 I want it to say if it = or > 1. Another option would be if != -1. I dont know how to right that though
 
J does this look right because it isnt working

Code:
###world units - part 7
	def getSortedUnitList(self, numInfos, getInfo,bWorld):
		list1 = []
		iNumInfos = 0
		for i in range(numInfos):
                        cvUnit = gc.getUnitInfo(i)
                        cvUnitClass = gc.getUnitClassInfo(cvUnit.getUnitClassType ())
                        if cvUnitClass.getMaxGlobalInstances ()[COLOR="red"]>=1[/COLOR] and bWorld:                      
                                list1.append(i)
                                iNumInfos += 1
                        elif cvUnitClass.getMaxGlobalInstances ()[COLOR="red"]<1[/COLOR] and not bWorld:
                                list1.append(i)
				iNumInfos += 1
		list2 = [(0,0)] * iNumInfos
		i = 0
		for iUnit in list1:
			list2[i] = (gc.getUnitInfo(iUnit).getDescription(), iUnit)
			i += 1                                
		if self.bSortLists:
			list2.sort()
		return list2z
###world units - part 7
Code:
###world units - part 5
		if (iCategory == CvScreenEnums.PEDIA_UNITS):                       
                        cvUnit = gc.getUnitInfo(iItem)
                        cvUnitClass = gc.getUnitClassInfo(cvUnit.getUnitClassType ())
                        if cvUnitClass.getMaxGlobalInstances ()[COLOR="Red"]>=[/COLOR]1:
                                iCategory = iCategory+1
###world units - part 5
The last one I change to either ==1 or >=1 and it doesnt work
 
Not surprising it does not work.
Not sure what bWorld stands for, but assuming it means World Unit
>=1 and bWorld, it is a limited World Unit
< 1 and not bWorld, it is unlimited non World Unit
In short, all units fall into either one of those...

If bWorld really means World Unit, then just scrap both if and elif statements and simply use:
Code:
if bWorld:
       list1.append(i)
       iNumInfos += 1

If that does not work, try
Code:
 if cvUnitClass.getMaxGlobalInstances > 0:
       list1.append(i)
       iNumInfos += 1
instead
 
:hmm: please .zip the whole thing, I want to take a look at it.

Thanks The_J, it's probably some really obvious mistake that you'll find in like two seconds;)

Unfortunately it's a little to big too upload(even zipped), so here is the XML and relevant Art files.
 

Attachments

Thanks The_J, it's probably some really obvious mistake that you'll find in like two seconds;)

Unfortunately it's a little to big too upload(even zipped), so here is the XML and relevant Art files.

Okay...you mentioned especially the American civ.
If you now take a look at your entry in the ArtDefines_Civilizations.xml, you will see that you've began the folder paths with "Assets", which is wrong. The most upper mentioned path should be the Art folder.
tl;dr: Remove the Assets\ at the beginning of the paths.

Not surprising it does not work.
Not sure what bWorld stands for, but assuming it means World Unit
>=1 and bWorld, it is a limited World Unit
< 1 and not bWorld, it is unlimited non World Unit
In short, all units fall into either one of those...

Maybe I'm dumb, but that's what he wants to do...or not :confused:?
 
Okay...you mentioned especially the American civ.
If you now take a look at your entry in the ArtDefines_Civilizations.xml, you will see that you've began the folder paths with "Assets", which is wrong. The most upper mentioned path should be the Art folder.
tl;dr: Remove the Assets\ at the beginning of the paths.

Forgot about that, in my blind stumbling for a solution I added that and didn't take it out when it didn't work.

Unfortunately removing it didn't fix anything and either way I still don't get buttons for my other civs.
 
J provided me with this code that if a unit is only buildable once it goes into seperate sheet.
I want to change it though so that every unit that has any world restrictions goes in there.

From the info I gathered from what he mentioned, the current code places only world units with 1 limit instance into 1 page, while the rest are in another page.
He wanted to include all world units with any limit instance into the same page.

A unit with global instance 99 is still a world unit, although everyone can build up to a total of 99 of them, but it won't be added by the current code according to him.

However, when he uses globalinstance <1, it means all normal units are added as well, so obviously won't work.
 
Forgot about that, in my blind stumbling for a solution I added that and didn't take it out when it didn't work.

Unfortunately removing it didn't fix anything and either way I still don't get buttons for my other civs.

Which other civs?
Because e.g. Bulgaria has still the ArtDef entry of the Aztecs.

From the info I gathered from what he mentioned, the current code places only world units with 1 limit instance into 1 page, while the rest are in another page.
He wanted to include all world units with any limit instance into the same page.

A unit with global instance 99 is still a world unit, although everyone can build up to a total of 99 of them, but it won't be added by the current code according to him.

However, when he uses globalinstance <1, it means all normal units are added as well, so obviously won't work.

But then >=1 and bWorld should work.
Everything with a limit should then be in this category.
 
True, but then he went on and edit
elif cvUnitClass.getMaxGlobalInstances ()<1 and not bWorld:

This will then add all the normal units into the same page as well, wouldn't it?
 
Which other civs?
Because e.g. Bulgaria has still the ArtDef entry of the Aztecs.

AHA! You made me realize my problem. Apparently I have been editing (and what I sent to you) old backup files without my recent edits*facepalm*. Now it's fixed :)

Thank you
 
Good to hear :).

True, but then he went on and edit
elif cvUnitClass.getMaxGlobalInstances ()<1 and not bWorld:

This will then add all the normal units into the same page as well, wouldn't it?

Nonono, the bWorld parameter is given in the function call. The function will either only grab the world units, or all the normal units, and these will be listed separately.
 
I agree, with the code you provided, but not the one he edited.

Which units will fall under this code?
elif cvUnitClass.getMaxGlobalInstances ()<1 and not bWorld:
 
Is it possible to prevent a land unit from being airliftable (via Airport)?
 
I have a question regarding modifying the icons for religions...

I have successfully changed the gamefont.tga's, and have changed the religion icon .dds files, so all is well... except in the religion advisor, where the Black and White icons appearing (before any religion is founded), remain unchanged. Obviously the files I have edited do not cover those black and white icons.

I have posted two images, the colour represents when the religions are founded (all working fine), the B/W version is what I see before a religion is created.

Anyone know where I can locate those files for editing?
 

Attachments

  • religion advisor.png
    religion advisor.png
    50.3 KB · Views: 44
  • All religions.png
    All religions.png
    66.1 KB · Views: 37
Anyone know where I can locate those files for editing?

The black & white icons are not referenced anywhere in the XML. All you have to do is place the file in the same location as the color file, with _d added to the name. So if your Druidry icon is named Druidry.dds, create an identical grayscale dds and save it as Druidry_d.dds.
 
Back
Top Bottom