Quick Modding Questions Thread

Hi guys, inside the SDK:

Does anyone know where the scoring is calculated (as in, the dynamic score in-game, as opposed to the final score at the victory screen)? In particular, how is the scoring for the wonders calculated?

I tried changing the code in CvGameCoreUtils.cpp

Spoiler :

int getWonderScore(BuildingClassTypes eWonderClass)
{
if (isLimitedWonderClass(eWonderClass))
{
return 1;
//return 5;
}
else
{
return 0;
}
}


But that does not appear to have changed anything (and yes, everything was re-compiled etc).
 
Anyone know how to make the ai more likely to defy apostolic palace/UN votes rather just voting no. A strong AI in my game has just been forced into peace 4 times when they could've easily defied and kept conquering!
 
In a screen's handleInput() function, is there a way to detect whether a modifier key (Ctrl, Alt, Shift) is pressed at the time of a mouse click?
 
There are codes in WB which do that

Hmm. That seems to allow overriding of left-click input for the entire screen, I'm hoping to override left-click input for just a few widgets in the CvMainInterface.py. I can make a new widget no problem, but I can't detect modifier keys for it. Any other methods?
 
There is a shiftkey() check, but if you want specific keys, check leader pedia
 
Is there somewhere where I can change the colour of the city growth indicator on the main screen? By that I mean the coloured circle/star that contains the size of the city to the left of the name that is green for growth, grey for stagnant and red for starvation. I would like to have it change to a blue if the city is avoiding growth.

I have looked in CvMainInterface.py and CvGameInterface.cpp but can't see anything obvious in there, but that doesn't mean much given my lack of experience with the UI; I usually just hack UI code someone else has written :)
 
Found the solution to my issue in the SDK.

