Quick Modding Questions Thread

And another one from me. I know the diplo screen is generally considered unmoddable, but I wonder if the strings used are not. In particular the leader/civ name text at the top of the screen - I'd love to be able to intercept it and reduce the font size if it's too long (as in this example).
The text is generated by CvGameTextMgr::getTradeScreenHeader (and the religion and civic icons are chosen by the two functions above that one), so dynamically shortening some part of the text should be easy, but I don't think the font size can be changed. <font=1>...</font> tags – which work for screen.setText in Python – don't do the trick, they're treated as being part of the text.
Has anyone ever figured out how to make GFC billboards (setting a negative value in CIV4ArtDefines_Misc.xml) work in a meaningful way? I can't seem to find a way to influence, first and foremost, the width of the name (as you can see it is cut off at the sides, and messing with the nif of the billboard itself does nothing) or the scale of the font (technically the fScale in CIV4ArtDefines_Misc.xml is supposed to be, you know, scale, but it seems to not have any effect outside switching between positive and negative).
Iirc, I had the same results as you when changing the fScale. I also imagined that the enlarging the billboard might help, but I didn't experiment with that. Good to know that this is a dead end.
 
The text is generated by CvGameTextMgr::getTradeScreenHeader (and the religion and civic icons are chosen by the two functions above that one), so dynamically shortening some part of the text should be easy, but I don't think the font size can be changed. <font=1>...</font> tags – which work for screen.setText in Python – don't do the trick, they're treated as being part of the text.
Thanks for pointing me in the right direction! Using <font> tags was my default idea, but after some consideration I just changed getCivilizationDescription to getCivilizationShortDescription. Quick and easy, seems to cover all overly long cases! :goodjob:
Iirc, I had the same results as you when changing the fScale. I also imagined that the enlarging the billboard might help, but I didn't experiment with that. Good to know that this is a dead end.
That's a pity; it feels like this option was never actually implemented properly, as it couldn't have been useful in its current state.
 
Hello, is it possible to add gloss textures in Blender rather than Nifskope? If so, could someone please point me to a tutorial, or post screenshots to show me how it's done? Thank you. :)
 
I want to add a plethora of religions, but I don't want to have dozens of religions present in every game. I came up with a theoretical solution of having one technology found multiple religions, and then turning on Limited Religions (a game option in RevolutionDCM that allows one player to only found one religion) - but even regardless of this Limited Religions option, it turns out the game doesn't understand what to do when one technology founds multiple religions (only one religion can be found from that technology, ever, and a graphics glitch appears where e.g. if Meditation would unlock two religions, the tech icon in the 'what shall we research next'-window (not in the main tech tree overview), Polytheism takes the icon of Meditation).

My next thought is to make a couple of technologies that can never be researched, but that a Great Prophet can bulb, to only allow religions to be founded by Great Prophets. I have no idea yet if that will work... But no, that is undesirable as well, because so long as the above scenario doesn't work, that means you can bulb a dozen useless technologies (the religion has already been founded, so the technology serves no purpose anymore); you would need to have one technology that founds all religions (but limits this to one per player). Plus, the AI wouldn't know which of the dozen technologies to choose to get their favourite religion. So no.

Does anyone have any ideas on this? Any thoughts, best practices, philosophical musings, whatever? :)
 
Last edited:
Using only XML, I assume(?). Perhaps you could make all but 7 arbitrary religions unavailable (don't know if assigning no prereq. tech would have that effect) and then use the Choose Religion option to make all religions available after all – to the extent that they are favorite religions of AI leaders or get picked by human players.
 
I integrated platyping's True Prophets mod component ( https://forums.civfanatics.com/thre...sant-posh-python.497337/page-21#post-12604206 ), which the AI seems to understand decently enough (if I start a new game and give the AI a dozen Great Prophets, the AI doesn't found a religion at all, but if the AI gets a Great Prophet by naturally playing a game, it does found religions). So now I need to figure out how to disable the religion founding buttons from appearing if GameOptionTypes.GAMEOPTION_LIMITED_RELIGIONS is on and if the player has already founded a religion... Though I have no idea how to do that.
 
This line
if CyGame().isReligionFounded(iReligion): continue
in CvMainInterface.py looks like it's responsible for hiding the button when the religion is already taken.
Then, we have in RevDCM:
Spoiler :
Code:
bool CvPlayer::canFoundReligion() const
{
	if( getNumCities() < 1 || isBarbarian() 
	|| (GC.getGameINLINE().isGameStart() && GC.getGameINLINE().getElapsedGameTurns() < 3) )
	{
		return false;
	}

	if(GC.getGameINLINE().isOption(GAMEOPTION_LIMITED_RELIGIONS))
	{
		if( ((getNumCities() > 1) && !(isRebel())) || !GC.isLIMITED_RELIGIONS_EXCEPTIONS() )
		{
			if(hasHolyCity())
			{
				return false;
			}
		}
	}

	return true;
}
That's exposed to Python, so perhaps adding
if not gc.getPlayer(iPlayer).canFoundReligion(): continue
will do the trick.
 
Ah, thank you, that is exactly what I was trying, I just needed to verify whether canFoundReligion() was indeed the main thing introduced by Limited Religions to do this. Unfortunately, if it indeed is the case, then the below doesn't do anything to hide the buttons - although, if you remove the 'not', all buttons are forever hidden:
1667755855888.png

Also, I was under the impression that one no longer needed to fiddle around with the GameFont file(s)? It's something that I have never done before, but, upon adding a new religion, the icons get displaced (e.g. Judaism shows up as Christianity, et cetera), so I guess I will actually need to figure out how to add icons within the GameFont file(s)...?
 
