How do you hide Civlopedia entries?

I would like to see this. Is it buried in FFH2?

Yeah, but I can link the relevant parts here:

in CIV4UnitSchema.xml (additions in bold):

Code:
	<ElementType name="bCtrlDown" content="textOnly" dt:type="boolean"/>
[b]	<ElementType name="bGraphicalOnly" content="textOnly" dt:type="boolean"/>[/b]
	<ElementType name="iHotKeyPriority" content="textOnly" dt:type="int"/>

Code:
		<element type="bCtrlDown"/>
[b]		<element type="bGraphicalOnly"/>[/b]
		<element type="iHotKeyPriority"/>

And in CvPediaUnit.py:

Code:
	def getUnitSortedList(self, bHero):
		listUnits = []
		iCount = 0
		for iUnit in range(gc.getNumUnitInfos()):
			if (self.getUnitType(iUnit) == bHero and not gc.getUnitInfo(iUnit).isGraphicalOnly()):
				listUnits.append(iUnit)
				iCount += 1
		
		listSorted = [(0,0)] * iCount
		iI = 0
		for iUnit in listUnits:
			listSorted[iI] = (gc.getUnitInfo(iUnit).getDescription(), iUnit)
			iI += 1
		listSorted.sort()
		return listSorted

Note that the above code is also modified to allow the requester to pass in a bHero flag to tell if we want the returned list to be full of World Units or non-World units. Probably not a big deal for you so you wouldn't want to include that. Instead you probably just want the not gc.getUnitInfo(iUnit).isGraphicalOnly() check.

The magic of this method is that bGraphicalOnly and isGraphicalOnly() are base definitions for all object types. Its not defined in schema for a unit or building, but once you set it up in schema everything works because its already inherited in the SDK. Makes it very simple.
 
Note that the above code is also modified to allow the requester to pass in a bHero flag to tell if we want the returned list to be full of World Units or non-World units. Probably not a big deal for you so you wouldn't want to include that. Instead you probably just want the not gc.getUnitInfo(iUnit).isGraphicalOnly() check.

The magic of this method is that bGraphicalOnly and isGraphicalOnly() are base definitions for all object types. Its not defined in schema for a unit or building, but once you set it up in schema everything works because its already inherited in the SDK. Makes it very simple.

If it is just checking the CvUnitInfo.isGraphicalOnly() method, then I already have it included! I'll only need to test it and provide the xml schema file and instructions with the Sevopedia.

But for some reason I remember I had looked at the SDK source before and saw that the isGraphicalOnly() method was not actually looking at the XML. Instead it seemed to be just checking for certain entries directly. Maybe I read the source incorrectly or did not look at the base class version or something. I'll look again when I get home.
 
Well I'll be... :shake:

The SDK looks for the nonexistent bGraphicalOnly tags and it hardcodes certain entries as graphical only. :wow:

When I was reading it again I noticed I must have glossed over a particular &:
Spoiler CvInfoBase::read(CvXMLLoadUtility* pXML) :
Code:
//
// read from XML
// TYPE, DESC, BUTTON
//
bool CvInfoBase::read(CvXMLLoadUtility* pXML)
{
	CvString szTextVal;

	// Skip any comments and stop at the next value we might want
	if (!pXML->SkipToNextVal())
	{
		return false;
	}

	if (pXML->GetXmlVal(szTextVal))
	{
		// GetXmlVal returns the XML tags for all children as well, separated by spaces
		// Keep only the first value
		CvString::size_type i = szTextVal.find(' ', 0);
		if (CvString::npos != i)
		{
			szTextVal.resize(i);
		}
		setXmlVal(szTextVal);
	}

	pXML->MapChildren();	// try to hash children for fast lookup by name

	// GRAPHICAL ONLY
	[b]pXML->GetChildXmlValByName(&m_bGraphicalOnly, "bGraphicalOnly");[/b]

	// TYPE
	if (pXML->GetChildXmlValByName(szTextVal, "Type"))
	{
		setType(szTextVal);
	}

	// DESCRIPTION
	if (pXML->GetChildXmlValByName(szTextVal, "Description"))
	{
		setTextKey(szTextVal);
	}

	// CIVILOPEDIA
	if (pXML->GetChildXmlValByName(szTextVal, "Civilopedia"))
	{
		setCivilopediaKey(szTextVal);
	}

	// HELP
	if (pXML->GetChildXmlValByName(szTextVal, "Help"))
	{
		setHelpKey(szTextVal);
	}

	// STRATEGY
	if (pXML->GetChildXmlValByName(szTextVal, "Strategy"))
	{
		setStrategyKey(szTextVal);
	}

	// BUTTON
	if (pXML->GetChildXmlValByName(szTextVal, "Button"))
	{
		setButton(szTextVal);
	}

	return true;
}
I thought it was not reading the bGraphicalOnly tag into m_bGraphicalOnly variable at all when I didn't see a call to a set method. :lol:

