GUIDE: Adding new units

alright thanks man:) i'll see what i can do! and about the flavors.... i was thinking how like different races have some slighty different artwork for some units. like the warriors and knights and such. i got a unit that has that several versions for races...how would i install them?
and also how do i make a special unit? because i had alot of trouble putting a new fighter and had to give up and make it a bomber instead....
 
hmm sorry i guess that was a bad question ha. Well i want to change the game a little bit. I want paratroopers to be dropped out of my transport plane I added in, instead of them just deploying straight from a city. Is this possible? How would i go about doing it?
And also, about the special units, i'm talking about like how only fighters can enter a carrier. And how you can only build three missionaries and ect. how do i add that to a unit?
and is it possible for a unit to see multiple invisible classes? and specific units?
sorry if im asking you a ton of questions .....:sad:
 
hmm sorry i guess that was a bad question ha. Well i want to change the game a little bit. I want paratroopers to be dropped out of my transport plane I added in, instead of them just deploying straight from a city. Is this possible? How would i go about doing it?

That's only possible with bigger programming efforts :(.

And also, about the special units, i'm talking about like how only fighters can enter a carrier.

Then i don't know where the problem could be.
Should your new fighters be able to be mixed with normal fighters on a carrier? Then just making your new fighters SPECIALUNIT_FIGHTER should be enough.

And how you can only build three missionaries and ect. how do i add that to a unit?

You can set national/team/world limits for units in the UnitClassInfos.xml, just take a look ;).

and is it possible for a unit to see multiple invisible classes?

In the field for the invisibility, you should be able to add more than one class, just separated by commas.

and specific units?

hhmm...only, if that unit has it's own invisiblity class (which are set in BasicInfos\InvisibleInfos.xml)

sorry if im asking you a ton of questions .....:sad:

No problem ;). There's no problem in asking, it's better than trying and not finding a solution (as long as you try it after you've asked).
 
ha okay i'll put that one off until i understand more of this stuff. And thanks for all your help :) i got figured out the invisibility problems and national unit etc. But now back to the buttons.... where is macherik's thread? i can't find it but i've gotten the tool and stuff.... And so alot of my units have unique skins for different countries. How do i install them? And i have another unit that has different skins for different races...how would i install that too?
.....thanks for all your help:)
 
I don't think that i meant something specific with "Mechaeriks thread", there was at this time probably something similar going on, so there's nothing which could be helpful.
But did you just try, what has been said (i know it's not much)? It's really not that difficult ;).

About the skins: In the civilizations folder is an UnitArtStyle.xml.
In this XML you reference, which ArtDefine_Units entry should be loaded for a unit instead of the normal one. So you mention there, that for ARTSTYLE_ASIAN for the UNIT_KNIGHT the ARTDEFINES_KNIGHT_ASIAN (or whatever) should be loaded.
Attention: That sure means, that you have to put a lot more entries into ArtDefines_Units.xml, and that you have to be careful with the spelling, because the UnitArtStyle.xml does not get checked upon loading, so if there's something wrong, then you'll only notice it when your game crashes.
 
hey thanks! i got the differnts skins down :) and i also added in my first building! I think i'm starting to get xml editing. k, so my mod i'm making is a modern world mod and i'm adding in a terrorist, and i want them to act similar to barbarians but appear in the modern times and appear in peoples country boundaries too....i know this isn't a unit question but you've been a ton of help for me :) is this possible and do you think you could clue me in on how to accomplish this?
 
hey thanks! i got the differnts skins down :) and i also added in my first building! I think i'm starting to get xml editing.

Congrats :).
Now you're done with the hardest part.
Most of the basic stuff in Civ4 modding is like this, you are now able to create a full mod.

k, so my mod i'm making is a modern world mod and i'm adding in a terrorist, and i want them to act similar to barbarians but appear in the modern times and appear in peoples country boundaries too....i know this isn't a unit question but you've been a ton of help for me :) is this possible and do you think you could clue me in on how to accomplish this?

Not sure what you want to do.
You could just give the barbarians a terrorist UU. If they then survive until the modern ages (or you place them in some scenario), then they should be able to build them.

