Difference between revisions of "OBDATA.DAT"

From UFOpaedia
Jump to navigation Jump to search
m (added See Also links)
(→‎Structure: Some new info, described some fields to better match game.)
 
(28 intermediate revisions by 12 users not shown)
Line 1: Line 1:
== General Notes ==
+
'''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]].
OBDATA.DAT is found in GEODATA and contains general information on objects found in the game. It is static information on the general properties of objects; to hack dynamic Battlescope info on e.g. the number of rounds left in a particular clip, see [[OBPOS.DAT]].
 
  
There are 80 entries, each of which are 54 bytes long. It is 4,320 bytes long.  It's line width is 54.
+
There are 80 records, each of which are 54 bytes long (a total of 4,320 bytes).
  
The order of objects in this file is also equal to their offset OBDATA reference number. For example, the first record (OBDATA 0) is the pistol, second record (OBDATA 1) is pistol clip, etc.
+
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).
  
There are 33 entries are for corpses, which includes 4 entries (quarters) for large corpses, including tanks. Otherwise there are 41 "object" entries, and 6 obsolete/unused entries.
+
Values are presented in <b>bold</b>, according to the offsets in each record (0 to 53).
  
Values are presented according to offset (0 to 53) in <b>bold</b>.
+
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.
  
Note: If you hack OBDATA to do combatscape testing, you do not need to reload the whole game, at least not for DOS X-COM. The DOS version has a separate executable (TACTICAL.EXE) that loads all data again. The WinCE version may need to be entirely reloaded.
+
== Structure ==
  
== Structure ==
+
<b>0-19[0x0~0x13]:</b> 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. Names and IDs (reference lookup numbers, including within OBDATA - see e.g. [26] to [28]):
 +
 
 +
{| {{StdDescTable}}
 +
|- {{StdDescTable_Heading}}
 +
! Index !! Object !! Index !! Object !! Index !! Object
 +
|-
 +
| <b>00/x00</b> || PISTOL || <b>27/x1B</b> || Flare || <b>54/x36</b> || Floater Corpse
 +
|-
 +
| <b>01/x01</b> || PISTOL CLIP || <b>28/x1C</b> || empty || <b>55/x37</b> || Celatid Corpse
 +
|-
 +
| <b>02/x02</b> || RIFLE || <b>29/x1D</b> || empty || <b>56/x38</b> || Silacoid Corpse
 +
|-
 +
| <b>03/x03</b> || RIFLE CLIP || <b>30/x1E</b> || empty || <b>57/x39</b> || Chryssalid Corpse
 +
|-
 +
| <b>04/x04</b> || HEAVY CANNON || <b>31/x1F</b> || CORPSE || <b>58/x3A</b> || reaper corpse 1
 +
|-
 +
| <b>05/x05</b> || CANNON AP-AMMO || <b>32/x20</b> || CORPSE & ARMOUR || <b>59/x3B</b> || reaper corpse 2
 +
|-
 +
| <b>06/x06</b> || CANNON HE-AMMO || <b>33/x21</b> || CORPSE & POWER SUIT || <b>60/x3C</b> || reaper corpse 3
 +
|-
 +
| <b>07/x07</b> || CANNON I-AMMO || <b>34/x22</b> || Heavy Plasma || <b>61/x3D</b> || reaper corpse 4
 +
|-
 +
| <b>08/x08</b> || AUTO-CANNON || <b>35/x23</b> || Heavy Plasma Clip || <b>62/x3E</b> || cyber 1
 +
|-
 +
| <b>09/x09</b> || AUTO-CANNON AP-AMMO || <b>36/x24</b> || Plasma Rifle || <b>63/x3F</b> || cyber 2
 +
|-
 +
| <b>10/x0A</b> || AUTO-CANNON HE-AMMO || <b>37/x25</b> || Plasma Rifle Clip || <b>64/x40</b> || cyber 3
 +
|-
 +
| <b>11/x0B</b> || AUTO-CANNON I-AMMO || <b>38/x26</b> || Plasma Pistol || <b>65/x41</b> || cyber 4
 +
|-
 +
| <b>12/x0C</b> || ROCKET LAUNCHER || <b>39/x27</b> || Plasma Pistol Clip || <b>66/x42</b> || secto 1
 +
|-
 +
| <b>13/x0D</b> || SMALL ROCKET || <b>40/x28</b> || BLASTER LAUNCHER || <b>67/x43</b> || secto 2
 +
|-
 +
| <b>14/x0E</b> || LARGE ROCKET || <b>41/x29</b> || BLASTER BOMB || <b>68/x44</b> || secto 3
 +
|-
 +
| <b>15/x0F</b> || INCENDIARY ROCKET || <b>42/x2A</b> || SMALL LAUNCHER || <b>69/x45</b> || secto 4
 +
|-
 +
| <b>16/x10</b> || LASER PISTOL || <b>43/x2B</b> || STUN MISSILE || <b>70/x46</b> || hover 1
 +
|-
 +
| <b>17/x11</b> || LASER GUN || <b>44/x2C</b> || ALIEN GRENADE || <b>71/x47</b> || hover 2
 +
|-
 +
| <b>18/x12</b> || HEAVY LASER || <b>45/x2D</b> || ELERIUM-115 || <b>72/x48</b> || hover 3
 +
|-
 +
| <b>19/x13</b> || GRENADE || <b>46/x2E</b> || MIND PROBE || <b>73/x49</b> || hover 4
 +
|-
 +
| <b>20/x14</b> || SMOKE GRENADE || <b>47/x2F</b> || >>UNDEFINED << || <b>74/x4A</b> || TANK1
 +
|-
 +
| <b>21/x15</b> || PROXIMITY GRENADE || <b>48/x30</b> || >> empty << || <b>75/x4B</b> || TANK 2
 +
|-
 +
| <b>22/x16</b> || HIGH EXPLOSIVE || <b>49/x31</b> || >> empty << || <b>76/x4C</b> || TANK 3
 +
|-
 +
| <b>23/x17</b> || MOTION SCANNER || <b>50/x32</b> || Sectoid Corpse || <b>77/x4D</b> || TANK 4
 +
|-
 +
| <b>24/x18</b> || MEDI-KIT || <b>51/x33</b> || Snakeman Corpse || <b>78/x4E</b> || CIVM
 +
|-
 +
| <b>25/x19</b> || PSI-AMP || <b>52/x34</b> || Ethereal Corpse || <b>79/x4F</b> || CIVF
 +
|-
 +
| <b>26/x1A</b> || STUN ROD || <b>53/x35</b> || Muton Corpse || ||
 +
|}
  
<b>0-19:</b> 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. Names and IDs (reference lookup numbers, including within OBDATA - see e.g. [26] to [28]):
+
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]].
  <u>ID</u>  <u>Name</u>                            <u>ID</u>  <u>Name</u>
 
    0  PISTOL                          40  BLASTER LAUNCHER
 
    1  PISTOL CLIP                    41  BLASTER BOMB
 
    2  RIFLE                          42  SMALL LAUNCHER
 
    3  RIFLE CLIP                      43  STUN MISSILE
 
    4  HEAVY CANNON                    44  ALIEN GRENADE
 
    5  CANNON AP-AMMO                  45  ELERIUM-115
 
    6  CANNON HE-AMMO                  46  MIND PROBE
 
    7  CANNON I-AMMO                  47  >>UNDEFINED <<
 
    8  AUTO-CANNON                    48  >> empty <<
 
    9  AUTO-CANNON AP-AMMO            49  >> empty <<
 
  10  AUTO-CANNON HE-AMMO            50  Sectoid Corpse
 
  11  AUTO-CANNON I-AMMO              51  Snakeman Corpse
 
  12  ROCKET LAUNCHER                52  Ethereal Corpse
 
  13  SMALL ROCKET                    53  Muton Corpse
 
  14  LARGE ROCKET                    54  Floater Corpse
 
  15  INCENDIARY ROCKET              55  Celatid Corpse
 
  16  LASER PISTOL                    56  Silacoid Corpse
 
  17  LASER GUN                      57  Chryssalid Corpse
 
  18  HEAVY LASER                    58  reaper corpse 1
 
  19  GRENADE                        59  reaper corpse 2
 
  20  SMOKE GRENADE                  60  reaper corpse 3
 
  21  PROXIMITY GRENADE              61  reaper corpse 4
 
  22  HIGH EXPLOSIVE                  62  cyber 1
 
  23  MOTION SCANNER                  63  cyber 2
 
  24  MEDI-KIT                        64  cyber 3
 
  25  PSI-AMP                        65  cyber 4
 
  26  STUN ROD                        66  secto 1
 
  27  Flare                          67  secto 2
 
  28  empty                          68  secto 3
 
  29  empty                          69  secto 4
 
  30  empty                          70  hover 1
 
  31  CORPSE                          71  hover 2
 
  32  CORPSE & ARMOUR                72  hover 3
 
  33  CORPSE & POWER SUIT            73  hover 4
 
  34  Heavy Plasma                    74  TANK1
 
  35  Heavy Plasma Clip              75  TANK 2
 
  36  Plasma Rifle                    76  TANK 3
 
  37  Plasma Rifle Clip              77  TANK 4
 
  38  Plasma Pistol                  78  CIVM
 
  39  Plasma Pistol Clip              79  CIVF
 
  
<i>The names as displayed in battle are stored in [[ENGLISH2.DAT]], [[FRENCH2.DAT]] and [[GERMAN2.DAT]], hence allowing them to appear in multiple languages. However, I can't find how the OBDATA.DAT records are linked to these external records - It isn't a direct mapping, as the order differs in parts. Most likely the matter is handled in the executable, but this might make adding extra items tricky. - [[User:Bomb Bloke|Bomb Bloke]] 03:40, 11 September 2006 (PDT)</i>
+
'''20[0x14]:''' [[BIGOBS.PCK]] reference (pointer to graphic for inventory)
  
'''20:''' [[BIGOBS.PCK]] reference (pointer to graphic for inventory)
+
'''21[0x15]:''' [[FLOOROB.PCK]] reference (pointer to graphic for item on ground)
  
'''21:''' [[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).
  
'''22:''' Average Weapon Strength (Same as seen in UFOpaedia). For clip weapons, this applies to the clip, ''not'' the weapon itself. Also note that, if set to 0, the weapon will still "shoot" and the hit will "hit" (assuming it didn't miss) and register with the hit counter, [[UNITREF.DAT]][81]. So this is 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 [[Explosions#Playing_With_Fire|this]]. It includes what happens if you change the Stun Bomb to HE.
 
For information on hacking explosives vs. their blast diameters and strength, see [[Explosions#Playing_With_Fire|this]]. It includes what happens if you change the Stun Bomb to HE.
  
'''23:''' Item Weight? See [43] - could one be thrown weight, and the other inventory weight?
+
'''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:''' Inventory X Size (width)
+
'''24[0x18]:''' Inventory X Size (width)
  
'''25:''' Inventory Y Size (height)
+
'''25[0x19]:''' Inventory Y Size (height)
  
'''26-28:''' Look-up within OBDATA for ammo this weapon uses. Up to three types possible; 255 for no (more) ammo. Note that ammo always directly follows its weapon in this file.
+
'''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 always directly follows its weapon in this file.
  
