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

  • 0=None
  • 1=Self (pre-projectile)
  • 2=Pre-target
  • 3=Party
  • 4=Everyone (inc. party)
  • 5=Everyone (excl. party)
  • 6=Everyone matching specific value of caster (or Party if cast by party member)
  • 7=Everyone matching specific value of target
  • 8=Everyone (excl. caster)
  • 9=Self (post-projectile)
0x0018 4 (dword)

Power

0x001c 4 (dword)

Parameter 1

0x0020 4 (dword)

Parameter 2

0x0024 2 (word)

Timing mode

  • 0=Duration
  • 1=Permanent
  • 2=While equipped
  • 3=Delayed Duration
  • 4=Delayed
  • 5=Delayed (transforms to 8)
  • 6=Duration?
  • 7=Permanent?
  • 8=Permanent (unsaved)
  • 9=Permanent (after Death)
  • 10=Trigger
  • 4096=Absolute duration

NB. all effects except those with Timing mode ‘9’ are removed by death.

0x0028 4 (dword)

Duration

0x002c 2 (word)

Probability 1

0x002e 2 (word)

Probability 2

Note: The BG1 engine treats probability as a single word, effects are applied in the range 0-probability.
Note: Other engines treat probability as two values, effects are applied in the range probability <= x <= probability.
Probability range is 0-99

0x0030 8 (resref)

Resource

0x0038 4 (dword)

Dice Thrown

0x003c 4 (dword)

Dice Sides

0x0040 4 (dword)

Saving throw type

  • bit 0: Spells
  • bit 1: Breath
  • bit 2: Death
  • bit 3: Wands
  • bit 4: Polymorph
  • bit 10: Ignore primary target – Line AoE projectile doesn’t affect end target (EE only)
  • bit 11: Ignore secondary target – Line AoE projectile doesn’t affect bystanders (EE only)
  • bit 24: Bypass mirror image (EE/ToBEx only)
  • bit 25: EE - ignore difficulty; TobEx - limit effect stacking
  • bit 26: TobEx internal (don’t use) - suspend effect application

NB. If more than 1 saving throw type is specified, the target rolls against their best save

0x0044 4 (dword)

Save bonus

0x0048 4 (dword)

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)

Resistance

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

  • bit 0: Can be dispelled, affected by resistance
  • bit 1: Ignores resistance (when used in combination with bit 0)

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
0x0060 4 (dword)

Parameter 3

0x0064 4 (dword)

Parameter 4

0x0068 4 (dword)

Parameter 5

0x006c 4 (dword)

Parameter 6

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

0x0094 8 (resref)

Parent resource

0x00a8 32 (bytes)

Variable

0x00d0 4 (dword)

Secondary Type