In my mod building can discover CERTAIN techs, so I added dummy buildings with dummy techs. Some of them are buildable by prophets others require certain terrain properties. Read more here under 'Religions Reborn':
It works really well because the AI funds religions all over the world. Only thing is, that the dummy techs need to be researchable normally too otherwise the AI gets stuck not researching anything. So I set up the dummy techs requiring Future tech.
 
That sounds like an SDK change, that buildings can discover technologies (that can found religions)? Sounds like an interesting and thought-out system though! :)
 
That sounds like an SDK change, that buildings can discover technologies (that can found religions)? Sounds like an interesting and thought-out system though! :)
Yes. I'm not a dll modder but I can share the source code with you, if you can make use of it 🙂
 
Yes. I'm not a dll modder but I can share the source code with you, if you can make use of it 🙂
I use the RevolutionDCM SDK, and for some reason, I have never managed to merge all the underlying files into one SDK, so no - but thank you for the offer! :)
 
Ah, thank you, that is exactly what I was trying, I just needed to verify whether canFoundReligion() was indeed the main thing introduced by Limited Religions to do this. Unfortunately, if it indeed is the case, then the below doesn't do anything to hide the buttons - although, if you remove the 'not', all buttons are forever hidden: [...]
Seems pretty clear, then, that canFoundReligion always returns true in your test. Looking at the code, it should return false when all these conditions are true:
Code:
GC.getGameINLINE().isOption(GAMEOPTION_LIMITED_RELIGIONS)
getNumCities() > 1 // Strange requirement, perhaps not the case in your test?
!isRebel()
hasHolyCity() // Seems to check - correctly - whether the player has any holy city
Setting LIMITED_RELIGIONS_EXCEPTIONS to 0 in GlobalDefinesAlt should disable the Cities>1 and !isRebel requirements. (But if the player in your test has more than one city and is no rebel, then I don't see how that XML change could help.)
hasHolyCity also is exposed to Python. Does
if gc.getPlayer(iPlayer).hasHolyCity(): continue
work? (This still misses the game option check.)

Don't know if RevDCM changed anything about GameFont icons. (And I know little about the original system.)
 
In all my tests, I only had one city. Founding a new city indeed prevents me from founding a second religion (but does the AI adhere to this too? Hiding buttons could be a way to prevent players from doing things, but AIs do not click on buttons I guess?):
1667834781483.png

I do not see why there should be an exception for rebels or having only one city, so I disabled it - but then I still can found an infinite amount of religions so long as I only have one city.
Using 'if pPlayer.hasHolyCity(): continue' or 'if gc.getPlayer(iPlayer).hasHolyCity(): continue' generates the below exception, the moment the buttons of a Great Prophet are generated:
1667834341561.png

But I guess the circumstances where someone has only one city and then proceeds to found a dozen religions is virtually non-existent. For the purposes of preventing one AI from hoarding all the religions, this works well enough (especially once I add a Priest specialist to the Monument).

Thank you for your help! I really like how friendly and welcoming this community remains throughout the years. :)

If someone could point me to how to properly add a religion (note on the first screenshot that I have founded Judaism, but that the symbol for Christianity is displayed), that would be much appreciated. :)
 
Using 'if pPlayer.hasHolyCity(): continue' or 'if gc.getPlayer(iPlayer).hasHolyCity(): continue' generates the below exception, the moment the buttons of a Great Prophet are generated: [...]
Oh, they actually named the Python export hasAnyHolyCity. Can't overload those function names, I guess, and hasHolyCity (taking a particular religion as parameter) already existed.
(but does the AI adhere to this too? Hiding buttons could be a way to prevent players from doing things, but AIs do not click on buttons I guess?)
Good point, that seems to be handled by PlatyProphet.py:
Spoiler :
Code:
def doAICheck(self, pUnit, pCity, iPlayer):
	if pUnit.getUnitClassType() != gc.getInfoTypeForString("UNITCLASS_PROPHET"): return
	pPlayer = gc.getPlayer(iPlayer)
	if pPlayer.isHuman(): return
	iChance = 100
	iChance -= pPlayer.countHolyCities() * 20
	iChance = max(iChance, 25)
	if CyGame().getSorenRandNum(100, "Found Religion") < iChance:
		self.SelectReligion(pUnit, pCity, pPlayer)
So, if pPlayer already has a religion, then this function should return (without having selected and founded a religion), just as it returns early when pPlayer is human.
I do not see why there should be an exception for rebels or having only one city, so I disabled it - but then I still can found an infinite amount of religions so long as I only have one city.
Strange; in the code, it looks like LIMITED_RELIGIONS_EXCEPTIONS=0 will remove both exceptions. Oh, well, if the C++ function won't behave, then something along the lines of
CyGame().isOption(GameOptionTypes.GAMEOPTION_LIMITED_RELIGIONS) and gc.getPlayer(iPlayer).hasAnyHolyCity()
should work.
 
Thank you for checking that, about the buttons and the AI's handling of it!
'if pPlayer.hasAnyHolyCity(): continue' does work, by the way! :)
So I am now mindlessly pilfering mods and assets to add religions, will at some point have to sit down to make proper buttons, sounds, and other things that I am missing so far, and will also need to get around to figuring out how the GameFont works eventually. :P
 
So I am now mindlessly pilfering mods and assets to add religions,
Start with Caveman 2 Cosmos than.
That mod has everything. Too much for my taste to play but we'll enough to borrow from :D
 
Doesn't Caveman 2 Cosmos keep all their art files in .fpk files, instead of in folders with filenames and such?
I think they do but .fpk files can be unpacked easily.
 
Back
Top Bottom