Especially when I saw hardcoding like this:
Code:
	pXML->GetChildXmlValByName(&m_bLeader, "bLeader");
	if (m_bLeader)
	{
		m_bGraphicalOnly = true;  // don't show in Civilopedia list of promotions
	}
Must never doubt Kael. :blush:

Well, I tested it. The beta I've distributed already supports the bGraphicalOnly xml tags. :D Now I should write some minimal documentation.

I will still recommend the way I wrote already since it shows your civ specific button and animation correctly, and requires no additional work. Not to mention you won't be forced to hide the hardcoded graphical only entries... you will still be able to see Lead by Warlord, for example.

At some point I have to get back to fixing that bug where the special abilities text doesn't show unique unit for units that replace NONE. ;)

P.S. Do you guys think I should include all the schemas or just the units schema as a sample?
 
How do you hide Civlopedia entries?

It's not that big of a deal but with mods like Patricius' GreatPersonMod with the civ-specific greatpeople mod, and others, it would be useful if you could hide all the repetitive entries - just clear the civlopedia up a bit - because it's annoying. So, anyone know how to do this?

Chugginator, you will be pleased to know that this issue has finally been cleared up in the civ-specific great people mod, thanks to this thread. :goodjob:

An updated version will be posted soon.
 
Yeah, but I can link the relevant parts here:

Spoiler :
in CIV4UnitSchema.xml (additions in bold):

Code:
	<ElementType name="bCtrlDown" content="textOnly" dt:type="boolean"/>
[b]	<ElementType name="bGraphicalOnly" content="textOnly" dt:type="boolean"/>[/b]
	<ElementType name="iHotKeyPriority" content="textOnly" dt:type="int"/>

Code:
		<element type="bCtrlDown"/>
[b]		<element type="bGraphicalOnly"/>[/b]
		<element type="iHotKeyPriority"/>

And in CvPediaUnit.py:

Code:
	def getUnitSortedList(self, bHero):
		listUnits = []
		iCount = 0
		for iUnit in range(gc.getNumUnitInfos()):
			if (self.getUnitType(iUnit) == bHero and not gc.getUnitInfo(iUnit).isGraphicalOnly()):
				listUnits.append(iUnit)
				iCount += 1
		
		listSorted = [(0,0)] * iCount
		iI = 0
		for iUnit in listUnits:
			listSorted[iI] = (gc.getUnitInfo(iUnit).getDescription(), iUnit)
			iI += 1
		listSorted.sort()
		return listSorted

Note that the above code is also modified to allow the requester to pass in a bHero flag to tell if we want the returned list to be full of World Units or non-World units. Probably not a big deal for you so you wouldn't want to include that. Instead you probably just want the not gc.getUnitInfo(iUnit).isGraphicalOnly() check.

The magic of this method is that bGraphicalOnly and isGraphicalOnly() are base definitions for all object types. Its not defined in schema for a unit or building, but once you set it up in schema everything works because its already inherited in the SDK. Makes it very simple.



That's bad ass! :goodjob:


So just to re-verify... this requires no SDK work... it's straight up XML only?
 
Yep, tis good. I'm actually working on combining the Civ-Specific Great Person Mod and the Great Person Mod (with the picture pop-ups), so I will be needing this.

Wow, that sounds like a lot of work! I should point out that it might be very hard to find pictures/quotes for some of the ancient names I used, especially those who are mentioned only in passing in ancient records. But I say go for it. I like the great person mod, too.

As I said, I will be posting an updated version very soon that fixes the civilopedia issues and adds about 200 more names. I'm also doing a MASSIVE update for Civ-Specific GP 2.0, which when it is finished will have over 2,000 Great People. Should blow the competition out of the water. ;)
 
That's bad ass! :goodjob:


So just to re-verify... this requires no SDK work... it's straight up XML only?

And the included python change. It doesnt take any SDK work.
 
Wow, that sounds like a lot of work! I should point out that it might be very hard to find pictures/quotes for some of the ancient names I used, especially those who are mentioned only in passing in ancient records. But I say go for it. I like the great person mod, too.

As I said, I will be posting an updated version very soon that fixes the civilopedia issues and adds about 200 more names. I'm also doing a MASSIVE update for Civ-Specific GP 2.0, which when it is finished will have over 2,000 Great People. Should blow the competition out of the water. ;)

Over 2000 people?? Not sure if I'll be able to keep up with the art and quotes there, but I'll try.
 
I don't think you even need to go that far, do you? Just set it in XML under the UU tag, although this might not work for that particular pedia section. I haven't tried, so I don't know.
 
I'm pretty sure you have to do some python, similar to what Kael did with the CvPediaUnit.py file. I wonder if a direct copy/paste to the CvPediaCivilization.py file would do the trick?
 
Top Bottom