Dancing Hoskuld
Deity
This is a work in progress I will be adding to it as I do the work. It may be all over the place as far as content is concerned as I get things straight. 
In normal and BUG versions of Civ IV you need to do some python work in the main interface code to add missions to a unit. This is not the case in C2C where we can define missions and outcomes from the missions sometimes with very little python at all.
All files are WoC modular but it is best to include all the relevant files in the one module while you are building and testing the new missions. To this end i will be describing how to set up the module as well.
Missions are the actions that a unit can perform. An example is the spy mission "Bribe City". That particular example is coded in the dll.
Outcomes are a list of things that can happen when the mission is done. The outcomes may require Python to validate that particular outcome or to do the actual action.
Unit Actions this links the outcomes and missions to a particular unit or unit class.
The important files

In normal and BUG versions of Civ IV you need to do some python work in the main interface code to add missions to a unit. This is not the case in C2C where we can define missions and outcomes from the missions sometimes with very little python at all.
All files are WoC modular but it is best to include all the relevant files in the one module while you are building and testing the new missions. To this end i will be describing how to set up the module as well.
Missions are the actions that a unit can perform. An example is the spy mission "Bribe City". That particular example is coded in the dll.
Outcomes are a list of things that can happen when the mission is done. The outcomes may require Python to validate that particular outcome or to do the actual action.
Unit Actions this links the outcomes and missions to a particular unit or unit class.
Spoiler :
There are a couple of missions I a considering using as examples
What do you need before you start
There are three parts to defining a mission, two are done in XML (mission and outcomes) and there may be a need for some Python as well. AI for the missions may be needed but is out of scope for this document. AI may also be done in Python.
Missions are defined in XML but are not WoC compatible so they must be defined in the core area. Not only that any you add must be at the end of the file because some are defined to the dll by the order they appear.
Outcomes on the other hand can be modular so can be defined in the XML of optional modules. This is the way to control when the mission is in game or not.
Python code is defined in the Event code so is also not modular. (Check this SO has suggested that it may be possible to have it modular.)
Setting up
Define the mission
Define the text for the mission
Defining what you want to happen and who does it when.
We now move onto outcomes.
- how on earth do I give the correct number of units and their type? Do I do that in the outcome?
So far there is nothing to see in game. We now need to add these missions to units using Outcomes.
- Great General action Rally which creates 24 Warriors. Note: number depends on World Size, Type depends on Conscript available (original by Platyping)
- Thief or Rogue stealing money from another nation
What do you need before you start
Art work for the mission.
What the mission does when successful, partly successful and fails. The probabilities and costs for these.
Where it can happen. What preconditions are there and what modifies the chances of success.
What the mission does when successful, partly successful and fails. The probabilities and costs for these.
Where it can happen. What preconditions are there and what modifies the chances of success.
There are three parts to defining a mission, two are done in XML (mission and outcomes) and there may be a need for some Python as well. AI for the missions may be needed but is out of scope for this document. AI may also be done in Python.
Missions are defined in XML but are not WoC compatible so they must be defined in the core area. Not only that any you add must be at the end of the file because some are defined to the dll by the order they appear.
Outcomes on the other hand can be modular so can be defined in the XML of optional modules. This is the way to control when the mission is in game or not.
Python code is defined in the Event code so is also not modular. (Check this SO has suggested that it may be possible to have it modular.)
Setting up
Create the module folder in this case Assets/Modules/Platyping/Advanced_GP. I am putting this inside the Platyping folder because it is his ideas we are using. If we do a lot more than he did or change it all significantly we may move the mod up to the Modules file but keep a dedication somewhere indicating where the original idea came from. We all do this for free so credit is the only reward we can give.
While building and testing I keep the art in the module folder but have it in the same structures as it will be when transferred into the core area for inclusion in the FPK files. So now create the folders under this Art/Interface/Buttons/Missions and put Rally.dds in this folder.
While building and testing I keep the art in the module folder but have it in the same structures as it will be when transferred into the core area for inclusion in the FPK files. So now create the folders under this Art/Interface/Buttons/Missions and put Rally.dds in this folder.
Define the mission
Copy the file C2C_CIV4UnitSchema.XML into the Advanced_GP folder and rename it to Advanced_GP_CIV4UnitSchema.XML.
I then usually copy the file I want to work on next from some other module so I can use it as a template. Copy the file CIV4MissionInfos.XML into the Advanced_GP folder and rename it Advanced_GP_CIV4MissionInfos.XML. Edit this file and rename the schema file at the top and delete all missions except the last which we are going to use as a template.
The Advanced_GP_CIV4MissionInfos.XML should look like
Change the names in the missions file to the one we are using GG_RALLY and put the correct button name in. I expect we will also have a HERO_RALLY mission at some stage which will use the same button but have different outcomes.
It should now look like
I then usually copy the file I want to work on next from some other module so I can use it as a template. Copy the file CIV4MissionInfos.XML into the Advanced_GP folder and rename it Advanced_GP_CIV4MissionInfos.XML. Edit this file and rename the schema file at the top and delete all missions except the last which we are going to use as a template.
The Advanced_GP_CIV4MissionInfos.XML should look like
Spoiler :
Code:
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Jon Shafer (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Mission Infos -->
<Civ4MissionInfos xmlns="x-schema:Advanced_GP_CIV4UnitSchema.xml">
<MissionInfos>
<MissionInfo>
<Type>MISSION_RECORD_TALE_ORAL</Type>
<Description>TXT_KEY_MISSION_RECORD_TALE</Description>
<Help>TXT_KEY_MISSION_RECORD_TALE_HELP</Help>
<Waypoint>NONE</Waypoint>
<EntityEventType>ENTITY_EVENT_GREAT_EVENT</EntityEventType>
<iTime>0</iTime>
<bTarget>0</bTarget>
<bBuild>0</bBuild>
<bSound>0</bSound>
<bVisible>1</bVisible>
<Button>Art/Interface/Buttons/Missions/RecordOral.dds</Button>
</MissionInfo>
</MissionInfos>
</Civ4MissionInfos>
Change the names in the missions file to the one we are using GG_RALLY and put the correct button name in. I expect we will also have a HERO_RALLY mission at some stage which will use the same button but have different outcomes.
It should now look like
Spoiler :
Code:
<?xml version="1.0"?>
<!-- edited with XMLSPY v2004 rel. 2 U (http://www.xmlspy.com) by Jon Shafer (Firaxis Games) -->
<!-- Sid Meier's Civilization 4 -->
<!-- Copyright Firaxis Games 2005 -->
<!-- -->
<!-- Mission Infos -->
<Civ4MissionInfos xmlns="x-schema:Advanced_GP_CIV4UnitSchema.xml">
<MissionInfos>
<MissionInfo>
<Type>MISSION_GG_RALLY</Type>
<Description>TXT_KEY_MISSION_GG_RALLY</Description>
<Help>TXT_KEY_MISSION_GG_RALLY_HELP</Help>
<Waypoint>NONE</Waypoint>
<EntityEventType>ENTITY_EVENT_GREAT_EVENT</EntityEventType>
<iTime>0</iTime>
<bTarget>0</bTarget>
<bBuild>0</bBuild>
<bSound>0</bSound>
<bVisible>1</bVisible>
<Button>Art/Interface/Buttons/Missions/Rally.dds</Button>
</MissionInfo>
</MissionInfos>
</Civ4MissionInfos>
Define the text for the mission
Again I prefer to copy an existing text file and work with it as a template. Given that I don't know other languages and C2C now handles the text files so that many more languages work all I need do is define the text in English.
The name of the XML file holding the text will be Adbvanced_GP_CIV4GameText.XML. NB: It is very important that the text files end with the suffix _CIV4GameText, if they don't they will be ignored.
The name of the XML file holding the text will be Adbvanced_GP_CIV4GameText.XML. NB: It is very important that the text files end with the suffix _CIV4GameText, if they don't they will be ignored.
Spoiler :
Code:
<?xml version="1.0" encoding="UTF8"?>
<Civ4GameText xmlns="http://www.firaxis.com">
<TEXT>
<Tag>TXT_KEY_MISSION_GG_RALLY</Tag>
<English>Rally Troops</English>
</TEXT>
<TEXT>
<Tag>TXT_KEY_MISSION_GG_RALLY_HELP</Tag>
<English>[COLOR_HIGHLIGHT_TEXT]Rally[COLOR_REVERT][NEWLINE]Creates some combat units.[NEWLINE]It consumes the Great Person.</English>
</TEXT>
</Civ4GameText>
Defining what you want to happen and who does it when.
We now move onto outcomes.
- how on earth do I give the correct number of units and their type? Do I do that in the outcome?
So far there is nothing to see in game. We now need to add these missions to units using Outcomes.
The important files
CIV4OutcomeInfos
Tag name|Type|Optional|Description
Type|text|no|Mission ID
bTypeDependency|boolean|yes|
bForceOverwrite|boolean|yes|
bForceDelete|boolean|yes|
iForceInsertLocation|integer|yes|
AndDependencyTypes|list|yes|WoC and dependencies
OrDependencyTypes|list|yes|WoC or dependencies (check)
Description|text ID|no|Name of the outcome displayed in game
Message|text ID|no|Text displayed when the mission is done.
PrereqTech|text ID|yes|Text ID of the prerequisite technology
ObsoleteTech|text ID|yes|Text ID of the technology that obsoletes this outcome
PrereqCivic|text ID|yes|Text ID of the prerequisite Civic
bToCoastalCity|boolean|yes|Send the unit to the nearest coastal city if send to city set on.
bFriendlyTerritory|boolean|yes|can be done in friendly territory
bNeutralTerritory|boolean|yes|can be done in neutral territory
bHostileTerritory|boolean|yes|can be done in hostile territory
bBarbarianTerritory|boolean|yes|can be done in barbarian territory
bCity|boolean|yes|must be done in a city
bNotCity|boolean|yes|can't be done in a city
PrereqBuildings|list|yes|list of prerequisite buildings
ExtraChancePromotions|list|yes|list of adjustments to the probability based on the promotions of the unit
ReplaceOutcomes"|list|yes|list of outcomes this outcome replaces
Type|text|no|Mission ID
bTypeDependency|boolean|yes|
bForceOverwrite|boolean|yes|
bForceDelete|boolean|yes|
iForceInsertLocation|integer|yes|
AndDependencyTypes|list|yes|WoC and dependencies
OrDependencyTypes|list|yes|WoC or dependencies (check)
Description|text ID|no|Name of the outcome displayed in game
Message|text ID|no|Text displayed when the mission is done.
PrereqTech|text ID|yes|Text ID of the prerequisite technology
ObsoleteTech|text ID|yes|Text ID of the technology that obsoletes this outcome
PrereqCivic|text ID|yes|Text ID of the prerequisite Civic
bToCoastalCity|boolean|yes|Send the unit to the nearest coastal city if send to city set on.
bFriendlyTerritory|boolean|yes|can be done in friendly territory
bNeutralTerritory|boolean|yes|can be done in neutral territory
bHostileTerritory|boolean|yes|can be done in hostile territory
bBarbarianTerritory|boolean|yes|can be done in barbarian territory
bCity|boolean|yes|must be done in a city
bNotCity|boolean|yes|can't be done in a city
PrereqBuildings|list|yes|list of prerequisite buildings
ExtraChancePromotions|list|yes|list of adjustments to the probability based on the promotions of the unit
ReplaceOutcomes"|list|yes|list of outcomes this outcome replaces