Modmodding Q&A Thread

Nothing, a respawn before the proper spawn is impossible.
 
Not sure what you're asking. If you mean releasing civilizations, they are tied to exactly the same conditions as respawns.
 
I'm trying to add the Mercenaries Civic to the Prereq section of the Mercenary Promotion Civilopedia page.
Code:
eMercenaries = gc.getPromotionInfo(self.iPromotion).[B]getExtraUpkeep()[/B]
if (eMercenaries == self.iPromotion):
		screen.attachImageButton(panelName, "", gc.getCivicInfo(con.iCivicMercenaries).getButton(), GenericButtonSizes.BUTTON_SIZE_CUSTOM, WidgetTypes.WIDGET_PEDIA_JUMP_TO_CIVIC, con.iCivicMercenaries, 1, False)
I"m trying to access the mercenary promotion with the extra upkeep tag, but the game doesn't recognize getExtraUpkeep(). What is the getX the game uses to access the Extra Upkeep tag? The No Promoting Tag would work as well.
 
Sorry, I didn't expose these access methods to Python, so you cannot access them there.

What you're doing wouldn't work anyway, since you are getting the extra upkeep value you'd have to check if it's greater than zero. But an alternate solution is to simply check:
Code:
if self.iPromotion == gc.getInfoTypeForString("PROMOTION_MERCENARY"):

gc.getInfoTypeForString() works for any XML tag and is the preferred solution in situations like this, as long as the code isn't performance-critical.
 
Sorry, I didn't expose these access methods to Python, so you cannot access them there.

What you're doing wouldn't work anyway, since you are getting the extra upkeep value you'd have to check if it's greater than zero. But an alternate solution is to simply check:
Code:
if self.iPromotion == gc.getInfoTypeForString("PROMOTION_MERCENARY"):

gc.getInfoTypeForString() works for any XML tag and is the preferred solution in situations like this, as long as the code isn't performance-critical.

Thanks, I didn't think you could access XML tags (I thought that was what constants was for).
 
The reason why constants are used is that the info type for string method is rather slow because it relies on string parsing, so it's more efficient (and faster to type) to use constants. But they're usually not worth defining for one-off checks like this one.
 
Code:
                        if (iCiv == iAmerica):
                                for x in range(con.iDemocracy+1):
                                                teamAmerica.setHasTech(x, True, iCiv, False, False)
                                for x in range(con.iFishing, con.iChemistry+1):
                                                teamAmerica.setHasTech(x, True, iCiv, False, False)
                                for x in range(con.iHunting, con.iRifling+1):
                                                teamAmerica.setHasTech(x, True, iCiv, False, False)
                                teamAmerica.setHasTech(con.iSteamPower, True, iCiv, False, False)
				teamAmerica.setHasTech(con.iScientificMethod, True, iCiv, False, False)
what does "x in range(con.iHunting, con.iRifling+1) mean?
 
To answer your specific question, it means every tech in the tech list in consts.py from Hunting up to and including Rifling. (Ergo, all red colored techs)

So, these code assigns all colored techs to America.

Code:
iNumTechs = 93
([COLOR="Blue"]iMysticism, iMeditation, iPolytheism, iPriesthood, iMonotheism, iMonarchy, iLiterature, iCodeOfLaws, iDrama, iFeudalism,
iTheology, iMusic, iCivilService, iGuilds, iDivineRight, iPatronage, iNationalism, iMilitaryTradition, iConstitution, iLiberalism,
iDemocracy[/COLOR], iCorporation, iFascism, iCommunism, iMassMedia, iEcology, [COLOR="blue"]iFishing, iTheWheel, iAgriculture, iPottery,
iAesthetics, iSailing, iWriting, iMathematics, iAlphabet, iCalendar, iCurrency, iPhilosophy, iPaper, iBanking, 
iEducation, iPrintingPress, iEconomics, iAstronomy, iChemistry, iScientificMethod[/COLOR], iPhysics, iBiology, iMedicine, iElectricity,
iCombustion, iFission, iFlight, iAdvancedFlight, iPlastics, iComposites, iStealth, iGenetics, iFiberOptics, iFusion,
[COLOR="Red"]iHunting, iMining, iArchery, iMasonry, iAnimalHusbandry, iBronzeWorking, iHorsebackRiding, iIronWorking, iMetalCasting, iCompass, 
iConstruction, iMachinery, iEngineering, iOptics, iGunpowder, iReplaceableParts, iMilitaryScience, iRifling[/COLOR], [COLOR="blue"]iSteamPower[/COLOR], iSteel, 
iAssemblyLine, iRailroad, iArtillery, iIndustrialism, iRadio, iRefrigeration, iSuperconfuctors, iComputers, iLaser, iRocketry, 
iSatellites, iRobotics, iFutureTech) = range(iNumTechs)
 
