How to create your own campaign
Beta version 0.20a
Author: Mirek Dymek
Lame polish-english translation by Batonik
Sorry for any mistakes, but my english isn't perfect ;-)
Players - Maps - Scripts
- Campaign script - Base
scripts - Mission script
UCS campaign - an example.
There are always three players in a campaign. One of them is controlled by the user, while the others are driven by the AI. Players taking part in a campaign have assigned numbers and colours:
UCS: No 1, red,
ED: No 2, green,
LC: No 3, blue,
This should be considered when planning a campaign, writing scripts and making maps in the editor. Continuity of researching throughout the campaign is maintained for main players. There can be other opponents on some missions, but their researches start from the beginning and such players are deleted after the end of the mission.
During the campaign battlefield consists of four parts called worlds. There are three smaller worlds on which player's bases are placed and there is a world where main action takes place. Each of them is created in the ingame editor. World where bases are placed must have size of "base" (that's obvious :) ). Mission map can have any size smaller than "huge". Loading of "huge" map will crash the game.
Mission map (World #0), allowed sizes: base, small, medium, large
UCS base (World #1) size: base
ED base (World #2) size: base
LC base (World #3) size: base
Basic rules for creating maps:
- Maps can have any name, but it's better to keep them self-explainable.
- Maps should contain starting point for each player that is going to be placed in a campaign.
- Mission map should contain landing zone or a building vessel for player controlled by the user. Otherwise the user couldn't enter nor leave the mission.
- There should be at least one building or unit for a player or else he will be considered dead at the start of the mission.
- Players should be assigned to proper races. Races are changed in the window switched by the [?] button on the "Objects" tab.
Each player (human and AI players) contains one "player" object in every world. Most of this object properties are separated for every world but some (like researches) are common for all worlds. Consult included scripts to see how players are used.
Campaigns are driven by scripts written in language called
"EarthC". It is similar to object oriented C++. Each script consists
of following parts:
Header (mission or campaign),
constants declarations (consts), states
declarations (state), states definitions (state)
and events definitions(event).
Here is the example of an empty mission script:
mission "mission name"
ß
header |
Mission described above starts with the "Initialize" state. Then it leaves "Initialize", enters the "Working" state and stays in it. There is no way to end this mission.
Now we'll discuss the basic mission script for an UCS campaign. Map for this
script should contain following items:
- starting point #1 (UCS),
- some objects for player 1 (red),
- starting point #2,
- some objects for player 2 (green),
- race of player 1 will be set to UCS,
- race of player 2 will be set to ED,
The script performs following tasks: at the start in the Initialize state it creates references to players playing the mission. Then it sets starting amounts of money (20 000 CR for each player). Next state Initialize is paused and scripts goes to Working state (command: return Working). In Working state the script checks if players have any buildings or units. If this is true for player 1, function EndMission(false) is executed. The mission ends and is considered lost. If there are no buildings or units of player 2 (the enemy) script calls EnableEndMissionButton(true) function, which activates the "end mission" button and enters state Nothing. Mission stays in this state waiting for the user to press the "end mission" button.
Here is the script:
mission "Misja 1"
ß
header if(
!playerUCS.GetNumberOfUnits() && !playerUCS.GetNumberOfBuildings()
) |
You can see examples of campaign script in files CampaignED.ec,
CampaignUCS.ec, CampaignLC.ec.
Your campaign script name must begin with CampaignED (CampaignUCS, CampaignLC or
TutorialED, TutorialUCS, TutorialLC for tutorial campaigns) f.e.: CampaignEDSomeExtension.ecoMP
(or TutorialEDSomeExt.ecoMP for tutorial) and must
be placed in directory Scripts\Campaigns\ED (or UCS, LC for other races). If
your campaign name have name f.e. "translateCampaignEDMySuperCamp"
then you can add string "translateCampaignEDMySuperCampDescription" -
with short description of your campaign. This string will be displayed in text
box in choose campaign dialog.
If you want to modify Earth campaign remember to use other names for mission
scripts - otherwise your new files will cover standard files with unpredictible
results.
Base scripts are normal mission files but exist as log as base world - thrugh all game. Becouse of game limitations you must have 3 bases in your campaign - one for player, and two (possible without any units) for AI players. If you want to make this two other bases available for player you can do it, but unfortunatelly there is a bug in game which causes that flight time of units transporter between two bases is very long.
1.1. Create a map with the editor.
1.2. Place starting point for player 1 (red) and for other players - enemies
1.3. Place Landing Zone for player 1 or an unit, preferably the builder (Mamut)
1.4. Place buildings and units of enemies
1.5. Write script for mission