Talk:SOLDIER.DAT

From UFOpaedia
Jump to navigation Jump to search

Why would Missions and Kills be signed? You're never going to have negative values. Shouldn't they be unsigned??

- Danial


You would think that, wouldn't you? At least that's what I would've done in their place. You can't owe a few kills or missions!

But if you enter values of 0xFFFF into each, the base screen shows -1. Hence why they're signed.

- NKF


Zombie, I've changed back your recent change to offset 63, as you've been mislead a bit by corrupt data...

The files MAN_A.SPK through to MAN_N.SPK do not exist in a normal install of UFO, I'm afraid, and it was never intended for Soldier.Dat to point to them. They are simply the file names I chose when I coded my custom uniform mod, so that aliens wouldn't display as troopers in the inventory screens anymore. I later added the same effect to my map editer as well. This affected the inventory screens and nothing else, by tweaking UnitRef[1] - The installation of either of my programs obviously adds the required MAN files to your game (as referring to any MAN file that does not exist causes a crash).

On the other hand, modifying Soldier[63] apparently changes the way the unit appears in the battlescape display, as well as what it turns into when it dies! This means that it is not only used to determine UnitRef[1] when battle begins, but UnitRef[0]/[38] as well, and most likely others...

That is to say, this byte gets set when you give a trooper armor. Armor dictates how a unit appears. However, it also indicates a units defensive values, and what item it will turn into when it dies. You didn't mention defense in your edit, but I would assume it also gets set to garbage when you fiddle with this offset.

I'll check this with a byte comparer when I get the time. With any luck, this'll also show me any remaining UnitRef offsets that are affected by this one. I'll update the article when I get some results.

- Bomb Bloke 05:41, 6 November 2006 (PST)


My fault, but problems like these could easily be avoided with a readme file indicating what modifications are made to the game files. Never thought that an editor had modding chunks tossed in. That'll teach me a lesson.

Changing the armor field in soldier.dat ([63] or [062] or whatever the darn offset is), changes the image sprite in the battlescape without too many problems, but running through your unit list in the equip screen will crash the game if the number here is greater than 3 as there aren't any MAN.spk images to refer back to. Like you mention, the actual armor attributes are garbage (albeit consistent garbage as the numbers do not change). Just for giggles I did a couple dry runs with varying values to see what would happen to the death item and armor attributes. This may or may not be useful.

ValueUnitDeath ItemFrLeRiReUn
4SectoidHP Clip1270115116117
5SnakemanPlasma Rifle118119120121122
6EtherealPR Clip12312412512618
7MutonPlasma Pistol41681510
8FloaterPP Clip14202000
9CelatidBlaster Launcher0025035
10SilacoidBlaster Bomb02418010
11ChryssalidSmall Launcher156088
12ReaperStun Bomb07890
13SectopodAlien Grenade5100821
14CyberdiscElerium-115?80000
15Male CivilianVariable13555
16Female CivilianPsi-Amp0052080
17ZombieUnknown00000
18InvisibleMind Probe00000
19InvisibleSectoid Corpse00000
20InvisibleSnakeman Corpse800104080
21InvisibleEthereal Corpse00000
22InvisibleMuton Corpse00000
23InvisibleCrashes (FLT?)08001040
24InvisibleCelatid Corpse001040160
25InvisibleSilacoid Corpse00000
26InvisibleChryssalid Corpse00000
27InvisibleReaper1 Corpse016001040
28InvisibleReaper2 Corpse001040160

I couldn't find out what item the Cyberdisc "unit" gives up when it dies, as the explosion happens even with Stun Bombs. I assume it's Elerium-115 as it follows the normal item list. The male civilian is a tough nut to crack also. I saw a death item of a Laser Rifle and a Small Rocket a few times - it's probably random or semi-random. Still, you can't stand over the "corpse" and pick up the item as it is invisible in the equip soldier screen. The Zombie is also strange as it cannot be killed by incendiary, most likely a hacked armor value will make the game assume you are wearing a suit of armor greater than Personal and apply the 0% modifier. A value of 23 will crash the game if you try and kill the unit so it's just an assumption that the death item is a Floater corpse.

I should also mention that some of the invisible units higher up on the list are probably tanks as the sound usually correlates to image. This doesn't hold for units lower in the list as I heard a movement noise of a Pistol or Rifle shooting rapidly for one of them! Strange stuff, but it can probably all be tied together once we know where the pointers are going.

- Zombie


That's an easy one at least. As you mentioned, they follow the normal item list when turning into death items. Simply put, a unit will turn into object X, where X is 31 + Soldier[63]. That is to say, by default, a unit with no armor (value 0) will turn into a normal corpse (31). But if you crank the value up to, say, 19 (an illegal value), you get a sectoid corpse (31 + 19 = object 50). Pointers to items in the list that were never implemented in the game create weird results.

As for why the floater crashes when dying, perhaps it uses an illegal death scream or something. The corpse value seems legal enough.

The units which sound like tanks, aren't. The reason they makes those noises is because each unit has it's own movement sound set, which is determined by some value in UnitRef. It's one of the values I've been meaning to hunt down but never got around to...

Furthermore, some units slide, and some units walk. This is another value I've yet to hunt down, but it's important, because sliding units (snakemen, tanks) sound the same regardless of the terrain they're moving over. They also incur different TU costs as per MCD[39]-[41].

So obviously one or both of those values are also being determined by Soldier[63]. That'll make them easier to find in UnitRef.

Remember that a soldier is a soldier whether he's in armor or out of it. His armor does change the way he appears, and a few other things, but he's still a soldier at the end of the day. That said, a mod could easily be made that turns units wearing certain (hacked) armor types into aliens when combat begins, hence allowing you to easily deploy them at will. But there's no way it can be done just by tweaking values in save files, I'm afraid.

- Bomb Bloke 14:45, 6 November 2006 (PST)

Base Reference

As I was tinkering around with some files, namely for my Python XCOM 'editor' I noticed that on some of my soldiers the base reference was set to a crash site in loc.dat. So I'm thinking it got mislabled as a base referense when it should be a current location reference.

I haven't completely verified this yet, but just wanted to throw it out there. -Pi Masta 20:13, 6 February 2007 (PST)

Book of the Dead

So after reading this excellent XCOM thread I was reminded I'd like to have some way of logging the names of who actually died in a mission. You forget the rookies so quickly...and there's all those letters to write. After a while you even forget your heroes, custom names or no. This would keep track of the names for the memorial.

I can see one way of doing this would be to just compare SOLDIER.DAT (or UNITREF.DAT) in two different saved games, pull out the names of the dead soldiers (along with rank, missions, kills info), and append it to a text file. Is a record in SOLDIER.DAT changed when the soldier dies, or what's the best way to determine who has died? Any advice from the experts? I see a bit in UNITREF.DAT but that's only for Battlescape saves, right?

Maybe later this could be linked to the DOS game's batch file, so every transition between Battlescape and Geoscape updates the Book of the Dead. --JellyfishGreen 08:47, 7 May 2008 (PDT)