Or you could make some time of "land privateer", but the AI is not really good with these types of units
 
Yes, i might be able to do that, but they won't appear in claimed land, and almost always the world will be settled by the modern ages. I need the terrorists to start appearing everywhere once you get into the modern era or so. I'm kinda wanting the terrorists to be able to get mad at specific countries and stuff like a noramal civ but i don't want them to have their own cities and all that.......... and i'm starting to learn how to do python editing now, if thats required....but geez its crazy stuff...:confused
 
oh wow! that looks a bout exactly what i'm building! haha thanks man! i'll give it a try. how to i decompress it? its a wierd type of file. 7z flile type??
 
alright i checked out that mod. its pretty neat and has alot of the same concepts i was planning on adding into my mod, but i want it to be more unit based. Hmmm okay, so i want to make a unit that can capture ships...... is this possible? like instead of having the unit attack the ship, it could capture it instead?
 
oh thats cool! i like the idea. is it possible to make it only for one unique unit? i don't want all the naval units able to do this, just one unit class....
 
alright thank :) i'm not sure which code so i'll just paste a few... just class and unit xml...
Spoiler :
PHP:
<UnitClassInfo>
			<Type>UNITCLASS_SPECIAL_FORCES_MARITIME</Type>
			<Description>TXT_KEY_UNIT_SPECIAL_FORCES_MARITIME</Description>
			<iMaxGlobalInstances>-1</iMaxGlobalInstances>
			<iMaxTeamInstances>-1</iMaxTeamInstances>
			<iMaxPlayerInstances>2</iMaxPlayerInstances>
			<iInstanceCostModifier>0</iInstanceCostModifier>
			<DefaultUnit>UNIT_SPECIAL_FORCES_MARITIME</DefaultUnit>
		</UnitClassInfo>