More generally, range(x, y) produces a list [x, x+1, x+2, ..., y-1].
 
Leoreth, I was attempting to do something very simple, to change Japan's tech costs, building costs, unit costs and such in DOC. I even found the appropriate values to change in CvRhyes.cpp. I attempted to learn to compile DLL and even installed visual studio express 2013, microsoft sdk and c++ toolkit 2003 amongst other stuff, but I failed miserably. All I managed to do was modify Japan's modifier values in CvRhyes.cpp, but aparently that is useless unless I recompile the DLL. Is there a simple way to change a civ's modifiers painlessly, without touching the DLL, or simply editing a couple files with a text editor?

Please help, I need to know the easiest way to acomplish this:confused:

Thanks in advance
 
No, editing the values in CvRhyes.cpp and recompiling the DLL is the only way to do it.

There are a number of tutorials on compiling the DLL, if one didn't work I suggest you try another.
 
Thanks, I was finally able to recompile the DLL with my modified values, ASAFs guide did the trick quite nicely. Even though I use windows 8 and had previously downloaded the newest software, I was only able to do it using the software recommended in the guide.

I have another question though. I gave Japan better unit, tech, building and other modifiers in CvRhyes.cpp, and with the new recompiled DLL I started to play as them in the 1700 AD scenario. At the beginning of the game I saw (and greatly benifited from) the lower building and tech costs, however as soon as I reached the industrial era, the buildings costs changed back to what they used to be in the old DLL. Is there a function that causes building costs to increase for all civs in the industrial era? Or is there something else I have to change besides CvRhyes.cpp to make my changed modifiers more permanent?
 
Are you sure building costs didn't just increase with entering the Industrial era? How do you know it reverted to the old modifier?
 
Just went back and tested it, it doesn't seem to be turn-specific as the costs inmediately go up when I give myself steel via WB. The building costs values went back to their original values before I modified the dll (barracks was 150 hammers originally in marathon for example). The unit costs also increased. However, this was not the case with the beaker costs of researching technology, it kept the modified cost. I also used alt+z to check if entering the industrial era affected civs other than Japan, (i.e. switched to Incas who were still in the renaisance, gave myself steel via WB) and concluded that this increase is not universal as entering the industrial era did not affect inca or moors.

This is indeed puzzling.
 
I might not have been clear, building costs are modified when you enter the Industrial era in general. Are you sure the civ modifier reverted and it isn't just the cumulative effect of the modified era costs?
 
I am not sure if it reverts or not, its probably just the increased era cost. The thing is, I didn't know that entering the industrial era increased building costs. Where is this coded? I've tried to see if entering the industrial era affects the building costs of other civs, for example just now I started a 1700 AD scenario game as China, the cost of a bank is 720 hammers on marathon, then I gave myself steel via WB and the cost has not changed, it is still 720. I also tried the same with Sweden and Spain and their costs do not increase either. Does this only affect certain civs and/or happens when you reach the era past a certain date? In the case of Japan I started a 1700 AD game and teched steel via WB and the building costs inmediately went up.

UPDATE: Aparently the modifiers ARE reverting, I replaced CvRhyes.cpp and the dll with the original ones, and this phenomenom no longer occurs in Japan's case. In that case there might be something else for me to change for the reversal not to happen.
 
Back
Top Bottom