SOLDIER.DAT

From UFOpaedia
Revision as of 05:56, 1 February 2009 by Zombie (talk | contribs) (→‎Initial Recruit Stats: Floated table to the right and added a little text.)
Jump to navigation Jump to search

General Notes

SOLDIER.DAT has a fixed structure of 250 entries of 68 bytes each. (Only a maximum of 250 soldiers can be had.) Thus it is always 17,000 bytes long (250x68).

Values are presented according to byte count (1 to 68) followed by the equivalent hex offset (00 to 43) in bold, followed by the normal (non-hacked) range of values in italics. Most fields can be hacked up to FF, but sometimes it can make for weirdness!

Structure

Basic Information

0-1 / 00-01 (0-5, FFFF): Integer set to Rank or FFFF if soldier is dead (or slot not yet used). Values are actually a pointer within ENGLISH.DAT. Ranks are:

0 Rookie
1 Squaddie
2 Sergeant (SGT)
3 Captain (CPT)
4 Colonel (COL)
5 Commander (CDR)
6 Select Squad for
7 SPACE AVAILABLE>

2-3 / 02-03 (various, FF): Base the soldier is at, using reference values from LOC.DAT. First base is always 0 (first entry in LOC.DAT). Value of FF means the soldier is being transferred.

4-5 / 04-05 (various, FFFF): Craft soldier is assigned to, using values from LOC.DAT. FFFF means not assigned to a craft.

6-7 / 06-07 (various, FFFF): Craft soldier was assigned to before being wounded and spending time in the infirmary.

8-9 / 08-09 (0+): Missions. Signed integer. (The soldier display shows a negative value if highest/16th bit is set!)

10-11 / 0A-0B (0+): Kills. Signed integer.

12-13 / 0C-0D (0+): Wound recovery days. Signed integer.

14-15 / 0E-0F (20+): Soldier value a.k.a. victory point loss if dies on a mission. Signed integer. Is equal to 20 + Missions + Rank Bonus, as follows:

   0  Recruit
  +1  Squaddie 
  +1  SGT
  +3  CPT
  +6  COL
 +10  CDR

Note: Hex-editing Missions or Rank and performing a combat (while not touching this field) does not cause this field to reflect the edited values. This field simply adds 1 for each mission and a delta when promoted (e.g. COL to CDR +4). In other words, although it uses the equation shown above, it's not actually computed from Missions and Rank, per se.

16-40 / 10-28 (Text): Name, 25 characters long. Only approx. 21 characters can be entered when editing the field within the game's Soldier display, but longer names can be hex edited and will be seen in the game. Almost any keyboard character can be entered (including within the game) because they are stored directly instead of going through Windows objects. The end of the current name is a null byte; garbage can be present after that (ends of longer previous names, etc.).

41 / 29 (various): Always 0 except for existing soldiers being transferred, in which case it equals the LOC.DAT value for destination base. New recruits on their way to a base will also have this set to 0, so if Byte 3 is set to FF and this byte is 0, you can't tell (from these two bytes alone) if it's an existing soldier going to your first base (LOC.DAT=0), or a new recruit going to any base. But the game knows where they're going, via TRANSFER.DAT.

Initial Recruit Stats

Denoted in the geoscape soldier display by the two-tone stat bars (not viewable in combat)

[52] ValueBravery
0110
1100
290
380
470
560
650
740
830
920
1010
110

42 / 2A (50-60): Initial Time Units

43 / 2B (25-40): Initial Health

44 / 2C (40-70): Initial Energy a.k.a. Stamina

45 / 2D (30-60): Initial Reactions

46 / 2E (20-40): Initial Strength

47 / 2F (40-70): Initial Firing Accuracy

48 / 30 (50-80): Initial Throwing Accuracy

49 / 31 (20-40): Initial Melee Accuracy a.k.a. Close Combat Accuracy

50 / 32 (0-100): Psionic Strength. Never changes.

51 / 33 (0-105+): Current Psionic Skill. 0 = Not yet trained / Psi stats not visible. See Note 1.

Unlike other stats, Psi Skill always starts at 0. So it stores its current skill in what would've otherwise been its initial skill byte, if you will. Also see Bytes 64 and 65.

52 / 34 (5-10): Initial Bravery. Computed as 110-(10*ThisByte). E.g. if ThisByte=9, Bravery=20. So the lower this byte is, the better your Bravery is (see table at right). Initial Bravery can be 10-60, and it only uses increments of 10.

