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. This document describes how to achieve this in as much detail as I can give.
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.
There are a couple of missions I a considering using as examples
- 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 startArt 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.
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 upCreate 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.
Define the missionCopy 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
Define the text for the missionAgain 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.
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.