Index  •  2DA  •  Effects  •  File Formats  •  Actions  •  Identifiers  •  Triggers  •  Appendices  •  Site Info  •  Legal

SPL file format

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

General Description
This file format describes a "spell". Spells include mage spells, priest spells, innate abilities, special abilities and effects used for game advancement (e.g. animation effects, custom spells). SPL files have a similar structure to ITM files.

Header:Size=114 Bytes Ext. Header: Size= 40 Bytes Feature Block: Size=48 Bytes

Detailed Description
SPL files consist of a main header, zero or more extended headers (each containing zero or more feature blocks) and zero or more casting feature blocks. All the feature blocks are stored as a continuous data segment, with each extended header containing an offset into this data, and the main header containing an offset into this data for the casting feature blocks.

Overall structure:


Offset Size (datatype) Description
0x0000 4 (char array) Signature ('SPL ')
0x0004 4 (char array) Version ('V1 ')
0x0008 4 (dword) Spell Name - Unidentified (strref)
0x000c 4 (dword) Spell Name - Identified (strref) (usu. -1)
0x0010 8 (resref) Completion Sound
0x0018 4 (dword) Flags
0x001c 2 (word) Spell type:
0=Special
1=Wizard
2=Cleric
3=Psionic
4=Innate
5=Bardsong
0x001e 2 (word) Exclusion Flags
0x0020 2 (word) Priest Type. Grant spell to divine magic users of type
0x0000=Any
0x4000=Any (except Cleric/Paladin)
0x8000=Any (except Druid/Ranger)
0x0022 2 (word) Casting Graphics
0x0024 1 (char) Unknown
0x0025 2 (word) Primary Type (Spell school) (IWD: school.2da, BG2:mschool.2da)
0x0027 1 (char) Secondary Type (BG2:msectype.2da)
0x0028 4 (dword) Unknown
0x002c 4 (dword) Unknown
0x0030 4 (dword) Unknown
0x0034 4 (dword) Spell Level
0x0038 2 (word) Unknown
0x003a 8 (resref) Spellbook icon (BAM). The engine replaces the last character of this filename with a C.
0x0042 2 (word) Unknown
0x0044 4 (dword) Unknown
0x0048 4 (dword) Unknown
0x004c 4 (dword) Unknown
0x0050 4 (dword) Spell Description - Unidentified (strref)
0x0054 4 (dword) Spell Description - Identified (strref) (usu. -1)
0x0058 4 (dword) Unknown
0x005c 4 (dword) Unknown
0x0060 4 (dword) Unknown
0x0064 4 (dword) Extended Header offset
0x0068 2 (word) Extended Header count
0x006a 4 (dword) Feature Block Table offset
0x006e 2 (word) Casting Feature Block offset (must have target self)
0x0070 2 (word) Casting Feature Block count


Extended headers represent the effects of a spell on the target. Multiple extended headers can be set in a spell, to allow the spell to use effects based on the level of the caster. Extended headers should be in the file in order of increasing level.

Offset Size (datatype) Description
0x0000 1 (char) Spell form
  • 1 - Standard
  • 2 - Projectile
0x0001 1 (char) Unknown
0x0002 1 (char) Location
0x0003 1 (char) Unknown
0x0004 8 (resref) Memorised icon (BAM). The engine replaces the last character of this filename with a B.
0x000c 1 (char) Target:
0 = Invalid (cannot be selected)
1 = Creature
2 = Inventory
3 = Dead char
4 = Area
5 = Self
6 = Crash
7 = None (Self, ignores game pause)
0x000d 1 (char) Target Number
0x000e 2 (word) Range
0x0010 2 (word) Level Required
0x0012 4 (dword) Casting Time
0x0016 2 (word) Dice Sides (unused)
0x0018 2 (word) Dice Thrown (unused)
0x001a 2 (word) Enchanted (unused)
0x001c 2 (word) Damage Type (unused)
0x001e 2 (word) Count of feature blocks
0x0020 2 (word) Offset to feature blocks
0x0022 2 (word) Charges (unused)
0x0024 2 (word) Charge depletion behvaiour (unused)
0x0026 2 (word) Projectile (BG2:projectl.ids)