'''29:''' [[HANDOB.PCK]] reference (pointer to graphic for battlescape)
+
'''29[0x1D]:''' [[HANDOB.PCK]] Image of item when held in a units's hands in the battlescape view.
  
'''30:''' Same as 29
+
'''30[0x1E]:''' Often corresponds to 29, but does not appear to be used. Called "graphics type firing" by the game. Is this the shot graphic to use for the weapon?
  
<i>In a few instances, [29] is different to [30]. [30] is most likely the correct offset to use. - [[User:Bomb Bloke|Bomb Bloke]] 03:40, 11 September 2006 (PDT)</i>
+
'''31[0x1F]:''' Ammo Damage Type
 
 
'''31:''' Ammo Damage Type
 
 
   0 AP
 
   0 AP
 
   1 IN
 
   1 IN
Line 92: Line 107:
 
  255 ''Not Ammo''
 
  255 ''Not Ammo''
  
'''32:''' Accuracy, Auto
+
'''32[0x20]:''' Accuracy, Auto
  
'''33:''' Accuracy, Snap
+
'''33[0x21]:''' Accuracy, Snap
  
'''34:''' Accuracy, Aimed
+
'''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.''
 
''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.''
Line 102: Line 117:
 
''Don't set Percent TUs to 0. If you do, the object is no longer considered a weapon, and can only be thrown.''
 
''Don't set Percent TUs to 0. If you do, the object is no longer considered a weapon, and can only be thrown.''
  
'''35:''' Percent TUs Used, Auto
+
'''35[0x23]:''' Percent TUs Used, Auto
  
'''36:''' Percent TUs Used, Snap
+
'''36[0x24]:''' Percent TUs Used, Snap
  
'''37:''' Percent TUs Used, Aimed
+
'''37[0x25]:''' Percent TUs Used, Aimed
  
'''38:''' Primary use: Clip Size (for ammo; see [49]). Secondary use: Melee weapon strength, as follows:
+
'''38[0x26]:''' Primary use: Clip Size (for ammo; see [49]). Secondary use: Melee weapon strength, as follows:
  
 
   0 All Corpses/Electroflare/Mind probe
 
   0 All Corpses/Electroflare/Mind probe
Line 114: Line 129:
 
   65 Stun Rod
 
   65 Stun Rod
 
   10 ''Everything else...''
 
   10 ''Everything else...''
Tertiary use: Timer for "grenade", if Grenade ([44]) is true. Only works if item is ammo ([49]). If it is then e.g. since Blaster has a 1 here (1 bomb per blaster "clip"), it will explode at end of turn 1 (if not being held in inventory).
+
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:''' Possibly Melee-related Stat??
+
'''39[0x27]:''' Melee damage type
  0 All Corpses
 
  0 Plasma Pistol Clip
 
  5 Stun Rod
 
  9 Pistol and Pistol Clip
 
  8 ''Everything else...''
 
 
 
