SPL file format
Applies to:
IWD2
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.
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:
Overall structure:
Offset | Size (datatype) | Description |
---|---|---|
0x0000 | 4 (char array) | Signature ('SPL ') |
0x0004 | 4 (char array) | Version ('V2.0') |
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 | 4 (dword) | Exclusion Flags |
0x0022 | 2 (word) | Casting Graphics |
0x0024 | 1 (char) | Min Level (unused) |
0x0025 | 1 (byte) | Primary Type (Spell school) |
0x0026 | 1 (byte) | Min Strength (unused) |
0x0027 | 1 (char) | Secondary Type |
0x0028 | 1 (byte) | Min Strength Bonus (unused) |
0x0029 | 1 (byte) | Usability 1 (unused) |
0x002a | 1 (byte) | Min Int (unused) |
0x002b | 1 (byte) | Usability 2 (unused) |
0x002c | 1 (byte) | Min Dex (unused) |
0x002d | 1 (byte) | Usability 3 (unused) |
0x002e | 1 (byte) | Min Wis (unused) |
0x002f | 1 (byte) | Usability 4 (unused) |
0x0030 | 2 (word) | Min Con (unused) |
0x0032 | 2 (word) | Min Cha (unused) |
0x0034 | 4 (dword) | Spell Level |
0x0038 | 2 (word) | Stack amount (unused) |
0x003a | 8 (resref) | Spellbook icon (BAM). The engine replaces the last character of this filename with a C. |
0x0042 | 2 (word) | Lore to ID (unused) |
0x0044 | 4 (dword) | Ground icon (unused) |
0x004c | 4 (dword) | Weight (unused) |
0x0050 | 4 (dword) | Spell Description - Unidentified (strref) |
0x0054 | 4 (dword) | Spell Description - Identified (strref) (usu. -1) |
0x0058 | 8 (resref) | Description icon (unused) |
0x0060 | 4 (dword) | Enchantment (unused) |
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 |
0x0072 | 1 (byte) | Duration Modifier (Level)* |
0x0073 | 1 (byte) | Duration Modifier (Rounds)* |
0x0074 | 14 (bytes) | Unknown |
* The spell duration will be set to U1 *level + U2 rounds.
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
|
0x0001 | 1 (char) | Unknown |
0x0002 | 2 (word) | Location |
0x0004 | 8 (resref) | Memoried icon (BAM). The engine replaces the last character of this filename with a B. |
0x000c | 1 (char) | Target:
0 = Invalid
1 = Creature 2 = Crash 3 = Character potrait (ignores range, uses projectile #1) 4 = Area 5 = Self 6 = Unknown 7 = None (Self, ignores game pause) |
0x000d | 1 (char) | Target Number |
0x000e | 2 (word) | Range |
0x0010 | 2 (word) | Level Required |
0x0012 | 2 (word) | Casting Time |
0x0014 | 2 (word) | Times per day |
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 (projectl.ids/missile.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. The engine appears to roll a probability for each valid target type, rather than one probability per attack.
Offset | Size (datatype) | Description |
---|---|---|
0x0000 | 2 (word) | Opcode Number |
0x0002 | 1 (char) | Target type
|
0x0003 | 1 (char) | Power |
0x0004 | 4 (dword) | Parameter 1 |
0x0008 | 4 (dword) | Parameter 2 |
0x000c | 1 (char) | Timing mode
|
0x000d | 1 (char) | Resistance The default behaviour is that effects cannot be dispelled and ignore resistance.
This can also be presented in the more traditional way:
|
0x000e | 4 (dword) | Duration |
0x0012 | 1 (char) | Probability 1 |
0x0013 | 1 (char) | 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 |
0x0014 | 8 (resref) | Resource |
0x001c | 4 (dword) | Dice Thrown |
0x0020 | 4 (dword) | Dice Sides |
0x0024 | 4 (dword) | Saving Throw Type
|
0x0028 | 4 (dword) | Saving Throw Bonus |
0x002c | 4 (dword) | Unknown |
Header Flags
Bit | Byte 1 | Byte 2 | Byte 3 | Byte 4 |
---|---|---|---|---|
0 | Unknown | Unknown | Unknown | Unknown |
1 | Unknown | Unknown | Unknown | Unknown |
2 | Unknown | Hostile/Breaks Invisibility | Not in combat(?) | Unknown |
3 | Unknown | No LOS required | Unknown | Unknown |
4 | Unknown | Unknown | Unknown | Unknown |
5 | Unknown | Outdoors only | Unknown | Unknown |
6 | Unknown | Simplified Duration | Unknown | Unknown |
7 | Unknown | Trigger/Contingency | Unknown | Unknown |
Casting Graphics
From sceffect.ids
0x0000 NONE
0x0001 FIRE_AQUA
0x0002 FIRE_BLUE
0x0003 FIRE_GOLD
0x0004 FIRE_GREEN
0x0005 FIRE_MAGENTA
0x0006 FIRE_PURPLE
0x0007 FIRE_RED
0x0008 FIRE_WHITE
0x0009 GLOW_NECROMANCY
0x000A GLOW_ALTERATION
0x000B GLOW_ENCHANTMENT
0x000C GLOW_ABJURATION
0x000D GLOW_ILLUSION
0x000E GLOW_CONJURE
0x000F GLOW_INVOCATION
0x0010 GLOW_DIVINATION
0x0011 SPARKLES_FOUNTAIN_AQUA
0x0012 SPARKLES_FOUNTAIN_BLACK
0x0013 SPARKLES_FOUNTAIN_BLUE
0x0014 SPARKLES_FOUNTAIN_GOLD
0x0015 SPARKLES_FOUNTAIN_GREEN
0x0016 SPARKLES_FOUNTAIN_MAGENTA
0x0017 SPARKLES_FOUNTAIN_PURPLE
0x0018 SPARKLES_FOUNTAIN_RED
0x0019 SPARKLES_FOUNTAIN_WHITE
0x001A SPARKLES_SWIRL_AQUA
0x001B SPARKLES_SWIRL_BLACK
0x001C SPARKLES_SWIRL_BLUE
0x001D SPARKLES_SWIRL_GOLD
0x001E SPARKLES_SWIRL_GREEN
0x001F SPARKLES_SWIRL_MAGENTA
0x0020 SPARKLES_SWIRL_PURPLE
0x0021 SPARKLES_SWIRL_RED
0x0022 SPARKLES_SWIRL_WHITE
0x0001 FIRE_AQUA
0x0002 FIRE_BLUE
0x0003 FIRE_GOLD
0x0004 FIRE_GREEN
0x0005 FIRE_MAGENTA
0x0006 FIRE_PURPLE
0x0007 FIRE_RED
0x0008 FIRE_WHITE
0x0009 GLOW_NECROMANCY
0x000A GLOW_ALTERATION
0x000B GLOW_ENCHANTMENT
0x000C GLOW_ABJURATION
0x000D GLOW_ILLUSION
0x000E GLOW_CONJURE
0x000F GLOW_INVOCATION
0x0010 GLOW_DIVINATION
0x0011 SPARKLES_FOUNTAIN_AQUA
0x0012 SPARKLES_FOUNTAIN_BLACK
0x0013 SPARKLES_FOUNTAIN_BLUE
0x0014 SPARKLES_FOUNTAIN_GOLD
0x0015 SPARKLES_FOUNTAIN_GREEN
0x0016 SPARKLES_FOUNTAIN_MAGENTA
0x0017 SPARKLES_FOUNTAIN_PURPLE
0x0018 SPARKLES_FOUNTAIN_RED
0x0019 SPARKLES_FOUNTAIN_WHITE
0x001A SPARKLES_SWIRL_AQUA
0x001B SPARKLES_SWIRL_BLACK
0x001C SPARKLES_SWIRL_BLUE
0x001D SPARKLES_SWIRL_GOLD
0x001E SPARKLES_SWIRL_GREEN
0x001F SPARKLES_SWIRL_MAGENTA
0x0020 SPARKLES_SWIRL_PURPLE
0x0021 SPARKLES_SWIRL_RED
0x0022 SPARKLES_SWIRL_WHITE