Any action carried out by a spell is done by feature blocks, each of which holds an effect number as well as targetting and timing information.

Offset Size (datatype) Description
0x0000 2 (word) Opcode Number
0x0002 1 (char) Target
  • 0=None
  • 1=Self
  • 2=Pre-Target
  • 3=Party
  • 4=Global
  • 5=Non-Party
  • 6=Non-evil
  • 7=Unknown
  • 8=Except Self
  • 9=Original Caster
  • 10=Unknown
  • 11=Unknown
  • 12=Unknown
  • 13=Unknown
0x0003 1 (char) Power
0x0004 4 (dword) Parameter 1
0x0008 4 (dword) Parameter 2
0x000c 1 (char) Timing Mode
  • 0=Duration
  • 1=Permanent
  • 2=While equipped
  • 3=Delayed Duration
  • 4=Delayed
  • 5=Delayed?
  • 6=Duration?
  • 7=Permanent?
  • 8=Permanent?
  • 9=Permanent (after Death)
  • 10=Trigger
0x000d 1 (char) Resistance
  • 0=Nonmagical
  • 1=Dispel/Not Bypass
  • 2=Not Dispel/Not Bypass
  • 3=Dispel/Bypass
0x000e 4 (dword) Duration
0x0012 1 (char) Probability 1
0x0013 1 (char) Probability 2
0x0014 8 (resref) Resource
0x001c 4 (dword) Dice Thrown
0x0020 4 (dword) Dice Sides
0x0024 4 (dword) Saving Throw Type
  • bit 0: Spells
  • bit 1: Breathe
  • bit 2: Death
  • bit 3: Wands
  • bit 4: Polymorph
NB. If more than 1 saving throw type is specified, the target rolls against their best save.
0x0028 4 (dword) Saving Throw Bonus
0x002c 4 (dword) Unknown



Header Flags

Bit Byte 1 Byte 2 Byte 3 Byte 4
0 Unknown Unknown Not in combat Unknown
1 Unknown Unknown Unknown Unknown
2 Unknown Hostile/Breaks Invisibility Unknown Unknown
3 Unknown No LOS required Unknown Unknown
4 Unknown Unknown Unknown Unknown
5 Unknown Outdoors only Unknown Unknown
6 Unknown High Level Ability Unknown Unknown
7 Unknown Trigger/Contingency Unknown Unknown

Exclusion Flags

bit 0: Exclude Chaotic priests. (BG2 & HoW)
bit 1: Exclude Evil priests. (BG2 & HoW)
bit 2: Exclude Good priests. (BG2 & HoW)
bit 3: Exclude GENeutral priests. (BG2 & HoW)
bit 4: Exclude Lawful priests. (BG2 & HoW)
bit 5: Exclude LCNeutral priests. (BG2 & HoW)
bit 6: Exclude Abjurers
bit 7: Exclude Conjurers
bit 8: Exclude Diviners
bit 9: Exclude Enchanters
bit 10: Exclude Illusionists
bit 11: Exclude Invokers
bit 12: Exclude Necromancers
bit 13: Exclude Transmuters
bit 14: Wild Magic (exclude Generalists) (BG2)
bit 15: Unused

NB.Alignment and School exclusion bits cannot be combined.

Casting Graphics

BG1,BG2,IWD
00
    ...No animation
08
09 Necromancy
10 Alteration
11 Enchantment
12 Abjuration
13 Illusion
14 Conjuration
15 Invocation
16 Divination
17 White sparks
18 Black sparks
19 White sparks
20 White sparks
21 White sparks
22 White -> red sparks
23 White -> purple/red sparks
24 White -> red sparks
26 White sparks
32 White sparks
34 White sparks
56461 No animation
65535 No animation

NB. The 'spark' entries are related to sprklclr.2da (and probably opcode #41)

PST
35: Abjuration
36: Alteration
37: Conjuration
38: Enchantment
39: Divination
40: Illusion
41: Invocation
42: Necromancy
44: Special (Innate) Skill