Quick Modding Questions Thread

The initialisation is there to ensure that the variables have some valid value, the read() function is called afterwards and sets the variable to the value that was saved.

The & symbol is there for the compiler so it knows to use the memory address of the m_iGold variable to store the value it is reading from the stream. &m_iGold and m_iGold are both referring to the same m_iGold variable. The &m_iGold points to a memory address whereas m_iGold points to the value that is stored at the memory address.
 
You asked for a Wonder to give you a Tech to give you + 1 food on farms. It's easier to grant that with Python than through a Tech that has no tags for farms or even improvements.
I asked for +1 production, which can be found in the improvementinfos thingy.
 
Anybody know a solution to my civicsscreen problem? I can't find anything helpful.
 
Thanks Archid.


What is the difference between getElapsedGameTurns and getGameTurn?

Also what's the difference between Cv files And Cy files?
 
I'm trying to mod the latest version of K-mod to increase the max number of players. I changed MAX_CIV_PLAYERS in CvDefines.h and recompiled but the change does not take effect, it still says MAX_CIV_PLAYERS = 18. I've made a few mods and never had trouble with this before. what else do I need to do?

I'm sure you have checked this but ... have you got /D_USRDLL in the list of compiler flags in your makefile?

this?
Code:
#### CFLAGS ####
GLOBAL_CFLAGS=/GR /Gy /W3 /EHsc /Gd /Gm- /DWIN32 /D_WINDOWS /D_USRDLL /DCVGAMECOREDLL_EXPORTS /Yu"CvGameCoreDLL.h"
Debug_CFLAGS=/MD /Zi /Od /D_DEBUG /DLOG_AI /RTC1 /Fp"$(Debug_PCH)" $(GLOBAL_CFLAGS)
Release_CFLAGS=/MD /O2 /Oy /Oi /Og /G7 /DNDEBUG /DFINAL_RELEASE /Fp"$(Release_PCH)" $(GLOBAL_CFLAGS)
Profile_CFLAGS=/MD /O2 /Oy /Oi /Og /G7 /DNDEBUG /DFP_PROFILE_ENABLE /DUSE_INTERNAL_PROFILER /Fp"$(Profile_PCH)" $(GLOBAL_CFLAGS)

Yep, that's what I was talking about. I would have been surprised if it was the problem, but sometimes its making basic assumptions that trip you up.

When you say:

What is 'it' and where/how did you check it? Was this via a breakpoint at runtime or some other mechanism?

it gave a python exception when loading a map with more than 18 players. then I inserted a python print statement to print gc.getMaxCivTeams() and it printed 18.

still can't figure this out. I can make other DLL changes and they appear in the game but changing MAX_CIV_PLAYERS in CvDefines.cpp does not work. can anyone help?
 
srpt: please upload your CvDefines.h

As far as I know, there are no other places to make the change.
 
Have a look in CvGlobals.cpp at getMaxCivPlayers() to make sure it hasn't been modified by something else:
Code:
int CvGlobals::getMaxCivPlayers() const
{
	return MAX_CIV_PLAYERS;
}
 
srpt: The only thing that I see is that you don't have a "depends" file.

After checking, it seems that K-Mod got rid of it.

Your CvDefines.h seems OK.

Have you build or rebuild your dll? I would do a rebuild (complete).

Otherwise, I don't know.
 
OK, because out of curiosity I compiled a dll based on your files and I could play with 24 teams. No need to post it anymore.

Good that you got it working! :)
 
Cv files are those used by the DLL internally, the Cy files are those used to expose DLL functionality to Python along with the appropriate CyXXXInterface classes

uuuhhh! ok!


Does making changes to files in "...\Beyond the Sword\CvGameCoreDLL\..." have any effect in game? does the game use them? or is the game only using the compiled CvGameCoreDLL.dll inside the assets folder?

and if only the dll in the assets folder is used, then why does the ...\CvGameCoreDLL\... folder exist?
 
No effect at all, the game only reads the dll.

The files are there for our reference, to be able to mod them, isn't it beautiful?! :lol:
 
When you compile the dll you are encoding all of those files into the dll so the game can use it. Just changing the source files doesn't change the game until the new dll is compiled from them and then placed into the assets folder to replace the old one.
 
I want to make little C++ console application for leaderheads which will random generate number between two numbers (example random number between 90 and 200) and write result in one xml file, from iWonderConstructRand to iFavoriteCivicAttitudeChangeLimit for now. Can someone help me about this code about random numbers generate how code will look, i will find something in books and on google. I will make in cmd because i don't know C# yet.
 
The game already has random number generation formulas in it which you might be able to utilize. And if not, C++ libraries also have rand generator functions that can be called. That's what I know. How to do it?... that, I don't have enough experience to tell you man. :\
 
