Quick Modding Questions Thread

yes this does make sense. I keep this in mind ;)
However does Asset in this still scales up with rest of the stats or only used to differentiate for units of same rank/era?

For example say you have following units with assets:

Spearman (2), Pikeman (2), Rifleman (2), Infantry(2), Tank (3)

vs

Spearman (2), Pikeman (4), Rifleman (6), Infantry(8), Tank (10)

Hm... I am not sure, in my mod i don't touch assets for all BTS default units (ANCIENT-MODERN), only for future eras (for some future nukes, robots and dreads) only for that, and all work good in mod for now.
 
Why AI ignore options in xml "MIN_CITY_RANGE" and "AI_CAN_DISBAND_UNITS"? How to make AI not to delete units completely in SDK?
 
AI_CAN_DISBAND_UNITS appears to be about captured units (Workers) only. Looks like you'll need to change the DLL. Disbanding happens in CvPlayerAI.cpp, function AI_disbandUnit, which is called by AI_doMilitary. I think the AI indeed disbands units too swiftly. You could look at the K-Mod code for more considerate disbanding. If you want to turn it off entirely, I guess just return 'false' from AI_disbandUnit. A restriction like "disband at most x units per turn" is also easy to implement.

thanks guys!
So it is still a mystery what Asset exactly does?
I've searched the code base for calls to CvUnitInfo::getAssetValue. Each CvPlayer keeps track of its total assets. The per-unit value is used exclusively in CvUnit::isBetterDefenderThan. I think the game prefers to select low-asset (i.e. expendable) units as defenders when a stack is attacked. I don't see asset values factoring into decisions on city production.
The AI uses the total assets in order to decide when to ask the human player for a handout. Buildings and technologies also have asset values that add into CvPlayer::m_iAssets.
I guess that's not immediately helpful for coming up with asset values for new units. As you've probably noticed, the original values range from 1 (e.g. Archer) to 6 (Modern Armor), except for ICBM (10).
 
Why AI ignore options in xml "MIN_CITY_RANGE"?

As far as I know, AI does not ignore MIN_CITY_RANGE. Except that it doesn't work on different land masses. For example, that rule does not work between a continent and an island.
 
AI_CAN_DISBAND_UNITS appears to be about captured units (Workers) only. Looks like you'll need to change the DLL. Disbanding happens in CvPlayerAI.cpp, function AI_disbandUnit, which is called by AI_doMilitary. I think the AI indeed disbands units too swiftly. You could look at the K-Mod code for more considerate disbanding. If you want to turn it off entirely, I guess just return 'false' from AI_disbandUnit. A restriction like "disband at most x units per turn" is also easy to implement.

Thanks! It works!
 
How to make a civilization declare war, choosing a certain period of time (for example , from 3000 BC to 2000 BC ) ?
Code:
	def onBeginGameTurn(self, argsList):
		iGameTurn = argsList[0]
		self.parent.onBeginGameTurn(self, argsList)
		fc.checkTurn(iGameTurn)
		for iPlayer in range(gc.getMAX_PLAYERS()):
			pPlayer = gc.getPlayer(iPlayer)
			iTeam = pPlayer.getTeam()
			if (iGameTurn == 1):
				if iTeam == 0:
					if gc.getTeam(1).isHasMet(iTeam):
						gc.getTeam(1).declareWar(iTeam, false, WarPlanTypes.WARPLAN_TOTAL)
 
Is there a way to modify the pangaea map script to reduce the amount of ocean it generates?

I basically want it to simulate a 'random' USA like continent, currnetly it wastes huge amounts of map space on making ocean, which I don't use in game.

In mostly map script you have:
Code:
[B]from CvMapGeneratorUtil import TerrainGenerator[/B]

I am not sure, but you must make your own TerrainGenerator, for example (LibSpitTerrainGenerator) and edit there, but i am not sure.

i am somewhere experimenting with sea (your problem) but i can't found that, if i found i will send to you, but not on Pangaea map script.

I am make two planets in one map with my TerrainGenerator

NtnGmcE.jpg
 
I think the ocean is 'controlled' in the parts before the terrain generator.

import CvMapGeneratorUtil
from CvMapGeneratorUtil import MultilayeredFractal
from CvMapGeneratorUtil import HintedWorld

You can't decrease the amount of ocean (I think maps start out as just ocean) so you actually increase the amount of land you want.
What I haven't figured out is where you do that within those files, or whether you do it in the pangea file.

Continued Here
 
Leaders which change each other during time and controlles the same civilization.
Check out AIAutoPlay as that has an option to change the leaderhead of a civ via a Python dialog, so you could just extract that piece of code.

There is no way of doing it in "one or two files" as far as I know; AIAutoPlay uses dll changes to manage things such as changing the traits to suit the new leader, etc.
 
Check out AIAutoPlay as that has an option to change the leaderhead of a civ via a Python dialog, so you could just extract that piece of code.

There is no way of doing it in "one or two files" as far as I know; AIAutoPlay uses dll changes to manage things such as changing the traits to suit the new leader, etc.

No, I want to do this on python and leaders should replace each other on certain turn.
 
You use PrivateMaps instead and change the ini file of your mod:
Code:
; Allow public maps to be used with this mod
AllowPublicMaps = 0
 
Back
Top Bottom