Hi,
I'm trying to start to understand civ4 modding. The first thing I'd like to do, is to add a technology ("harvesting") with the pre-requisites "agriculture" and "mining", which gives a new unit, a "harvester" that can be used to harvest resources, just like crawlers in smac work.
This is a small mod, but I think I'll need a little bit of everything to make it work, and thus serves as a good learning experience. I'll need graphics, xml editing and python scripting.
So far, graphics seem the most difficult part, so I have started with re-using existing graphics (the indian worker seems a nice candidate).
OK, so, what follows is a basic description of what I've done and associated problems/questions/remarks. I hope others who want to start modding can get usefull info from this.
[edit]I had to change all xml tags to use {} instead of < and >, because this forum tried to interpret them as html, and I didn't find the option to turn that off.[/edit]
=> First, I created a directory in the "mods" directory: "Harvester"
=> I noticed all current mods have a .ini file. I have searched for, but nowhere found, a list of options to set here. So, for now, I've just copied the .ini from the Dessert War mod. The 5 options here are pretty self-explanatory.
=> Next, let's add the technology. I'll use the indian fast worker button graphics as the tech icon.
--> Created a folder "Harvester\Assets\XML\Technologies\"
--> Copied the file "CIV4TechInfos.xml" (from the default assets folder)
--> Look in the file "CIV4TechInfos_schema.xml", to know the structure of a {TechInfo} element. (Not really necessary, as you can guess the same info very reasonable from the other techs in the xml file).
--> Most elements are again self-explained, but some of them aren't. Here a short list I'd like more info about:
Most of these I've guessed, and so came up with this {TechInfo} element for the new tech:
--> While the schema tells me I can add a new {TechInfos} section, with my own {TechInfo} elements, this turned out not to work. When I added my {TechInfo} to the existing {TechInfos} list of {TechInfo} elements, the tech showed up in the civilopedia, the tech tree and so forth...
=> But, something is still wrong here. The tech doesn't have any pre-requisites. I can research it immediately, the prerequisites are not listed in the civilopedia, this tech is not listed as a "leads to" tech for agriculture and mining, it doesn't have any obligatory icons in the tech tree (nor any connectin lines) ... I have not yet solved this problem, but hopefully I will soon.
next up:
=> make the prerequisites for this tech work
=> copy all indian fast worker graphics and xml and rename to "harvester"
=> make the harvester available with this tech
=> modify the xml so it isn't a worker anymore
=> write python code that runs each turn and adds food/production/gold to the home city of each harvester.
I'm trying to start to understand civ4 modding. The first thing I'd like to do, is to add a technology ("harvesting") with the pre-requisites "agriculture" and "mining", which gives a new unit, a "harvester" that can be used to harvest resources, just like crawlers in smac work.
This is a small mod, but I think I'll need a little bit of everything to make it work, and thus serves as a good learning experience. I'll need graphics, xml editing and python scripting.
So far, graphics seem the most difficult part, so I have started with re-using existing graphics (the indian worker seems a nice candidate).
OK, so, what follows is a basic description of what I've done and associated problems/questions/remarks. I hope others who want to start modding can get usefull info from this.
[edit]I had to change all xml tags to use {} instead of < and >, because this forum tried to interpret them as html, and I didn't find the option to turn that off.[/edit]
=> First, I created a directory in the "mods" directory: "Harvester"
=> I noticed all current mods have a .ini file. I have searched for, but nowhere found, a list of options to set here. So, for now, I've just copied the .ini from the Dessert War mod. The 5 options here are pretty self-explanatory.
=> Next, let's add the technology. I'll use the indian fast worker button graphics as the tech icon.
--> Created a folder "Harvester\Assets\XML\Technologies\"
--> Copied the file "CIV4TechInfos.xml" (from the default assets folder)
--> Look in the file "CIV4TechInfos_schema.xml", to know the structure of a {TechInfo} element. (Not really necessary, as you can guess the same info very reasonable from the other techs in the xml file).
--> Most elements are again self-explained, but some of them aren't. Here a short list I'd like more info about:
Code:
iAIWeight (0-?) iAITradeModifier (0 or 10) iPower (0-10) iAsset (1-6)*8 CommerceFlexible sub-elements
PHP Code:
<TechInfo>
<Type>TECH_HARVESTING</Type>
<Description>Harvesting</Description>
<Civilopedia>Enables you to produce harvester units</Civilopedia>
<Help />
<Strategy>This is an important tech! It makes small cities powerfull</Strategy>
<Advisor>ADVISOR_GROWTH</Advisor>
<iAIWeight>0</iAIWeight>
<iAITradeModifier>10</iAITradeModifier>
<iCost>180</iCost>
<Era>ERA_ANCIENT</Era>
<FirstFreeUnitClass>NONE</FirstFreeUnitClass>
<iWorkerSpeedModifier>0</iWorkerSpeedModifier>
<iTradeRoutes>0</iTradeRoutes>
<iHealth>0</iHealth>
<iHappiness>0</iHappiness>
<iFirstFreeTechs>0</iFirstFreeTechs>
<iAsset>24</iAsset>
<iPower>3</iPower>
<bRepeat>0</bRepeat>
<bTrade>1</bTrade>
<bDisable>0</bDisable>
<bGoodyTech>1</bGoodyTech>
<bExtraWaterSeeFrom>0</bExtraWaterSeeFrom>
<bMapCentering>0</bMapCentering>
<bMapVisible>0</bMapVisible>
<bMapTrading>0</bMapTrading>
<bTechTrading>0</bTechTrading>
<bGoldTrading>0</bGoldTrading>
<bOpenBordersTrading>0</bOpenBordersTrading>
<bDefensivePactTrading>0</bDefensivePactTrading>
<bPermanentAllianceTrading>0</bPermanentAllianceTrading>
<bBridgeBuilding>0</bBridgeBuilding>
<bIrrigation>0</bIrrigation>
<bIgnoreIrrigation>0</bIgnoreIrrigation>
<bWaterWork>0</bWaterWork>
<iGridX>2</iGridX>
<iGridY>15</iGridY>
<DomainExtraMoves/>
<CommerceFlexible/>
<TerrainTrades/>
<Flavors>
<Flavor>
<FlavorType>FLAVOR_PRODUCTION</FlavorType>
<iFlavor>5</iFlavor>
</Flavor>
<Flavor>
<FlavorType>FLAVOR_GROWTH</FlavorType>
<iFlavor>3</iFlavor>
</Flavor>
<Flavor>
<FlavorType>FLAVOR_GOLD</FlavorType>
<iFlavor>2</iFlavor>
</Flavor>
<Flavor>
<FlavorType>FLAVOR_SCIENCE</FlavorType>
<iFlavor>2</iFlavor>
</Flavor>
</Flavors>
<OrPreReqs/>
<AndPreReqs>
<PrereqTech>TECH_MINING</PrereqTech>
<PrereqTech>TECH_AGRICULTURE</PrereqTech>
</AndPreReqs>
<Quote>some random text about crawlers in SMAC</Quote>
<Sound />
<SoundMP />
<Button>Art/Interface/Buttons/Units/Fastworker.dds</Button>
</TechInfo>
=> But, something is still wrong here. The tech doesn't have any pre-requisites. I can research it immediately, the prerequisites are not listed in the civilopedia, this tech is not listed as a "leads to" tech for agriculture and mining, it doesn't have any obligatory icons in the tech tree (nor any connectin lines) ... I have not yet solved this problem, but hopefully I will soon.
next up:
=> make the prerequisites for this tech work
=> copy all indian fast worker graphics and xml and rename to "harvester"
=> make the harvester available with this tech
=> modify the xml so it isn't a worker anymore
=> write python code that runs each turn and adds food/production/gold to the home city of each harvester.
Comment