Spoiler :
PHP:
<UnitInfo>
			<Class>UNITCLASS_SPECIAL_FORCES_MARITIME</Class>
			<Type>UNIT_NAVAL_SPETSNAZ</Type>
			<UniqueNames/>
			<Special>NONE</Special>
			<Capture>NONE</Capture>
			<Combat>UNITCOMBAT_GUN</Combat>
			<Domain>DOMAIN_LAND</Domain>
			<DefaultUnitAI>UNITAI_CITY_DEFENSE</DefaultUnitAI>
			<Invisible>NONE</Invisible>
			<SeeInvisible>NONE</SeeInvisible>
			<Description>TXT_KEY_UNIT_NAVAL_SPETSNAZ</Description>
			<Civilopedia>TXT_KEY_UNIT_NAVAL_SPETSNAZ_PEDIA</Civilopedia>
			<Strategy>TXT_KEY_UNIT_NAVAL_SPETSNAZ_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>0</bFirstStrikeImmune>
			<bNoDefensiveBonus>0</bNoDefensiveBonus>
			<bIgnoreBuildingDefense>1</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_SAM_INFANTRY</UnitClassUpgradeType>
					<bUnitClassUpgrade>1</bUnitClassUpgrade>
				</UnitClassUpgrade>
				<UnitClassUpgrade>
					<UnitClassUpgradeType>UNITCLASS_MECHANIZED_INFANTRY</UnitClassUpgradeType>
					<bUnitClassUpgrade>1</bUnitClassUpgrade>
				</UnitClassUpgrade>
			</UnitClassUpgrades>
			<UnitClassTargets/>
			<UnitCombatTargets/>
			<UnitClassDefenders/>
			<UnitCombatDefenders/>
			<FlankingStrikes/>
			<UnitAIs>
				<UnitAI>
					<UnitAIType>UNITAI_ATTACK</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
				<UnitAI>
					<UnitAIType>UNITAI_RESERVE</UnitAIType>
					<bUnitAI>1</bUnitAI>
				</UnitAI>
				<UnitAI>
					<UnitAIType>UNITAI_CITY_DEFENSE</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>BUILDING_NAVAL_ACADEMY</PrereqBuilding>
			<PrereqTech>TECH_ASSEMBLY_LINE</PrereqTech>
			<TechTypes>
				<PrereqTech>TECH_RIFLING</PrereqTech>
				<PrereqTech>NONE</PrereqTech>
				<PrereqTech>NONE</PrereqTech>
			</TechTypes>
			<BonusType>NONE</BonusType>
			<PrereqBonuses/>
			<ProductionTraits/>
			<Flavors/>
			<iAIWeight>0</iAIWeight>
			<iCost>140</iCost>
			<iHurryCostModifier>0</iHurryCostModifier>
			<iAdvancedStartCost>100</iAdvancedStartCost>
			<iAdvancedStartCostIncrease>0</iAdvancedStartCostIncrease>
			<iMinAreaSize>-1</iMinAreaSize>
			<iMoves>1</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>20</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>0</iCollateralDamageLimit>
			<iCollateralDamageMaxUnits>0</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>
				<UnitCombatMod>
					<UnitCombatType>UNITCOMBAT_GUN</UnitCombatType>
					<iUnitCombatMod>25</iUnitCombatMod>
				</UnitCombatMod>
			</UnitCombatMods>
			<UnitCombatCollateralImmunes/>
			<DomainMods/>
			<BonusProductionModifiers/>
			<iBombRate>0</iBombRate>
			<iBombardRate>0</iBombardRate>
			<SpecialCargo>NONE</SpecialCargo>
			<DomainCargo>NONE</DomainCargo>
			<iCargo>0</iCargo>
			<iConscription>6</iConscription>
			<iCultureGarrison>10</iCultureGarrison>
			<iExtraCost>0</iExtraCost>
			<iAsset>3</iAsset>
			<iPower>20</iPower>
			<UnitMeshGroups>
				<iGroupSize>3</iGroupSize>
				<fMaxSpeed>1.75</fMaxSpeed>
				<fPadTime>1</fPadTime>
				<iMeleeWaveSize>3</iMeleeWaveSize>
				<iRangedWaveSize>0</iRangedWaveSize>
				<UnitMeshGroup>
					<iRequired>3</iRequired>
					<EarlyArtDefineTag>ART_DEF_UNIT_NAVAL_SPETSNAZ</EarlyArtDefineTag>
				</UnitMeshGroup>
			</UnitMeshGroups>
			<FormationType>FORMATION_TYPE_RANGED</FormationType>
			<HotKey/>
			<bAltDown>0</bAltDown>
			<bShiftDown>0</bShiftDown>
			<bCtrlDown>0</bCtrlDown>
			<iHotKeyPriority>0</iHotKeyPriority>
			<FreePromotions/>
			<LeaderPromotion>NONE</LeaderPromotion>
			<iLeaderExperience>0</iLeaderExperience>
		</UnitInfo>
 
I meant the python code ;).
But that's obsolete now, i'm sitting at my civ PC, so no problem anymore.

To make it only affect this one unit, you want to change this line:
PHP:
if (unitX.getUnitCombatType() == gc.getInfoTypeForString("UNITCOMBAT_NAVAL")):

to this here:
PHP:
if (unitX.getUnitClassType() == gc.getInfoTypeForString("UNITCLASS_SPECIAL_FORCES_MARITIME")):
 
hey so i've been looking at this trying to figure it out and i'm pretty lost. how do i install it? and whats the php file?.............nevermind i figured it out! i always ask questions too early ha. So i'm trying to make this unit amphibious. I want it to be able to enter coasts but not oceans...how would i do that? And also the new unit that i'm making to capture other ships is a land unit that i want to be able to attack out of transports...how do i implement this?
 
So i'm trying to make this unit amphibious. I want it to be able to enter coasts but not oceans...how would i do that?

There's this tag:
PHP:
<bCanMoveAllTerrain>0</bCanMoveAllTerrain>

If you set it to 1, then the unit can enter every tile, besides impassable ones (ice, peaks). To not allow the movement on ocean, you should take a look at the trireme ;).

And also the new unit that i'm making to capture other ships is a land unit that i want to be able to attack out of transports...how do i implement this?

Not possible without bigger reprogramming :(.
 
Back
Top Bottom