From Original War Support Wiki
Tutorials -> Defining Characters
In mod you can define a new character by using:
- Start.txt file (only for a campaign)
In SAIL you create a unit using functions CreateHuman, CreateVehicle and CreateBuilding. What kind of unit each function corresponds to should be obvious. They all return the identifier of the created unit. The properties of the unit is determined by the values of the SAIL variables starting with
- "uc_" (unit create - common for all units types)
- "hc_"(human create - human units)
- "vc_" (vehicle create - vehicles)
- "bc_" (building create - buildings)
the moment the "create function" is executed.
A complete list of all SAIL variables can be found here: SAIL Variables.
After creation, the unit is often placed using a function like PlaceUnitXY.
Since we are only interested in creating characters, we will focus on function CreateHuman, the "unit create" and the "human create" variables.
"Unit Create Variables"
The most interesting "unit create" variables are uc_nation, uc_side and uc_direction.
uc_nation determines the nation of the human unit. Possible values are nation_nature, nation_american, nation_arabian and nation_russian. See nation constants for further info.
uc_side determines the side of the unit (0 to 8).
uc_direction determines the direction in which the unit will face when placed.
The remaining "unit create" variables (uc_placed, uc_x and uc_y) are only rarely used.
uc_placed is a boolean. If set to true, the unit will be placed immediately when created on the hex specified by uc_x and uc_y. If the unit cannot be placed here (invalid hex, occupied hex etc.), the unit is not placed.
"Human Create Variables"
Value in range from -50 to 50 which describes how aggressive apeman is (in other words: Chance it would attack people; the higher value the higher chance; negative values can cause it to run away from people).
List containing two integer values. The first value determines the stamina; the second the dexterity (speed).
List contaning four integer values defining the basic skill level [skill_combat,skill_engineering,skill_mechanical,skill_scientistic]. E.g. a unit with basic skill 6 in skill_combat requires 1000 xp to advance to level 7 in skill_combat. Always use before hc_skills!
Defines the class of the human unit. For a list of possible values see class constants. Note that some classes require the unit to be a certain nation. E.g. class_desert_warior must have Arabian nation, and class_tiger must be nation_nature.
The number of the face from the specified gallery the human unit should have. Counting starts with 1.
Defines the gallery in which the face for the human unit will be found. The name of the gallery must be in inverted commas, like 'ru1'.
Character with the highest importance goes first in the list of human units in game. If it's 100 or higher, then character avatar is highlighted.
Possibly same function as definition of last mission in start.txt (see below) but effect is still unknown. Just leave it be.
Name of the human unit in game. Must be in inverted commas, like 'Ibanez Kazan'.
Effect is unknown.
The sex of the human unit. sex_male for male; sex_female for female. See Gender Constants.
List contaning four integer values, each representing a skill [skill_combat,skill_engineering,skill_mechanical,skill_scientistic]. Unlike hc_basic_skills, hc_skills adds a random amount of experience to each skill in order to raise the level from the level specified in hc_basic_skills to the level specified in hc_skills. Example:
hc_basic_skills = [0,1,2,3]; hc_skills = [0,0,3,5];
The result is the human unit is:
Level 0 in skill_combat with experience somewhere between 0 and 999.
Level 1 in skill_engineering with experience somewhere between 0 and 999.
Level 3 in skill_mechanical with experience somewhere between 1000 and 2999.
Level 5 in skill_scientistic with experience somewhere between 3000 and 6999.
Note that skill_engineering is still added 0-999 xp even though hc_skills = 0 ad hc_basic_skills = 1.
uc_side = 3; uc_nation = nation_russian; hc_class = class_mechanic; hc_sex = sex_female; hc_basic_skills = [1,0,3,2]; hc_skills = [1,1,5,2]; hc_attr = [10,12]; hc_name = 'Vlada Vladmiro'; hc_gallery = 'ru'; hc_face_number = 16; Vlada = CreateHuman;
This creates a female, Russian mechanic named "Vlada Vladmiro" and binds her identifier to the variable "Vlada". She is side 3 (red). Attributes are 10 stamina and 12 dexterity (speed). Her face can be found in gallery "ru", face number 16. She is level 1 in combat skill, 1 in engineering skill, 5 in mechanical skill and 2 in scientistic skill. Since we left hc_importance untouched, she has importance 0 (default value).
The variables can be reset to default value using functions
InitUc ("unit create" variables) InitHc ("human create" variables) InitVc ("vehicle create" variables) InitBc ("building create" variables)
and related functions.
Start.txt is a plain text (ANSI encoded) file placed in Data1.owp/Campaigns/SIDE/Start.txt (where SIDE is AM, AR or RU). It contains definitions of all campaign's important characters (there are also some random ones - in next update I hope I'll be able to say something more).
First of all, it's important to know that this file is put in each save file with updated content so each time programmer saves a variable or character, it goes to text file in campaign save file (if identifier already exists then it gets updated). The new text file is named after the save OWP.
File starts with declaration of variables and characters amount that are saved. Example from my mod:
VARIABLES 0 CHARACTERS 75
Then all the characters are defined (variables would be defined after VARIABLES line but usually no one defines them). You have to keep proper number of both the above values so that there will be no problems. Symptoms of miscounting these are two: the first would make the game crash (happens if number is higher than real amount), the second would be that variables/characters from the bottom of each list don't get loaded (happens if number is lower than real amount).
The file ends with keyword:
Let me explain the character's definition now. Example will be John Macmillan from AM campaign:
JMM 1 DEFINE NAME Macmillan HUMAN 1 1 1 ATTR 11 11 SKILLS 3 2195 0 4582 0 24838 1 16776 LAST_MISSION 1 CHAR @ 110 0 RANDSEED 0 VOICE 101 GALLERY us 5 END_OF_DEFINE
The first line is the identifier of that character (or group of characters) used in SAIL to load the character (or group). The number tells how many characters are identified by this identifier (if it's one or if it's a group; 0 if you save zero variable as a character). Identifier must start with a letter and can't contain any spaces. I generally create one identifier for one character but if you want to create a group then change the number to amount of characters and add DEFINE - END_OF_DEFINE blocks for each of them below (however game doesn't allow to load a group from start.txt; it's available only from save files).
Then comes the character definition for that identifier, starting with keyword:
NAME is what is seen in game. It can work as an identifier to a name defined in Texts/CharName.wri (example is in data1.owp), or be the name itself. In the last case you have to use "" around the name if the name contains spaces, e.g. "Terry Boot".
HUMAN: sex (1 - male, 2 - female), class (class constants) and nation (nation constants). Note that some classes work only with one specific nation: Desert rider - Arabian, Apeman - nature, etc.
ATTR: stamina and speed
SKILLS: skills' levels and experience points (soldiering, engineering, mechanical, scientific)
LAST_MISSION a number of the last mission character was used in (if you define it, then it's always best to provide here number of the first mission you're going to use your character); it gets updated with last mission's number after each save. It's used for adding experience points for characters that weren't lately used. (Note that mission's number comes from Map Preferences!).
CHAR: the first number is importance (same explanation as for hc_importance above). The second number is aggressivity (same description as for hc_agressivity above).
RANDSEED: as in any programming language - random seed allows to take control of randomization. However it's final effect is still unknown.
VOICE: number of voice; some predefined ones are in Data1.owp/Data/GameInit/Voices.txt
GALLERY: the name of the gallery file (in Gallery folder; gallery can be created with XichtEd) and number of the face in it (counting starts with 1).
The definition ends with keyword:
Note 1: Experience points in Start.txt = 30x experience points in campaign or 10x experience points in multiplayer.
Note 2: There is also another way of defining face by using PORTRET keyword but it's not recommended.