EFF file format

Applies to:
BG1: TotS, BG2, BG2: ToB, IWD, IWD:HoW, IWD:TotL, BGEE

General Description
This file format describes an effect (opcode) and its parameters. The format is an extended version of that found embedded in creatures, items and spells, and is a replacement for the version 1 embedded effects used in BG1. The engine appears to roll a probability for each valid target type, rather than one probability per attack.

Overall structure:


Offset Size (datatype) Description
0x0000 4 (char array)

Signature (‘EFF ‘)

0x0004 4 (char array)

Version (‘V2.0’)



When an effect is called via an eff, several of the fields (including duration and timing mode) are overriden by the calling SPL/ITM. Other fields are copied directly from the calling SPL/ITEM and overwrite the values defined in the EFF.

Offset Size (datatype) Description
0x0008 4 (char array)

External EFFs - the field is the same as the signature field from the header
Embedded EFFs - this field is zeroed out

0x000c 4 (char array)

External EFFs - the field is the same as the version field from the header
Embedded EFFs - this field is zeroed out

0x0010 4 (dword)

Opcode number

0x0014 4 (dword)

Target type

Note:
0x0018 4 (dword)

Power

0x001c 4 (dword)

Parameter 1

0x0020 4 (dword)

Parameter 2

0x0024 2 (word)

Timing mode

Note: If called via opcode #177/opcode #183/opcode #283, this field is ignored.
0x0028 4 (dword)

Duration

  • This field is measured in seconds or ticks (115 second), depending on Timing mode.
Note: If called via opcode #177/opcode #183/opcode #283, this field is ignored.
0x002c 2 (word)

Probability 1

Note: If called via opcode #183, this field is ignored.
0x002e 2 (word)

Probability 2

Info: See here for further details.
Note: If called via opcode #183, this field is ignored.
0x0030 8 (resref)

Resource

0x0038 4 (dword)

Dice Thrown

0x003c 4 (dword)

Dice Sides

0x0040 4 (dword)

Saving throw type

Info: See here for further details.
Note: If called via opcode #183, this field is ignored.
0x0044 4 (dword)

Save bonus

Note: If called via opcode #183, this field is ignored.
0x0048 4 (dword)

Special (EE games)

TobEx: Stacking ID. Checked when bit 25 of the Saving Throw Type is set.

If two effects of the same opcode are applied, both have Limit Effect Stacking bit set, and both have the same stacking ID, then the latter applied effect is suspended in application until the former effect expires. Regardless of whether it is applied, the latter effect will expire at the same time that it would expire if it was applied. In other words, the total duration of some non-stacking effect opcode is not extended because more than one copy of the effect was applied.

Stacking IDs are unique to the opcode being applied. To maintain uniqueness of stacking IDs between different mods, one recommendation is to use the higher word of Special as the modder’s Infinity Engine Community Prefix, then use the lower word as an identifying ID. For example, 0x41360001 (‘A6’ 0x0001).

0x004c 4 (dword)

Primary Type (School)

0x005c 4 (dword)

Dispel/Resistance

The default behaviour is that effects cannot be dispelled and ignore resistance.

  • bit 0 ⟶ Dispel
    • Can be dispelled, affected by Magic Resistance.
  • bit 1 ⟶ Bypass resistance
    • Ignores Magic Resistance.
  • bit 2 ⟶ Bypasses deflection/reflection/trap opcodes (only in EE games patched to v2.0+).
  • bit 3 ⟶ Self-targeted (only in EE games patched to v2.6+)
    • Targeting yourself with an ability (Extended Header) will internally set this bit on all effects applied by that ability.
      • For the caster, it will allow a Magic Resistance check for any effect that has both Dispel set and offers some saving throw.
        • The saving throw doesn’t have to succeed, it just has to be offered.
      • For anyone else hit by the ability, it will allow a Magic Resistance check for any effect that also has Dispel set.
    • Either way, this bit is still overridden by Bypass Resistance.
    • This feature should eliminate the bug/exploit of bypassing other’s Magic Resistance by targeting yourself with an area-effect ability.
  • bit 31 ⟶ Effect applied by item
    • Effect was applied by an ITM (only present in EE games patched to v2.0+).
    • It is set by the engine if the effect’s source ITM is identified.

This can also be presented in the more traditional way:

  • 0 ⟶ Nonmagical
  • 1 ⟶ Can be dispelled/Affected by resistance
  • 2 ⟶ Cannot be dispelled/Ignores resistance
  • 3 ⟶ Can be dispelled/Ignores resistance
Note: If called via opcode #183, this field is ignored.
0x0060 4 (dword)

Parameter 3

0x0064 4 (dword)

Parameter 4

0x0068 4 (dword)

Parameter 5

0x006c 4 (dword)

Time applied (ticks)

  • It stores the gametime (ticks) at which the effect was originally applied.
0x0070 8 (resref)

Resource 2 (VVC in many effects)

0x0078 8 (resref)

Resource 3

0x0080 4 (dword)

Caster X coordinate

0x0084 4 (dword)

Caster Y coordinate

0x0088 4 (dword)

Target X coordinate

0x008c 4 (dword)

Target Y coordinate

0x0090 4 (dword)

Parent resource type

0x0094 8 (resref)

Parent resource

Important: This specific field always needs to be in ALLCAPS.

Be careful checking it in Near Infinity, it displays resource fields in ALLCAPS regardless of the actual characters. However, it also always saves those fields in ALLCAPS as well.
Info:
  • Global/Casting effects on SPL files have an empty/blank Parent resource field, allowing them to safely ignore opcode #206/opcode #318/opcode #324, as such effects are designed to affect the caster (or the global environment) even when the SPL fails.
  • When attaching passive kit bonuses (labeled as AP_XXXXXXXX in CLAB files) to joinable CRE files as V2 Effects, this field should be set to the SPL applying such bonuses.
    • In so doing, such bonuses will not be applied a second time (due to CLAB processing) when those creatures join the Party.
    • So for instance, when applying +10% Crushing Resistance to a CRE file whose Kit is BARBARIAN, set this field to "SPCL153".
0x009c 4 (dword)

Parent resource flags

  • bit 10 ⟶ Hostile
  • bit 11 ⟶ No LOS required
  • bit 12 ⟶ Allow spotting
  • bit 13 ⟶ Outdoors only
  • bit 14 ⟶ Non-magical ability
  • bit 15 ⟶ Ignore Wild Surge
  • bit 16 ⟶ Non-combat ability
0x00a0 4 (dword)

Projectile

0x00a8 32 (bytes)

Variable name

0x00c8 4 (dword)

Caster level

0x00d0 4 (dword)

Secondary Type