PHP:
void CvCity::getCityBillboardSizeIconColors(NiColorA& kDotColor, NiColorA& kTextColor) const
{
	NiColorA kPlayerColor = GC.getColorInfo((ColorTypes) GC.getPlayerColorInfo(GET_PLAYER(getOwnerINLINE()).getPlayerColor()).getColorTypePrimary()).getColor();
	NiColorA kAutoHold(0.73f,0.73f,1,1);
	NiColorA kGrowing(0.73f,1,0.73f,1);
	NiColorA kShrinking(1,0.73f,0.73f,1);
	NiColorA kStagnant(0.83f,0.83f,0.83f,1);
	NiColorA kUnknown(.5f,.5f,.5f,1);
	NiColorA kWhite(1,1,1,1);
	NiColorA kBlack(0,0,0,1);

	if ((getTeam() == GC.getGameINLINE().getActiveTeam()))
	{
		if (isAutoAvoidGrowth())
		{
			kDotColor = kAutoHold;
			kTextColor = kBlack;
		}
		else if (foodDifference() < 0)
		{
			...

Added a new colour and tied it to my function to determine if the city should avoid growth.
 
There is a shiftkey() check, but if you want specific keys, check leader pedia

I'm very confused. This is the code I'm testing in CyMainInterface.py:


Code:
	def handleInput (self, inputClass):
		'Handles input for this screen'

		if CyInterface().shiftKey():
			CyInterface().addImmediateMessage("Experiment 1 successful!", "")

		if inputClass.isShiftKeyDown():
			CyInterface().addImmediateMessage("Experiment 2 successful!", "")

		if inputClass.getData() == int(InputTypes.KB_LSHIFT):
			CyInterface().addImmediateMessage("Experiment 3 successful!", "")

Experiment 1 works as expected, message appears whenever I click on a UI widget. I'd settle for this, except I also need to detect Ctrl clicks.

Experiment 2 works on a few widgets, but not on most. It doesn't work on the building options in the city screen (which is where I want it to work), but it does work when clicking on items in the production queue. Same thing with isAltKeyDown() and isCtrlKeyDown(). What could be causing this?

Experiment 3 (borrowed from leader pedia) doesn't work at all.
 
One quick question, in GlobalDefines.xml:
Code:
	<Define>
		<DefineName>MAX_TRADE_ROUTES</DefineName>
		<iDefineIntVal>8</iDefineIntVal>
	</Define>

This mean that i can have trading with max 8 civilizations and i can have max 4 trade routes per city or i have max 8 trade routes per city and can trade with unlimited civilizations ?
What this define, max 8 trade routes per city or what ?
 
One quick question, in GlobalDefines.xml:
Code:
	<Define>
		<DefineName>MAX_TRADE_ROUTES</DefineName>
		<iDefineIntVal>8</iDefineIntVal>
	</Define>

This mean that i can have trading with max 8 civilizations and i can have max 4 trade routes per city or i have max 8 trade routes per city and can trade with unlimited civilizations ?
What this define, max 8 trade routes per city or what ?

8 maximum trade routes per city. You may only have a maximum of 1 trade route to a foreign city anywhere in your empire, however (i.e. if London has a trade route with Paris, Nottingham and York must find another foreign city to trade with, if any).
 
I'm very confused. This is the code I'm testing in CyMainInterface.py:


Code:
	def handleInput (self, inputClass):
		'Handles input for this screen'

		if CyInterface().shiftKey():
			CyInterface().addImmediateMessage("Experiment 1 successful!", "")

		if inputClass.isShiftKeyDown():
			CyInterface().addImmediateMessage("Experiment 2 successful!", "")

		if inputClass.getData() == int(InputTypes.KB_LSHIFT):
			CyInterface().addImmediateMessage("Experiment 3 successful!", "")

Experiment 1 works as expected, message appears whenever I click on a UI widget. I'd settle for this, except I also need to detect Ctrl clicks.

Experiment 2 works on a few widgets, but not on most. It doesn't work on the building options in the city screen (which is where I want it to work), but it does work when clicking on items in the production queue. Same thing with isAltKeyDown() and isCtrlKeyDown(). What could be causing this?

Experiment 3 (borrowed from leader pedia) doesn't work at all.

Didn't bother to test much, all 3 work in Religion Screen.
Without additional codes, all 3 will display messages when the shift key is pressed even if you don't click on anything.
In fact, 1 and 3 will trigger twice.
 
Didn't bother to test much, all 3 work in Religion Screen.
Without additional codes, all 3 will display messages when the shift key is pressed even if you don't click on anything.
In fact, 1 and 3 will trigger twice.

But not on the Main Interface. 2 is occasional, 3 never works. Any idea why they would behave differently there, compared to other screens?
 
Okay. Now I ended up using Blizzard file parts from AoI original bts mod. I would like to create a new feature for Snow and Ocean tiles, storm, which would damage units and make moving slower. However, now I have hit a wall.
The feature shows up in civilopedia, but as I try to start a game, the program crashes. If someone might read through my code, and tell where I got it wrong:

Spoiler :
<FeatureInfo>
<Type>FEATURE_STORM</Type>
<Description>Storm</Description>
<Civilopedia>Storm</Civilopedia>
<ArtDefineTag>ART_DEF_FEATURE_STORM</ArtDefineTag>
<YieldChanges/>
<RiverYieldChange/>
<HillsYieldChange/>
<iMovement>2</iMovement>
<iSeeThrough>0</iSeeThrough>
<iHealthPercent>0</iHealthPercent>
<iDefense>0</iDefense>
<iAppearance>1000</iAppearance>
<iDisappearance>1000</iDisappearance>
<iGrowth>1000</iGrowth>
<iTurnDamage>5</iTurnDamage>
<iWarmingDefense>0</iWarmingDefense>
<bNoCoast>0</bNoCoast>
<bNoRiver>0</bNoRiver>
<bNoAdjacent>0</bNoAdjacent>
<bRequiresFlatlands>0</bRequiresFlatlands>
<bRequiresRiver>0</bRequiresRiver>
<bAddsFreshWater>0</bAddsFreshWater>
<bImpassable>0</bImpassable>
<bNoCity>0</bNoCity>
<bNoImprovement>0</bNoImprovement>
<bVisibleAlways>0</bVisibleAlways>
<bNukeImmune>0</bNukeImmune>
<OnUnitChangeTo/>
<TerrainBooleans>
<TerrainBoolean>
<TerrainType>TERRAIN_OCEAN</TerrainType>
<bTerrain>1</bTerrain>
</TerrainBoolean>
</TerrainBooleans>
<FootstepSounds>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_HUMAN</FootstepAudioType>
<FootstepAudioScript>AS3D_UN_FOOT_UNIT_SNOW</FootstepAudioScript>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_HUMAN_LOW</FootstepAudioType>
<FootstepAudioScript>AS3D_UN_FOOT_UNIT_LOW_SNOW</FootstepAudioScript>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_ANIMAL</FootstepAudioType>
<FootstepAudioScript>AS3D_UN_ANIMAL_FOOT_LARGE_SNOW</FootstepAudioScript>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_ANIMAL_LOW</FootstepAudioType>
<FootstepAudioScript>AS3D_UN_ANIMAL_FOOT_LARGE_LOW_SNOW</FootstepAudioScript>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>FOOTSTEP_AUDIO_HORSE</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_WHEELS</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_WHEELS</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_WHEELS_2</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_WHEELS_2</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_TANK</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_TANK</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_MOD_ARMOUR</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_MOD_ARMOUR</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_ARTILLERY</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_ARTILLERY</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>LOOPSTEP_WHEELS_3</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
<FootstepSound>
<FootstepAudioType>ENDSTEP_WHEELS_3</FootstepAudioType>
<FootstepAudioScript/>
</FootstepSound>
</FootstepSounds>
<EffectType>NONE</EffectType>
<iEffectProbability>0</iEffectProbability>
<iAdvancedStartRemoveCost>0</iAdvancedStartRemoveCost>
</FeatureInfo>

and in art xml
Spoiler :

<FeatureArtInfo>
<Type>ART_DEF_FEATURE_STORM</Type>
<bAnimated>0</bAnimated>
<bRiverArt>0</bRiverArt>
<TileArtType>TILE_ART_TYPE_NONE</TileArtType>
<LightType>LIGHT_TYPE_SUN</LightType>
<fScale>0.4</fScale>
<fInterfaceScale>0.2</fInterfaceScale>
<Button>,Art/Interface/Buttons/TerrainFeatures/Blizzard.dds</Button>
<FeatureVariety>
<FeatureArtPieces>
<FeatureArtPiece>
<ModelFile>Art/Terrain/Features/blizzard/storm.dds</ModelFile>
<Connections></Connections>
</FeatureArtPiece>
</FeatureArtPieces>
<FeatureDummyNodes/>
<bGenerateRotations>0</bGenerateRotations>
<VarietyButton>Art/Interface/Buttons/TerrainFeatures/rain.dds</VarietyButton>
</FeatureVariety>
</FeatureArtInfo>

What went wrong? Should I just try to make an Improvement like in Age of Ice?
 
iirc the problem is that features affect the graphics in the plot and surrounding plots. This means that their graphics is different somehow to improvement graphics. Which only affect the plot. You can't uses a graphic designed as a feature as an improvement or vice versa because of this.
 
and in art xml
Spoiler :

<FeatureArtInfo>
<Type>ART_DEF_FEATURE_STORM</Type>
<bAnimated>0</bAnimated>
<bRiverArt>0</bRiverArt>
<TileArtType>TILE_ART_TYPE_NONE</TileArtType>
<LightType>LIGHT_TYPE_SUN</LightType>
<fScale>0.4</fScale>
<fInterfaceScale>0.2</fInterfaceScale>
<Button>,Art/Interface/Buttons/TerrainFeatures/Blizzard.dds</Button>
<FeatureVariety>
<FeatureArtPieces>
<FeatureArtPiece>
<ModelFile>Art/Terrain/Features/blizzard/storm.dds</ModelFile>
<Connections></Connections>
</FeatureArtPiece>
</FeatureArtPieces>
<FeatureDummyNodes/>
<bGenerateRotations>0</bGenerateRotations>
<VarietyButton>Art/Interface/Buttons/TerrainFeatures/rain.dds</VarietyButton>
</FeatureVariety>
</FeatureArtInfo>

What went wrong? Should I just try to make an Improvement like in Age of Ice?

Like I said, remove the ',' marked in red
 
Thanks for your advice both of you. The "," indeed seemed to crash the game originally. However, after correcting that, the game still crashes further in the loading screen. Dancing Hoskuld might be right in that one can't use improvement as a feature, in which case I either have to find a custom made feature resembling storm or scrap the idea.

PS. I originally misunderstood which "," you were talking about. I did not ignore the advice.
 
Top Bottom