Look i want to make little program, which will help during creating new leader if you are tired to enter numbers for <iWonderConstructRand>, <iBasePeaceWeight>, <iBasePeaceWeight> and etc. Program will random generate numbers and write in some txt or xml file, you will only copy all texts from that file and paste in CIV4LeaderHeadInfos.xml. No more manual number changing and thinking oh what i will give for this leader MaxWarRand 100 or 150 or maybe 200, understand now?
File example (Idea), you will only copy text from this file in your LeaderHeadinfos, name, civilopedia, arts will user change manual:
Code:
		<LeaderHeadInfo>
			<Type>LEADER_NEW</Type>
			<Description>TXT_KEY_LEADER_NEW</Description>
			<Civilopedia>TXT_KEY_LEADER_NEW_PEDIA</Civilopedia>
			<ArtDefineTag>ART_DEF_LEADER_NEW</ArtDefineTag>
			<iWonderConstructRand>10</iWonderConstructRand>
			<iBaseAttitude>-1</iBaseAttitude>
			<iBasePeaceWeight>0</iBasePeaceWeight>
			<iPeaceWeightRand>3</iPeaceWeightRand>
			<iWarmongerRespect>2</iWarmongerRespect>
			<iEspionageWeight>110</iEspionageWeight>
			<iRefuseToTalkWarThreshold>5</iRefuseToTalkWarThreshold>
			<iNoTechTradeThreshold>10</iNoTechTradeThreshold>
			<iTechTradeKnownPercent>40</iTechTradeKnownPercent>
			<iMaxGoldTradePercent>5</iMaxGoldTradePercent>
			<iMaxGoldPerTurnTradePercent>10</iMaxGoldPerTurnTradePercent>
			<iMaxWarRand>100</iMaxWarRand>
			<iMaxWarNearbyPowerRatio>80</iMaxWarNearbyPowerRatio>
			<iMaxWarDistantPowerRatio>50</iMaxWarDistantPowerRatio>
			<iMaxWarMinAdjacentLandPercent>3</iMaxWarMinAdjacentLandPercent>
			<iLimitedWarRand>60</iLimitedWarRand>
			<iLimitedWarPowerRatio>100</iLimitedWarPowerRatio>
			<iDogpileWarRand>20</iDogpileWarRand>
			<iMakePeaceRand>10</iMakePeaceRand>
			<iDeclareWarTradeRand>40</iDeclareWarTradeRand>
			<iDemandRebukedSneakProb>10</iDemandRebukedSneakProb>
			<iDemandRebukedWarProb>0</iDemandRebukedWarProb>
			<iRazeCityProb>0</iRazeCityProb>
			<iBuildUnitProb>25</iBuildUnitProb>
			<iBaseAttackOddsChange>0</iBaseAttackOddsChange>
			<iAttackOddsChangeRand>8</iAttackOddsChangeRand>
			<iWorseRankDifferenceAttitudeChange>-2</iWorseRankDifferenceAttitudeChange>
			<iBetterRankDifferenceAttitudeChange>2</iBetterRankDifferenceAttitudeChange>
			<iCloseBordersAttitudeChange>-2</iCloseBordersAttitudeChange>
			<iLostWarAttitudeChange>-1</iLostWarAttitudeChange>
			<iAtWarAttitudeDivisor>-5</iAtWarAttitudeDivisor>
			<iAtWarAttitudeChangeLimit>5</iAtWarAttitudeChangeLimit>
			<iAtPeaceAttitudeDivisor>60</iAtPeaceAttitudeDivisor>
			<iAtPeaceAttitudeChangeLimit>1</iAtPeaceAttitudeChangeLimit>
			<iSameReligionAttitudeChange>1</iSameReligionAttitudeChange>
			<iSameReligionAttitudeDivisor>10</iSameReligionAttitudeDivisor>
			<iSameReligionAttitudeChangeLimit>3</iSameReligionAttitudeChangeLimit>
			<iDifferentReligionAttitudeChange>0</iDifferentReligionAttitudeChange>
			<iDifferentReligionAttitudeDivisor>-5</iDifferentReligionAttitudeDivisor>
			<iDifferentReligionAttitudeChangeLimit>-1</iDifferentReligionAttitudeChangeLimit>
			<iBonusTradeAttitudeDivisor>50</iBonusTradeAttitudeDivisor>
			<iBonusTradeAttitudeChangeLimit>2</iBonusTradeAttitudeChangeLimit>
			<iOpenBordersAttitudeDivisor>25</iOpenBordersAttitudeDivisor>
			<iOpenBordersAttitudeChangeLimit>2</iOpenBordersAttitudeChangeLimit>
			<iDefensivePactAttitudeDivisor>12</iDefensivePactAttitudeDivisor>
			<iDefensivePactAttitudeChangeLimit>2</iDefensivePactAttitudeChangeLimit>
			<iShareWarAttitudeChange>1</iShareWarAttitudeChange>
			<iShareWarAttitudeDivisor>8</iShareWarAttitudeDivisor>
			<iShareWarAttitudeChangeLimit>6</iShareWarAttitudeChangeLimit>
			<iFavoriteCivicAttitudeChange>1</iFavoriteCivicAttitudeChange>
			<iFavoriteCivicAttitudeDivisor>10</iFavoriteCivicAttitudeDivisor>
			<iFavoriteCivicAttitudeChangeLimit>4</iFavoriteCivicAttitudeChangeLimit>
... and etc ...
 
Back
Top Bottom