Need Modding Help.

You don't "open" Python modules, because that means executing the code. Instead you "edit" them. (Alternatively you chose "open with" and select a text editor.)
Spoiler :
Right click on the file instead of double-clicking.
 
I can't answer for the inner workings of your operating system, but try opening the .py file from within a text editor. (Menu: File/Open.) That surely wouldn't run the module.
 
But how do you make the Chevalier a unique unit?

In the following code sections the '...' indicate only that the code between the above and following line are not important for this discussion. I also assume that you have already created an unit that I have chosen to call UNIT_CHEVALIER that represents your unique unit.

Make sure that your Chevalier (named in this example, UNIT_CHEVALIER) is of the same class (in this example, UNITCLASS_HORSEMAN) as another unit in your CIV4UnitInfos.xml file :

Code:
<UnitInfos>
    <UnitInfo>
        <Class>[COLOR="Red"]UNITCLASS_HORSEMAN[/COLOR]</Class>
        <Type>UNIT_CHEVALIER</Type>
        ...
    </UnitInfo>
    ...
</UnitInfos>

Make sure that in the CIV4UnitClassInfos.xml file the default unit for UNITCLASS_HORSEMAN is NOT UNIT_CHEVALIER or it will not work:

Code:
<UnitClassInfo>
    <Type>UNITCLASS_HORSEMAN</Type>
    ...
    <DefaultUnit>UNIT_HORSEMAN</DefaultUnit>
</UnitClassInfo>

Now you need to tell the game that your UNIT_CHEVALIER is linked only to France. To do that you need to edit the CIV4CivilizationInfos.xml file and add your new unit to the ''CivilizationInfo'' tags for France :

Code:
<CivilizationInfo>
   <Type>CIVILIZATION_FRANCE</Type>
    ...
   <Units>
     <Unit>
        <UnitClassType>UNITCLASS_HORSEMAN</UnitClassType>
        <UnitType>UNIT_CHEVALIER</UnitType>
     </Unit>
   </Units>
   ...
</CivilizationInfo>

Save your files and that should do it.
 
Ok, I didn't consider the fact that there could be more than one French player at the same time. So I added yet another check:
PHP:
	onCityAcquired(self, argsList):
		ePreviousOwner, eNewOwner, pCity, bConquest, bTrade = argsList
		pPlayer = gc.getPlayer(eNewOwner)
		eFrance = gc.getInfoTypeForString("CIVILIZATION_FRANCE")
		eChristianity = gc.getInfoTypeForString("RELIGION_CHRISTIANITY")
		if bConquest and pPlayer.getCivilizationType() == eFrance and not pCity.isHasReligion(eChristianity):
			pPlot = pCity.plot()
			for pUnit in (pPlot.getUnit(i) for i in pPlot.getNumUnits()):
				if pUnit.getOwner() == eNewOwner:
					eChevalier = gc.getInfoTypeForString("UNIT_CHEVALIER")
					if pUnit.getUnitType() == eChevalier:
						pCity.setHasReligion(eChristianity, True, True, True)
						break
edit: Also, I added a check that disables the script if Christianity is already present in the city.
 
Ok, so I can not get my Chevalier to be a unique unit to france or my new civilization for that matter and I have not tried the spread of christianity yet because I want to make it a unique unit to france and I think you need it to be anyway so...but I will post my chevalier and civilization stuff and please tell me if there is anything wrong with it...
PHP:
<UnitInfo>
			<Class>UNITCLASS_KNIGHT</Class>
			<Type>UNIT_FRENCH_CHEVALIER</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>Chevalier</Description>
			<Civilopedia>TXT_KEY_UNIT_KNIGHT_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_UNIT_KNIGHT_STRATEGY</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/>
			<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>PRIESTHOOD</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>12</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>1</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>11</iPower>
			<UnitMeshGroups>
				<iGroupSize>5</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>
and my civilization is...
PHP:
	<City>TXT_KEY_CITY_NAME_BOURGES</City>
				<City>TXT_KEY_CITY_NAME_CALAIS</City>
			</Cities>
			<Buildings>
				<Building>
					<BuildingClassType>BUILDINGCLASS_OBSERVATORY</BuildingClassType>
					<BuildingType>BUILDING_FRENCH_SALON</BuildingType>
				</Building>
			</Buildings>
			<Units>
				<Unit>
					<UnitClassType>UNITCLASS_MUSKETMAN</UnitClassType>
					<UnitType>UNIT_FRENCH_MUSKETEER</UnitType>
				</Unit>
				<Unit>
					<UnitClassType>UNITCLASS_KNIGHT</UnitClassType>
					<UnitType>UNIT_FRENCH_CHEVALIER</UnitType>
				</Unit>[/COLOR]
			</Units>
			<FreeUnitClasses>
				<FreeUnitClass>
 
But how do you make the Chevalier a unique unit?

To make a unique unit, you need to add the unit to CIV4CivilizationInfos.xml

Look into this xml to see how it is done, but it is fairly easy.

such as for Japan:

PHP:
			<Units>
				<Unit>
					<UnitClassType>UNITCLASS_MACEMAN</UnitClassType>
					<UnitType>UNIT_JAPAN_SAMURAI</UnitType>
				</Unit>
				<Unit>
					<UnitClassType>UNITCLASS_FIGHTER</UnitClassType>
					<UnitType>UNIT_ZERO</UnitType>
				</Unit>
				<Unit>
					<UnitClassType>UNITCLASS_DESTROYER</UnitClassType>
					<UnitType>UNIT_TAKAO</UnitType>
				</Unit>
			</Units>
 
My bad... ok not everyone can build this unit only the french can but in the civilopedia it does not say it is a unique unit...and when I conquer a city it still not converting the city to christianity...
 
The Python script wont work unless all the associated XML tags match exactly, such as UNIT_FRENCH_CHEVALIER. For obvious reasons.
 
My bad... ok not everyone can build this unit only the french can but in the civilopedia it does not say it is a unique unit

hhmm...does it not say that for
- the unit itself
- in the civ entry
- for the standard unit, where ther replacements are listed
?
 
In the civilopedia, it's more than once mentioned that an unit is an UU.
When you look at the civilization in the civilopedia, it should be mentioned there as UU.
When you look at the unit itself it should be mentioned as UU.
When you look at the default knight it should there be mentioned that there's an UU for France.
Did you take a look at these? The unit is really not mentioned as UU?
 
Wait, I would like to ask about how to make a flag (a little off topic but in the mean time while I figure out how to do other things... I have downloaded a few programs( GIMP 2 and DXTBmp) and though gimp seemed useful I think I need a gimp dds plugin but I do not know where to find it or how to apply it. HELP WOULD BE APPRECIATED.
 
There's a tutorial with GIMP by cool3a2 here, and i have a tutorial with DXTBmp which also covers flags here.

cools tutorial also covers the needed XML.

Yes, his(or her) tutorial is very good except when I click on the link for the dds plugin I get this...well I think its best that you try the link yourself and see what I mean...http://nifelheim.dyndns.org/~cocidius/dds/... so I cannot progress with that but, I will try his(or her)DXTBmp tutorial and see if will do.
 
Back
Top Bottom