Stat Improvement

Add to initial values to get current total.

53 / 35 (0-31): Time Unit Improvement. (Max total TUs possible (initial+improvement) is 81. See Note 1.)

54 / 36 (0-36): Health Improvement. (Max total 61)

55 / 37 (0-61): Stamina Improvement. (Max total 101)

56 / 38 (0-75): Reaction Improvement. (Max total 105)

57 / 39 (0-51): Strength Improvement. (Max total 71) Note that very high (hacked) values can cause "unable to throw here", presumably because the arc would intercept the "ceiling" of the Battlescape. See throwing distance for more on Strength versus Throwing.

58 / 3A (0-85): Firing Accuracy Improvement. (Max total 125)

59 / 3B (0-75): Throwing Accuracy Improvement Improvement. (Max total 125)

60 / 3C (0-105): Melee/Close Combat Accuracy Improvement. (Max total 125)

61 / 3D (0-9): Bravery Improvement (multiply by 10). (Max total 9; 100 Bravery)

Odds and Ends

62 / 3E (0-3): Armor. 0=None, 1=Personal Armor, 2=Power Suit, 3=Flying Suit.

Can be hacked to: 4=Sectoid, 5=Snakeman, 6=Ethereal, 7=Muton, 8=Floater, 9=Celatid, 10=Silacoid, 11=Chryssalid. (Higher values are civilians and parts of big units.) NOTE: These are not real aliens, just skins... more research must be done e.g. on appearance and gender to make real aliens.

63 / 3F (0-24): Most-recent month's Psi Lab training increase. Largest values for newly trained (16-24). For Psi Lab point-award functionality, see Psionic Skill.

64 / 40 (0,1): In Psi Lab training.

65 / 41 (0,1): Promotion flag (as of most recent combat). Reset as of next combat.

66 / 42 (0,1): 0=Male, 1=Female.
Editing values greater than 1 does not change the appearance in the soldier equip screens. However, the soldier image will always take the outward appearance of a female during a mission.

67 / 43 (0-3): Appearance (for loadout, no armor): 0=blonde, 1=brown hair, 2=Oriental, 3=African.
Refers to the UFOGRAPH/MAN.spk images. Because there are only 4 nationalities, editing values greater than 3 will result in an error code: cannot open file ufograph/man_XYZ.spk where X is 0 or 1 (Light armored or personnel armored), Y is "M" or "F" (Male or Female) and Z is the nationality value listed in this field.

Notes

  1. The possible values for skill increases (in a non-hacked game) depend both on the cap for each skill and on each soldiers' initial value. Thus the max possible value shown in the 'increase' range is for soldiers who started with the minimum initial skill, and got the max possible cap 'overflow'. Primary skills can have up to cap+5, and secondary skills can have up to cap+1. Also, Psi Skill is not truly capped - although soldiers cease to get combat increases once at or above 100, it will continue to increase by 2-3 each month the soldier stays in Psi Training. For more info, see Regarding Caps.
  2. When you enter combat, the Unitref stat values (offset 23-28 etc.) are 'read only' (for that combat only). If you edit Unitref stat values and end the combat, the changed stats are not reflected in the soldier's stats in the geoscape. Instead, the stat values from Soldier.Dat are used. Makes sense, since the current stat level doesn't change during combat, per se - you only get stat changes (increases, if any) when the mission ends. "Kills" is the only value known to carry directly from geoscape to combat and back (due to its "unpredictability").
  3. If you hack your stats, the game doesn't care if you put larger values than a recruit can get in the "initial" bytes. Or if you totally zero out a skill, for that matter. Not in the geoscape, anyway... Could lead to a very bad day on the battlefield, though.
  4. If your total skill value (initial + increase) is high enough, your skill bar will wrap around the stat display screen. (See how it goes to 150 in combat, 170 in geoscape?)
  5. As can be seen, Armor is the only thing that 'stays with' a soldier. Yes, it's lost if you fire someone wearing it!

For More Information

  • For information on individual skills see Soldiers
  • For information on increasing skills see Experience
  • UNITREF.DAT tracks items on the battlefield, including soldiers and their stats, and experience counters. Also see the notes at bottom of Unitref.
  • For more info on starting soldier stats, see Recruit Statistics
  • Notes on hex editing
  • A Hex Workshop Structure Library for editing this file can be found here

Return to Saved Game Files

See Also

SOLDIER.DAT (TFTD)