OBDATA.DAT (TFTD)
OBDATA.DAT is found in GEODATA and contains general information on objects found in the game, such as their accuracy and weight. It also contains template information regarding clip size; to hack dynamic Battlescape info on the number of rounds left in a particular item in play (or it's location etc), see OBPOS.DAT.
There are 80 records, each of which are 54 bytes long (a total of 4,320 bytes).
There are 33 entries for corpses (or otherwise destroyed robots and vehicles), four per large unit, one per small unit. Furthermore there are 41 "object" entries (weapons etc) and 6 obsolete/unused entries (mostly unusable, and without valid name pointers in the executable).
Values are presented in bold, according to the offsets in each record (0 to 53).
Note: If you hack OBDATA, you can have the game reload the data by entering or exiting the battlescape mode. This is true for the DOS version of X-Com (which switches between executables at these points), but the WinCE version may need to be entirely restarted.
Structure
0-19[0x0~0x13]: Name of object. Delimited by a null character. These are internal names... they all make sense, but are not the standardized names displayed in the game. The strings shown below are not an exact match for the file - some contain typos or mixed case. See Talk page for exact strings, if it is important to match them exactly. Names and IDs (reference lookup numbers, including within OBDATA - see e.g. [26] to [28]):
Index | Object | Index | Object | Index | Object |
---|---|---|---|---|---|
00/x00 | DART PISTOL | 27/x1B | CHEMICAL FLARE | 54/x36 | Calcinite |
01/x01 | DART POD | 28/x1C | VIBROBLADE | 55/x37 | Deep One |
02/x02 | HARPOON GUN | 29/x1D | THERMAL LANCE | 56/x38 | Biodrone |
03/x03 | HARPOON POD | 30/x1E | HEAVY THERMAL LANCE | 57/x39 | Tentaculat |
04/x04 | GAS CANNON | 31/x1F | CORPSE | 58/x3A | Triscene 1 |
05/x05 | SOLID BOLT | 32/x20 | CORPSE & ARMOUR | 59/x3B | Triscene 2 |
06/x06 | EXPLOSIVE BOLT | 33/x21 | CORPSE & ION ARMOR | 60/x3C | Triscene 3 |
07/x07 | PHOSPHOROUS BOLT | 34/x22 | SONIC CANNON | 61/x3D | Triscene 4 |
08/x08 | HYDRO JET CANNON | 35/x23 | SONIC CANNON CLIP | 62/x3E | Xarquid 1 |
09/x09 | AP-SHELL | 36/x24 | SONIC RIFLE | 63/x3F | Xarquid 2 |
10/x0A | HE-SHELL | 37/x25 | SONIC RIFLE CLIP | 64/x40 | Xarquid 3 |
11/x0B | PHOSPHOROUS SHELL | 38/x26 | SONIC PISTOL | 65/x41 | Xarquid 4 |
12/x0C | AQUA-JET LAUNCHER | 39/x27 | SONIC PISTOL CLIP | 66/x42 | Hallucinoid 1 |
13/x0D | SMALL TORPEDO | 40/x28 | DISRUPTER LAUNCHER | 67/x43 | Hallucinoid 2 |
14/x0E | LARGE TORPEDO | 41/x29 | DISRUPTER BOMB | 68/x44 | Hallucinoid 3 |
15/x0F | PHOSPHOROUS TORPEDO | 42/x2A | THERMAL SHOK LAUNCHER | 69/x45 | Hallucinoid 4 |
16/x10 | GAUSS PISTOL | 43/x2B | SHOK BOMB | 70/x46 | Displacer 1 |
17/x11 | GAUSS RIFLE | 44/x2C | SONIC PULSER | 71/x47 | Displacer 2 |
18/x12 | HEAVY GAUSS CANNON | 45/x2D | ZRBITE | 72/x48 | Displacer 3 |
19/x13 | MAGNA-BLAST GRENADE | 46/x2E | M.C. READER | 73/x49 | Displacer 4 |
20/x14 | DYE GRENADE | 47/x2F | GAUSS PISTOL CLIP | 74/x4A | Coelecanth 1 |
21/x15 | PARTICLE GRENADE | 48/x30 | GAUSS RIFLE CLIP | 75/x4B | Coelecanth 2 |
22/x16 | MAGNA-PACK | 49/x31 | GAUSS CANNON CLIP | 76/x4C | Coelecanth 3 |
23/x17 | DISTURBANCE SENSOR | 50/x32 | Aquatoid Corpse | 77/x4D | Coelecanth 4 |
24/x18 | MEDI-KIT | 51/x33 | Gillman Corpse | 78/x4E | CIVM |
25/x19 | M.C. DISRUPTOR | 52/x34 | Lobsterman Corpse | 79/x4F | CIVF |
26/x1A | THERMAL TAZER | 53/x35 | Tasoth Corpse |
The names as displayed in battle are stored in ENGLISH2.DAT, FRENCH2.DAT and GERMAN2.DAT, hence allowing them to appear in multiple languages. The exact pointers as to which item has which name are stored in TACTICAL.EXE.
20[0x14]: BIGOBS.PCK reference (pointer to graphic for inventory)
21[0x15]: FLOOROB.PCK reference (pointer to graphic for item on ground)
22[0x16]: Average Weapon Strength (Same as seen in UFOpaedia). For clip based weapons, this applies to the clip and not the weapon itself. Also note that if set to 0 the weapon will still "shoot" and the shot can still "hit", registering with the hit counter at UNITREF.DAT[81] and making an easy way to avoid any damage while testing (if so desired).
Note that a (non-explosive) weapon will hit for between 0 and this*2 damage with each shot. For example, if you set it to 100, the weapon will deal between 0 and 200 points each time it is fired.
For information on hacking explosives vs. their blast diameters and strength, see this. It includes what happens if you change the Stun Bomb to HE.
23[0x17]: Display priority for when items are in a stack. The highest value here determines which will be rendered in the battlescape. In the case of a tie, the lowest ObPos record number wins.
24[0x18]: Inventory X Size (width)
25[0x19]: Inventory Y Size (height)
26-28[0x1A~1C]: Look-up within OBDATA for ammo this weapon uses. Up to three types possible; 255 for no (more) ammo. Note that ammo usually follows its weapon in this file.
29[0x1D]: HANDOB.PCK Image of item when held in a units's hands in the battlescape view.
30[0x1E]: Often corresponds to 29, but does not appear to be used.
31[0x1F]: Ammo Damage Type
0 AP 1 IN 2 HE 3 Gauss 4 Sonic 5 Stun 6 Melee 7 Electric Blast (from Bio-Drone) 255 Not Ammo
32[0x20]: Accuracy, Auto
33[0x21]: Accuracy, Snap
34[0x22]: Accuracy, Aimed
Percent TUs are rounded down (truncated). In an extreme case, if you hack UNITREF.DAT[25] (Base TUs) to 199 and Percent TUs to 1, you will need 1 TU to fire the weapon (and can make 199 shots per turn). Or to really make things interesting, set Base TUs to 99 and Percent TUs to 1 - now it takes zero TUs! Also, it relies on Base TUs, not current TUs, so if you e.g. put Base TUs at 99, Percent TUs at 1 (0 TUs per shot), and Current TUs at 255, you still get 255 TUs, with 0 TUs per shot, for the turn you load that savegame - excellent if you plan on reloading it for each round of testing.
Don't set Percent TUs to 0. If you do, the object is no longer considered a weapon, and can only be thrown.
35[0x23]: Percent TUs Used, Auto
36[0x24]: Percent TUs Used, Snap
37[0x25]: Percent TUs Used, Aimed
38[0x26]: Primary use: Clip Size (for ammo; see [49]). Secondary use: Melee weapon strength, as follows:
0 All Corpses/Electroflare/Mind probe 8 Dart Gun 65 Thermal Tazer 10 Everything else...
Tertiary use: Turn detonation condition for "grenade" objects, but is otherwise unused. If the Grenade ([44]) and the 'is ammo?' ([49]) fields are set to true, this will create an explosive that is pre-armed to go off at a turn designated by this field. A side effect is that the grenade object will show an ammo count with this field's value.
39[0x27]: Melee damage type
0 AP 1 IN 2 HE 3 Gauss 4 Sonic 5 Freeze (Stun) 6 Melee damage (does not appear to be used in UFO) 7 TFTD Electric damage (Deep One)
40[0x28]: Melee Accuracy. Zombie found that changing this does not change the Stun Rod's 100% accuracy (nor does changing soldier Melee Accuracy). Thus the Stun Rod appears to be hard-wired to 100% for UFO, but in TFTD it is a valid and effective variable. (TFTD uses much more melee than UFO.)
0 All Corpses 0 Chemical flare 0 Sonic Weapon Clips 100 Everything else...
41[0x29]: TU% cost when attacking as a melee weapon
60 Magna pack 50 Most objects 40 TFTD thermal tazer 10 Vibroblade 15 Thermal lance 20 Heavy thermal Lance 0 All Corpses 0 Chemical flare 0 Sonic Weapon Clips
So a summary of 39 to 41 looks like this:
39 40 41 Objects 0 0 0 All Corpses/Sonic Pistol Clip 5 100 30 Thermal Tazer 8 0 0 Sonic Rifle Clip/Sonic Cannon Clip/Chemical flare 9 100 50 Dart Gun/Dart Pod 8 100 50 Everything else... (34 objects)
42[0x2A]: Explosive strength needed to destroy object.
43[0x2B]: Item Weight, used for both throwing and encumbrance purposes.
44[0x2C]: Grenade Type
1 Standard explosive grenade 2 Disturbance Grenade 3 Dye Grenade
45[0x2D]: Alien AI weighting to pick up / go get object, if it is useful:
0 All corpses and many human objects, including weapons and ammo 1 All alien weapons and ammo but also several common human ammos and the pistol 4 Zrbite
This field used as AI "worth to take" estimation flag, and only when it's >5. Probably if +5 was added to all values, it would work as the designers intended? (until they changed their minds that is!)
46[0x2E]: Boolean: Is a Ranged Weapon?
47[0x2F]: Boolean: Is Melee Weapon?
48[0x30]: Boolean: Is Non-Waypoint Weapon?
49[0x31]: Boolean: Is Ammo?
50[0x32]: Boolean: Is Two-Handed Weapon?
51[0x33]: Boolean: Is Blaster Launcher?
52[0x34]: Boolean: Is Alien?
53[0x35]: Scoring points (except for Zrbite which works per 50 units).
Extra Notes
Unique Objects
Certain unique objects have "unique" features that are assigned to them. These are:
- Motion Scanner - can access motion scanner panel
- Medikit - brings up medikit panel
- Flare - will cast light around its object if on ground whenever the light level of the map is updated, such as when throwing a flare or when walking.
- Stun Rod - only weapon that can access its melee attack
- Mind Probe - can probe enemies
- Psi Amp - can access two different psi attacks
- Elerium - adds 50 units of elerium to storage at end of battle
TFTD's equivalents are same but also add the three drill weapons as melee weapons.
These properties are not configured in obdata.dat, but are instead defined by the game executable. Copying the stun rod info to a different record number results in an item which can't be used to zap things.
One way around the melee command limitation is to stack two or more items in your soldiers hands (via hacking) - The action menu will then display a combination of both items abilities. This allows you to bludgeon things with a plasma rifle (for example).
Unlimited Ammo Weapons
Laser weapons in UFO Enemy Unknown use no clips, but can still be fired. To give similar properties to weapons in TFTD you must remove their ammo type indexes (set offsets [26]-[28] to 255), give the weapon a valid damage type (set offset [31] to a value from 0-7), and give the weapon a power rating (set offset [22] to the average you want the weapon to deal). All the usual flags for standard firearms apply.
Grenades
Grenades are similar to laser weapons in that the object's power (offset[22]) and damage type (offset[31]) must be set. In addition, to complete the object as a grenade, the Grenade type (offset[44]) must also be set to standard (1), proximity (2) or smoke (3) in order for the item to be turned into an object that can be primed.
Be aware that regardless of the damage type entered, it will default to HE.
Any object that's not functioning as a gun or as ammo can be turned into a grenade of some description.
Note that if you set the Is Ammo? (offset[49]) field to true, the grenade will be pre-armed at the start of the battle to explode after the turn specified in offset[38], which is normally used for ammo count or melee attack strength. The grenade will also gain an ammo-count display on it with the value in offset[38].
Guided Weapons
The flag in Offset[51] controls whether the object fires a way-point guided projectile. Projectiles fired by this weapon will also default to HE damage.
Once set, the flag overrides various obdata.dat settings. Firing costs will default to 60% while the accuracy of the projectile will not be influenced by the user's base accuracy.
See Also
- OBPOS.DAT - Stores positions of objects in a battlescape
- PRODUCT.DAT - Stores information on manufactuable items (Hours, Cost, etc.)
- PURCHASE.DAT - Stores buying and selling Information about most of these items
- UP.DAT - References items in this file for the UFOpaedia
- GEODATA - Parent Folder for file
- Saved Game Files