Need Modding Help.

Units are a part of a civ, so i think you're currently at the exactly right point ;).
Adding a civ itself will not be less complicated, the essential parts are the same (...so...at the end it doesn't really matter where you begin here. All the directions will hopefully lead to success, but a whole civ is just a bit more than a single unit).
 
Start small and make small changes. Once you learn the subtle capabilities of the XML, you can build a foundation.

For example, change the name of a unit or give it a larger movement score. Then run the game and observe the change, Each line in the XML alters the game in a way. Each time you make a change to a different line, you will be adding to your knowledge of how to make larger changes.

I also learn so much by examining the difference between two units, for example, and copy and paste one set of attributes into another.

Always make a backup of the work you are doing, and start small.
 
I understand...lets finish up making a unit...how do you change the name of a unit and add new promotions?
 
The name is the text in the description tag ;).
For promotions, see the Assets\XML\Units\PromotionInfos.xml.
Copy one whole entry, rename it, get a new button (or use one of the old ones, just don't get confused), and adjust the values.
 
The name is the text in the description tag ;).
For promotions, see the Assets\XML\Units\PromotionInfos.xml.
Copy one whole entry, rename it, get a new button (or use one of the old ones, just don't get confused), and adjust the values.

For changing the name when I loaded up the mod to check it says UNIT_KEY... What can I don to change that:confused:
 
The fast, but cheap way: Don't put "TXT_KEX_etc" into the description tag, directly put the name in there.
The correct, but slower way: Take one of the normal BtS files from the Assets\XML\Text folder, put into your mods XML\Text folder, rename this file, and add an entry similar to the existing ones to the file.
 
I personally take the cheap and dirty way of doing it -- long term problem is if someone wants to translate your mod into another language. Also some entries can get rather large, but its not a huge performance hit.

Example:

PHP:
<UnitInfo>
			<Class>UNITCLASS_ZEBRAKNIGHT</Class>
			<Type>UNIT_ZEBRAKNIGHT</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_MOUNTED</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>Zebra Knight</Description>
			<Civilopedia>Zebra were thought to be untameable.  But the equestrian masters proved them wrong.</Civilopedia>
			<Strategy>An elite horseman on a fierce beast, what a combination.</Strategy>
 
PHP:
<UnitInfo>
			<Class>UNITCLASS_FRENCHKNIGHT</Class>
			<Type>UNIT_FRENCHKNIGHT</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_MOUNTED</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_ATTACK</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>FRENCH KNIGHT</Description>
			<Civilopedia>Backed up by the French army able to perform crusades with excellence.</Civilopedia>
			<Strategy>Spread your faith by performing through war by performing minor crusades.</Strategy>
			<Advisor>ADVISOR_MILITARY</Advisor>
			<bAnimal>0</bAnimal>
			<bFood>0</bFood>
			<bNoBadGoodies>0</bNoBadGoodies>
			<bOnlyDefensive>0</bOnlyDefensive>
			<bNoCapture>0</bNoCapture>
			<bQuickCombat>0</bQuickCombat>
			<bRivalTerritory>0</bRivalTerritory>
			<bMilitaryHappiness>1</bMilitaryHappiness>
			<bMilitarySupport>1</bMilitarySupport>
			<bMilitaryProduction>1</bMilitaryProduction>
			<bPillage>1</bPillage>
			<bSpy>0</bSpy>
			<bSabotage>0</bSabotage>
			<bDestroy>0</bDestroy>
			<bStealPlans>0</bStealPlans>
			<bInvestigate>0</bInvestigate>
			<bCounterSpy>0</bCounterSpy>
			<bFound>0</bFound>
			<bGoldenAge>0</bGoldenAge>
			<bInvisible>0</bInvisible>
			<bFirstStrikeImmune>1</bFirstStrikeImmune>
			<bNoDefensiveBonus>1</bNoDefensiveBonus>
			<bIgnoreBuildingDefense>0</bIgnoreBuildingDefense>
			<bCanMoveImpassable>0</bCanMoveImpassable>
			<bCanMoveAllTerrain>0</bCanMoveAllTerrain>
			<bFlatMovementCost>0</bFlatMovementCost>
			<bIgnoreTerrainCost>0</bIgnoreTerrainCost>
			<bNukeImmune>0</bNukeImmune>
			<bPrereqBonuses>0</bPrereqBonuses>
			<bPrereqReligion>0</bPrereqReligion>
			<bMechanized>0</bMechanized>
			<bSuicide>0</bSuicide>
			<bHiddenNationality>0</bHiddenNationality>
			<bAlwaysHostile>0</bAlwaysHostile>
			<UnitClassUpgrades>
				<UnitClassUpgrade>
					<UnitClassUpgradeType>UNITCLASS_CUIRASSIER</UnitClassUpgradeType>
					<bUnitClassUpgrade>1</bUnitClassUpgrade>
				</UnitClassUpgrade>
			</UnitClassUpgrades>
			<UnitClassTargets/>
			<UnitCombatTargets/>
			<UnitClassDefenders/>
			<UnitCombatDefenders/>
			<FlankingStrikes>
				<FlankingStrike>
					<FlankingStrikeUnitClass>UNITCLASS_CATAPULT</FlankingStrikeUnitClass>
					<iFlankingStrength>100</iFlankingStrength>
				</FlankingStrike>
				<FlankingStrike>
					<FlankingStrikeUnitClass>UNITCLASS_TREBUCHET</FlankingStrikeUnitClass>
					<iFlankingStrength>100</iFlankingStrength>
				</FlankingStrike>
			</FlankingStrikes>
			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_ATTACK</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
				<UnitAI>
					<UnitAIType>UNITAI_PILLAGE</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
			</UnitAIs>
			<NotUnitAIs/>
			<Builds/>
			<ReligionSpreads>
				<ReligionSpread>
					<ReligionType>RELIGION_CHRISTIANITY</ReligionType>
					<iReligionSpread>40</iReligionSpread>
				</ReligionSpread>
			<ReligionSpreads/>
			<CorporationSpreads/>
			<GreatPeoples/>
			<Buildings/>
			<ForceBuildings/>
			<HolyCity>NONE</HolyCity>
			<ReligionType>NONE</ReligionType>
			<StateReligion>NONE</StateReligion>
			<PrereqReligion>NONE</PrereqReligion>
			<PrereqCorporation>NONE</PrereqCorporation>
			<PrereqBuilding>NONE</PrereqBuilding>
			<PrereqTech>TECH_GUILDS</PrereqTech>
			<TechTypes>
				<PrereqTech>TECH_HORSEBACK_RIDING</PrereqTech>
				<PrereqTech>NONE</PrereqTech>
				<PrereqTech>NONE</PrereqTech>
			</TechTypes>
			<BonusType>BONUS_HORSE</BonusType>
			<PrereqBonuses>
				<BonusType>BONUS_IRON</BonusType>
				<BonusType>NONE</BonusType>
				<BonusType>NONE</BonusType>
				<BonusType>NONE</BonusType>
			</PrereqBonuses>
			<ProductionTraits/>
			<Flavors/>
			<iAIWeight>0</iAIWeight>
			<iCost>90</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iAdvancedStartCost>100</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iMoves>2</iMoves>
			<bNoRevealMap>0</bNoRevealMap>
			<iAirRange>0</iAirRange>
			<iAirUnitCap>0</iAirUnitCap>
			<iDropRange>0</iDropRange>
			<iNukeRange>-1</iNukeRange>
			<iWorkRate>0</iWorkRate>
			<iBaseDiscover>0</iBaseDiscover>
			<iDiscoverMultiplier>0</iDiscoverMultiplier>
			<iBaseHurry>0</iBaseHurry>
			<iHurryMultiplier>0</iHurryMultiplier>
			<iBaseTrade>0</iBaseTrade>
			<iTradeMultiplier>0</iTradeMultiplier>
			<iGreatWorkCulture>0</iGreatWorkCulture>
			<iEspionagePoints>0</iEspionagePoints>
			<TerrainImpassables/>
			<FeatureImpassables/>
			<TerrainPassableTechs/>
			<FeaturePassableTechs/>
			<iCombat>10</iCombat>
			<iCombatLimit>100</iCombatLimit>
			<iAirCombat>0</iAirCombat>
			<iAirCombatLimit>0</iAirCombatLimit>
			<iXPValueAttack>4</iXPValueAttack>
			<iXPValueDefense>2</iXPValueDefense>
			<iFirstStrikes>0</iFirstStrikes>
			<iChanceFirstStrikes>0</iChanceFirstStrikes>
			<iInterceptionProbability>0</iInterceptionProbability>
			<iEvasionProbability>0</iEvasionProbability>
			<iWithdrawalProb>0</iWithdrawalProb>
			<iCollateralDamage>0</iCollateralDamage>
			<iCollateralDamageLimit>100</iCollateralDamageLimit>
			<iCollateralDamageMaxUnits>6</iCollateralDamageMaxUnits>
			<iCityAttack>0</iCityAttack>
			<iCityDefense>0</iCityDefense>
			<iAnimalCombat>0</iAnimalCombat>
			<iHillsAttack>0</iHillsAttack>
			<iHillsDefense>0</iHillsDefense>
			<TerrainNatives/>
			<FeatureNatives/>
			<TerrainAttacks/>
			<TerrainDefenses/>
			<FeatureAttacks/>
			<FeatureDefenses/>
			<UnitClassAttackMods/>
			<UnitClassDefenseMods/>
			<UnitCombatMods/>
			<UnitCombatCollateralImmunes/>
			<DomainMods/>
			<BonusProductionModifiers/>
			<iBombRate>0</iBombRate>
			<iBombardRate>0</iBombardRate>
			<SpecialCargo>NONE</SpecialCargo>
			<DomainCargo>NONE</DomainCargo>
			<iCargo>0</iCargo>
			<iConscription>0</iConscription>
			<iCultureGarrison>6</iCultureGarrison>
			<iExtraCost>0</iExtraCost>
			<iAsset>3</iAsset>
			<iPower>10</iPower>
			<UnitMeshGroups>
				<iGroupSize>3</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>3</iMeleeWaveSize>
				<iRangedWaveSize>3</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>3</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_KNIGHT</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<FormationType>FORMATION_TYPE_DEFAULT</FormationType>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<FreePromotions/>
			<LeaderPromotion>NONE</LeaderPromotion>
			<iLeaderExperience>0</iLeaderExperience>
		</UnitInfo>
 
This is all of what I thought I should do...I want to make a this Knight be able to spread Christianity when a city is conquered. Also I would like the Knight (Chevalier) to have to also have to have the technology... Religious Responsibility which allows Knights which I will give each a unique name for the Contries created...
 
I would like to change The French Knight to Chevalier...if someone could post an example on how to do these things that would be appreciated.
 
I would like to change The French Knight to Chevalier...if someone could post an example on how to do these things that would be appreciated.

What do you want to do exactly ? Change the text, the model, the characteristics ?
 
I would like to change The French Knight to Chevalier...if someone could post an example on how to do these things that would be appreciated.

That could be easily done with a unique unit.
 
The religion spread effect can be achieved with a little Python script in the CvEventManager.py file:
PHP:
	onCityAcquired(self, argsList):
		ePreviousOwner, eNewOwner, pCity, bConquest, bTrade = argsList
		pPlayer = gc.getPlayer(eNewOwner)
		eFrance = gc.getInfoTypeForString("CIVILIZATION_FRANCE")
		if bConquest and pPlayer.getCivilizationType() == eFrance:
			pPlot = pCity.plot()
			for pUnit in (pPlot.getUnit(i) for i in pPlot.getNumUnits()):
				eChevalier = gc.getInfoTypeForString("UNIT_CHEVALIER")
				if pUnit.getUnitType() == eChevalier:
					eChristianity = gc.getInfoTypeForString("RELIGION_CHRISTIANITY")
					pCity.setHasReligion(eChristianity, True, True, True)
					break
You could probably just copy-paste this code at the end of the file, but make sure you save it in UTF-8 encoding and not ANSI or something else.

Of course the XML tags (red above) must match exactly. Change them if they don't!
 
Oh, and what about friendly units from other nations or if you move a stack into the city ;)?
Because you can't exactly find out which unit captured a city, you have to catch that before, and that's really ugly. I've done it in one of my modcomps, but with purging non state religions when capturing a city....damn, damn ugly.

All things said above

Then:
Text: Text is nearly done, you just have to put now the right one in ;).
Characteristics: Well...you see everything you need in this entry ;).
Art: The entry ART_DEF_UNIT_KNIGHT links to an entry in XML\Art\ArtDefines_Units.xml, and there you can change the art.
 
Oh, and what about friendly units from other nations or if you move a stack into the city ;)?
No other nation would have the Cavalier unit, right?

However, stack movement might in fact cause Christianity to spread into the conquered city if a Cavalier unit is part of the conquering stack. But is that really bad?
 
No other nation would have the Cavalier unit, right?

However, stack movement might in fact cause Christianity to spread into the conquered city if a Cavalier unit is part of the conquering stack. But is that really bad?

Exactly, only 1 nation would have the Chevalier and I suppose it isnt bad.
 
I've never actually edited unit XML myself, but in theory there are unit classes and unit types. All units types belong to some class.

In this specific case there is a Knight class (and also a Knight type) and the Chevalier is the specific France unit type of the Knight class (used instead of the Knight type). This is what UUs are.

Someone else would be able to give exact instructions, but you should really look into this stuff yourself. Learn how to do this, or someone else will have to make everything for you. And that might not get you anywhere.
 
Back
Top Bottom