''NKF:'' Melee damage type?
 
 
   0 AP
 
   0 AP
 
   1 IN
 
   1 IN
Line 131: Line 139:
 
   5 Stun
 
   5 Stun
 
   6 TFTD vibroblade damage (does not appear to be used in UFO)
 
   6 TFTD vibroblade damage (does not appear to be used in UFO)
 +
  7 TFTD Electric damage (Bio Drone?)
  
'''40:''' Possibly Melee Accuracy?? Zombie [http://www.strategycore.co.uk/forums/index.php?showtopic=746&st=178# 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%. Has anyone tried editing this value with hacked melee weapons?
+
'''40[0x28]:''' Melee Accuracy. Zombie [http://www.strategycore.co.uk/forums/topic/746-damage-modifiers-for-aliens/page__st__160#entry70596 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 All Corpses
 
   0 Electroflare
 
   0 Electroflare
Line 138: Line 147:
 
  100 ''Everything else...''
 
  100 ''Everything else...''
  
'''41:''' Melee TU%
+
'''41[0x29]:''' TU% cost when attacking as a melee weapon
 +
  50 Most objects
 +
  30 Stun rod
 +
  40 TFTD thermal tazer
 +
  10 Vibroblade
 +
  15 Thermal lance
 +
  20 Heavy thermal Lance
 
   0 All Corpses
 
   0 All Corpses
 
   0 Electroflare
 
   0 Electroflare
 
   0 Plasma Weapon Clips
 
   0 Plasma Weapon Clips
  30 Stun Rod
 
  50 ''Everything else...''
 
 
''NKF:'' TU% when attacking as a melee weapon:
 
  50 Most objects
 
  30 Stun rod
 
  40 TFTD thermal tazer
 
  15 Vibroblade
 
  20 Thermal lance
 
  25 Heavy thermal Lance
 
  
 
So a summary of 39 to 41 looks like this:
 
So a summary of 39 to 41 looks like this:
Line 163: Line 168:
 
     8  100  50  ''Everything else...'' (34 objects)
 
     8  100  50  ''Everything else...'' (34 objects)
  
'''42:''' Explosive strength needed to [[Explosions#Object_Destruction|destroy object]]
+
'''42[0x2A]:''' Explosive strength needed to [[Explosions#Object_Destruction|destroy object]]. AKA "Constitution".
 +
 
 +
'''43[0x2B]:''' [[Item Weight]], used for both throwing and encumbrance purposes.
 +
 
 +
'''44[0x2C]:''' Grenade Type
 +
1  Standard explosive grenade
 +
2  Proximity Grenade
 +
3  Smoke Grenade
 +
4-7 Gas - probably unused.
 +
 
 +
'''45[0x2D]:''' Value (or "priority") to the AI of picking up this weapon. 
 +
 
 +
This field used as AI "worth to take" estimation flag, and only when it's >5. By accident or by design, it was not implemented. However this can be easily implemented by setting values above 5. This would have the benefit of making Aliens smarter after they lose their weapons or run out of ammo. See the talk section of this page: [[Talk:OBDATA.DAT#Field_0x2D_.2845.29]]
 +
 
 +
'''46[0x2E]:''' Boolean: Is Weapon That Shoots? (AKA Is Ranged Weapon)?
 +
 
 +
'''47[0x2F]:''' Boolean: Is Weapon? (AKA Close Combat Weapon)?
 +
 
 +
'''48[0x30]:''' Boolean: Is Non-Waypoint Weapon? (AKA Is Ranged Combat Weapon)?
 +
 
 +
'''49[0x31]:''' Boolean: Is Ammo?
 +
 
 +
'''50[0x32]:''' Boolean: Is Two-Handed Weapon? (AKA Is Large Weapon/Object)?
 +
 
 +
'''51[0x33]:''' Boolean: Is Blaster Launcher? (AKA Weapon Fires Guided Missile)?
 +
 
 +
'''52[0x34]:''' Boolean: Is Alien? (AKA Is Alien Artefact)?
 +
 
 +
'''53[0x35]:''' [[Scoring]] points (except for Elerium which works per 50 units). (AKA Victory Points for recovery).
 +
 
 +
==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).
 +
 
 +
 
  
'''43:''' [[Item Weight]]
+
===Laser Weapons===
  
'''44:''' Grenade Type
+
Laser weapons use no clips, but can still be fired. To give similar properties to other weapons 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.
1  Grenade, Alien Grenade, High Explosive
 
2  Proximity Grenade
 
3  Smoke Grenade
 
  
'''45:''' Maybe an abandoned bit field, all except the Elerium tick?:
 
  
0 All corpses and many human objects, including weapons and ammo
+
===Grenades===
1 All alien weapons and ammo but also several common human ammos and the pistol
 
4 Elerium
 
  
'''46:''' Boolean: Is Weapon That Shoots?
+
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.
  
'''47:''' Boolean: Is Weapon?
+
Be aware that regardless of the damage type entered, it will default to HE.
  
'''48:''' Boolean: Is Non-Waypoint Weapon?
+
Any object that's not functioning as a gun or as ammo can be turned into a grenade of some description.
  
'''49:''' Boolean: Is Ammo?
+
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].
  
'''50:''' Boolean: Is Two-Handed Weapon?
+
One practical application of this is to create exploding elerium pods that will explode after a pre-set number of turns. For example, setting offset[38] to 40, and by the time you reach turn 20, any elerium pods that have not been destroyed or picked up will explode. Set the damage to strength to something insignificant like 1 to let them wink out of existence, or up to 255 for violent explosions.
  
'''51:''' Boolean: Is Blaster Launcher?
+
===Guided Weapons===
  
'''52:''' Boolean: Is Alien?
+
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.
  
'''53:''' [[Scoring (UFO Defense)|Scoring]] points (except for Elerium which works per 50 units)
+
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==
 
==See Also==
Line 201: Line 249:
 
* [[GEODATA]] - Parent Folder for file
 
* [[GEODATA]] - Parent Folder for file
 
* [[Saved Game Files]]
 
* [[Saved Game Files]]
 +
[[Category:Game Files]]
 +
[[Category:Enemy Unknown/UFO Defense]]

Latest revision as of 04:52, 18 June 2015

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. Names and IDs (reference lookup numbers, including within OBDATA - see e.g. [26] to [28]):

Index Object Index Object Index Object
00/x00 PISTOL 27/x1B Flare 54/x36 Floater Corpse
01/x01 PISTOL CLIP 28/x1C empty 55/x37 Celatid Corpse
02/x02 RIFLE 29/x1D empty 56/x38 Silacoid Corpse
03/x03 RIFLE CLIP 30/x1E empty 57/x39 Chryssalid Corpse
04/x04 HEAVY CANNON 31/x1F CORPSE 58/x3A reaper corpse 1
05/x05 CANNON AP-AMMO 32/x20 CORPSE & ARMOUR 59/x3B reaper corpse 2
06/x06 CANNON HE-AMMO 33/x21 CORPSE & POWER SUIT 60/x3C reaper corpse 3
07/x07 CANNON I-AMMO 34/x22 Heavy Plasma 61/x3D reaper corpse 4
08/x08 AUTO-CANNON 35/x23 Heavy Plasma Clip 62/x3E cyber 1
09/x09 AUTO-CANNON AP-AMMO 36/x24 Plasma Rifle 63/x3F cyber 2
10/x0A AUTO-CANNON HE-AMMO 37/x25 Plasma Rifle Clip 64/x40 cyber 3
11/x0B AUTO-CANNON I-AMMO 38/x26 Plasma Pistol 65/x41 cyber 4
12/x0C ROCKET LAUNCHER 39/x27 Plasma Pistol Clip 66/x42 secto 1
13/x0D SMALL ROCKET 40/x28 BLASTER LAUNCHER 67/x43 secto 2
14/x0E LARGE ROCKET 41/x29 BLASTER BOMB 68/x44 secto 3
15/x0F INCENDIARY ROCKET 42/x2A SMALL LAUNCHER 69/x45 secto 4
16/x10 LASER PISTOL 43/x2B STUN MISSILE 70/x46 hover 1
17/x11 LASER GUN 44/x2C ALIEN GRENADE 71/x47 hover 2
18/x12 HEAVY LASER 45/x2D ELERIUM-115 72/x48 hover 3
19/x13 GRENADE 46/x2E MIND PROBE 73/x49 hover 4
20/x14 SMOKE GRENADE 47/x2F >>UNDEFINED << 74/x4A TANK1
21/x15 PROXIMITY GRENADE 48/x30 >> empty << 75/x4B TANK 2
22/x16 HIGH EXPLOSIVE 49/x31 >> empty << 76/x4C TANK 3
23/x17 MOTION SCANNER 50/x32 Sectoid Corpse 77/x4D TANK 4
24/x18 MEDI-KIT 51/x33 Snakeman Corpse 78/x4E CIVM
25/x19 PSI-AMP 52/x34 Ethereal Corpse 79/x4F CIVF
26/x1A STUN ROD 53/x35 Muton 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 always directly 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. Called "graphics type firing" by the game. Is this the shot graphic to use for the weapon?

31[0x1F]: Ammo Damage Type

  0 AP
  1 IN
  2 HE
  3 Laser
  4 Plasma
  5 Stun
  6 Melee
  7 Acid Spit (from Celatid)
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 Pistol
 65 Stun Rod
 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 Laser or Gauss
  4 Plasma or Sonic
  5 Stun
  6 TFTD vibroblade damage (does not appear to be used in UFO)
  7 TFTD Electric damage (Bio Drone?)

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 Electroflare
  0 Plasma Weapon Clips
100 Everything else...

41[0x29]: TU% cost when attacking as a melee weapon

 50 Most objects
 30 Stun rod
 40 TFTD thermal tazer
 10 Vibroblade
 15 Thermal lance
 20 Heavy thermal Lance
  0 All Corpses
  0 Electroflare
  0 Plasma Weapon Clips

So a summary of 39 to 41 looks like this:

  39   40   41   Objects
   0    0    0   All Corpses/Plasma Pistol Clip
   5  100   30   Stun Rod
   8    0    0   Plasma Rifle Clip/Heavy Plasma Clip/Electroflare
   9  100   50   Pistol/Pistol Clip

   8  100   50   Everything else... (34 objects)

42[0x2A]: Explosive strength needed to destroy object. AKA "Constitution".

43[0x2B]: Item Weight, used for both throwing and encumbrance purposes.

44[0x2C]: Grenade Type

1   Standard explosive grenade
2   Proximity Grenade
3   Smoke Grenade
4-7 Gas - probably unused.

45[0x2D]: Value (or "priority") to the AI of picking up this weapon.

This field used as AI "worth to take" estimation flag, and only when it's >5. By accident or by design, it was not implemented. However this can be easily implemented by setting values above 5. This would have the benefit of making Aliens smarter after they lose their weapons or run out of ammo. See the talk section of this page: Talk:OBDATA.DAT#Field_0x2D_.2845.29

46[0x2E]: Boolean: Is Weapon That Shoots? (AKA Is Ranged Weapon)?

47[0x2F]: Boolean: Is Weapon? (AKA Close Combat Weapon)?

48[0x30]: Boolean: Is Non-Waypoint Weapon? (AKA Is Ranged Combat Weapon)?

49[0x31]: Boolean: Is Ammo?

50[0x32]: Boolean: Is Two-Handed Weapon? (AKA Is Large Weapon/Object)?

51[0x33]: Boolean: Is Blaster Launcher? (AKA Weapon Fires Guided Missile)?

52[0x34]: Boolean: Is Alien? (AKA Is Alien Artefact)?

53[0x35]: Scoring points (except for Elerium which works per 50 units). (AKA Victory Points for recovery).

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).


Laser Weapons

Laser weapons use no clips, but can still be fired. To give similar properties to other weapons 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].

One practical application of this is to create exploding elerium pods that will explode after a pre-set number of turns. For example, setting offset[38] to 40, and by the time you reach turn 20, any elerium pods that have not been destroyed or picked up will explode. Set the damage to strength to something insignificant like 1 to let them wink out of existence, or up to 255 for violent explosions.

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