========================
spells.2da Definition
========================
Overview: Defines all spells

Modification history:
ChazM - 5/22/07 - Created from document information.



 Column  Column Name	 
+-------+---------------
| A	| *blank*
+-------+---------------
Row id
The first, unnamed column. It serves as the Spell ID. It will be used to cross-reference this spell ressource in other 2das. It is returned by the GetSpellId() function in the associated spell script. 	
As in all other 2das, the value you indicate is of no importance. Its actual value is the line number, starting with 0 for the first line. 

+-------+---------------
| B	| Label	
+-------+---------------
No other function than giving it a name for human use 

+-------+---------------
| C	| Name	
+-------+---------------
True Spell Only 

StrRef for the name of the spell: reference to dialog.tlk or the custom tlk file for the module. This will give a name to a true spell or monster ability only; for an item-cast-spell-property or a feat for exemple, it will be overwritten by a column in the appropriate 2da. 	

See the talk table description to learn how to reference the custom tlk instead of dialog.tlk. 

+-------+---------------
| D	| IconResRef	
+-------+---------------
True Spell Only 

Name of the .tga file that will represent the spell icon. The .tga file must be present in the hakpack or Bioware resources, else it will appear as a white, blank, icon. 	

You can create your own icons and put them in the hakpak. This is the recommended method because people want to be able to tell spells apart visually. Alternately, you can use generic icons for the different spell school classes: 
	Abjuration = is_abjure 
	Conjuration = is_conjure 
	Divination = is_divine 
	Enchantment = is_enchant 
	Evocation = is_evoke 
	Illusion = is_illusion 
	Necromancy = is_necromancy 
	Transmutation = is_transmut 


+-------+---------------
| E	| School	
+-------+---------------
School of magic. This dictates, in game, if a specilist wizard can take the spell, and adds bonuses due to Spell Focus feats. Note that G is "General" in spellschools.2da, where the rest of these values are from, and should be usable by all casters. New spell schools can probably never be added, however, it might be possible as spellschools.2da does have a "Letter" value. It wouldn't be possible to add new feats to contribute to the school DC values, however. (Similar to how there is no way to add new weapon feats, like Improved Critical, for new weapons). 
	
	A = Abjuration 
	C = Conjuration 
	D = Divination 
	E = Enchantment 
	I = Illusion 
	N = Necromancy 
	T = Transmutation 
	V = Evocation 


+-------+---------------
| F	| Range	
+-------+---------------
Range of the spell. See Ranges.2da for the actual meter value. NwN uses Metres, and doesn't scale due to caster level. 1 tile is 10x10M. Note that Ranges.2da holds the hardcoded ranges for spells - there seems no way to add new ones as these letters seemingly are not in the Ranges.2da file. 
Also note that if the caster is trying to touch the target, and is next to them, the ranges here will not matter and the game will let them cast it. Therefore, to have real touch spells, put P for a range of 0. If the target type is self, these ranges have absolutely no effect - this is only for targeting other creatures. 	

	P = Personal (affects only the caster, effective range of 0) 
	T = Touch (affects the person touched - 2.25M) 
	S = Short (8 Meters) 
	M = Medium (20 Meters) 
	L = Long (40 Meters) 


+-------+---------------
| G	| VS	
+-------+---------------
Verbal and somatic components of the spell. Verbal component spells cannot be cast when under the influence of Silence, while somatic component spells cannot be cast if the caster cannot move. It is unknown when verbal-only spells actually can be cast in stun ETC. Somatic spells also have a spell armour failure induced for arcane spell casters (Bard, Wizard, Sorcerer). There is no way to add more components to this, using other values are not recommended. 	

	V - Verbal only (cannot cast this spell if silenced) 
	S - Somatic (Spell suffers arcane spell failure from armour) 
	VS - both 
	**** - neither 


+-------+---------------
| H	| MetaMagic	
+-------+---------------
True Spell Only 

Defines which metamagic feats can be used on the spell. The number is a bit flag setting (See BitMasks) and must be in hexadecimal format. The numbers need to be added together to get the final set of flags for the spell. 
Example: I want a spell that can be Quickened, Silent, Still, and Maximized. I would have 8(Quicken)+16(Silent)+32(Still)+4(Maximize)=60 total. 
Once you get the number you need to convert it into hex format. The easiest way if you use Windows is to use the calculator. Open up the Calculator program in Windows and under the View menu, switch to scientific mode. Make sure the round radio button is checked for Dec. Enter in your number and then change it from Dec to Hex; this is your hexadecimal number. Enter this number along with a 0x (just programmers notation that a number is in hexadecimal format) to the column. That is a 'zero' and not the letter Oh. So our example would be 0x3c. 	

	0x01 = 1 = Empower 
	0x02 = 2 = Extend 
	0x04 = 4 = Maximize 
	0x08 = 8 = Quicken 
	0x10 = 16 = Silent 
	0x20 = 32 = Still 


+-------+---------------
| I	| TargetType	
+-------+---------------
This is the type of target the spell requires. Like the Metamagic value, this is actually a binary flag system (See BitMasks). You must enter the hex code after adding up the values for all the targets you want to be able to affect. 
The target is only what a PC object will be able to validly pick as a target. It will not apply to scripted calls of ActionCastSpell(). If something invalid is somehow chosen as a target, such as by the script call, then the spell casts as normal as if it was a valid target. 
See the notes for feats to the right. This does apply to feats, but the self bit is always set.

	0x01 = 1 = Self 
	0x02 = 2 = Creature 
	0x04 = 4 = Area/Ground 
	0x08 = 8 = Items 
	0x10 = 16 = Doors 
	0x20 = 32 = Placeables 
	0x40 = 64 = Trap triggers (only when detected) and area transition triggers (this does not work very well - the cursor is active on the area transition, but when clicking the PC is left hanging before casting the spell and the script doesn't fire). This value is not currently used by Bioware, and hasn't been tested by the original writer of the last sentence for a very long time. 

HotU specific changes: 
	All player castable spells need to have bit 0x08 set to allow them to work with the crafting system. 
	Feats connected to a spell using FeatID now will work correctly with this field, with the exception of bit 0x01, which is always included (but you can code around that in your spellscript). 

+-------+---------------
| J	| ImpactScript	
+-------+---------------
The script (compiled in the toolset, and available in any resource file) that runs against the target of the spell. See Impact Script. The ImpactScript column is NOT case-sensitive as with any script reference in 2da's. Note that this script applies effects - therefore, if the spell is interrupted (eg: Via concentration checks) this script merely fails to fire. If the script doesn't exist, basically nothing happens. Also note that the scripting functions ActionCastFakeSpell***() will fire all the conjuration effects, casting effects and sounds, but just fail to fire this script.

Its name without the .ncs extension. For example, making a new spell, I might have "SPL_ALARM" for a spell called alarm. It is only the reference used for the script and that's just a simple naming convention. 

+-------+---------------
| K	| Bard	
+-------+---------------
True Spell Only 

The level of the spell for each class, if it can't be used by that class then it is commented out with ****. Innate is for creatures that have it as a spell-like ability. A lot of creature abilities are implemented as "innate spells".

The spell level does directly change the "CR" of the spell, got by GetCreatureTalentBest(), and seems to be simply double the appropiate level put in these columns (so a max CR of 18). This means, even for creature spells, the innate level directly influences the default AI and perhaps what abilities are used first or considered the most powerful. 	

0 (Cantrip) to 9. Epic spells are essentially "feats" and do not carry a level, but every valid entry to the spells.2da requires an Innate column entry. 

- Aenn: Epic Spells are innate level 10 spells. 

+-------+---------------
| L	| Cleric	
+-------+---------------
See Bard

+-------+---------------
| M	| Druid	
+-------+---------------
See Bard

+-------+---------------
| N	| Paladin	
+-------+---------------
See Bard

+-------+---------------
| O	| Ranger	
+-------+---------------
See Bard

+-------+---------------
| P	| Wiz_Sorc	
+-------+---------------
See Bard

+-------+---------------
| Q	| Warlock	
+-------+---------------
See Bard

+-------+---------------
| R	| Innate	
+-------+---------------
See Bard

+-------+---------------
| S	| ConjTime	
+-------+---------------
True Spell Only 

Conjuration is the process of invoking the spell. This makes the conjuration effects stay on until this time is over, and can be any amount (so a spell can take longer than 1 action to cast). The conjuration time is in milliseconds. This is tested, and any value can be put here. A time of 0 is used for creature auras and any feat references. 

Note: the Conjuration effects are executed before the Cast effects. 	

For spells it is 1500 with only 1 exception - Phantasmal Killer - which is at 900. 


+-------+---------------
| T	| ConjAnim	
+-------+---------------
True Spell Only 

This is for the character or creature invoking the spell and calls the appropriate animation so that the caster goes through the right motions. 	

The three possible values are: 
	hand - Caster's hands are in front of him. 
	head - Caster's hands reach up to above face level. 
	**** - No hand movement. 


+-------+---------------
| U	| ConjVisual0	
+-------+---------------
(ConjHeadVisual)

This is to add a visual effect over the head of the caster when invoking the spell. 	

Some sample head visuals and the spells they are used on are: 
	Ice_Storm - vco_mehancold03 
	Resurrection - vco_mehanelec01 
	Premonition - vco_mehanelec03 
	Meteor_Swarm - vco_mehanevil03
 
There are a lot more, see VFX. 

+-------+---------------
| V	| LowConjVisual0	
+-------+---------------
(ConjHandVisual)

This adds an effect to - or between - the caster's hands when invoking the spell. 

+-------+---------------
| W	| ConjVisual1	
+-------+---------------
(ConjGrndVisual)

This adds an effect to the ground around the caster when invoking the spell. 

+-------+---------------
| X	| ConjVisual2	
+-------+---------------


+-------+---------------
| Y	| ConjSoundVFX	
+-------+---------------
This is the sound effect that plays when invoking the spell. It is not the caster's voice but the energy crackles, moaning, etc. that plays in the background. These are not looping, and fire once, despite any changes to ConjTime, or if the spell is disrupted. 

+-------+---------------
| Z,AA 	| ConjSoundMale, ConjSoundFemale	
+-------+---------------
Obsolete with NX1 spell chant system. These are the sound effects for the chanting that the caster does while invoking the spell. If the spell is disrupted, this sound plays anyway, and plays for the full duration dispite any changes to CastTime/ConjTime. 

+-------+---------------
| AB	| ConjSoundOverride	
+-------+---------------
Used for new conjuration sound filenames; replaces the school flag, which allows you to create custom spell sound files for specific spells. Sound filename is of the form <speaker>_<spell_flag>.wav. This entry overrides the <spell_flag>, which is otherwise automatically tag calculated: [A,D][0-3][School abbreviation] (example: A1V would be a 1-3 level arcane evocation.). 

+-------+---------------
| AC	| CastAnim	
+-------+---------------
The caster's pose after finishing the spell conjuration. 
Note: the Cast animations and effects occur after the Conjuration ones. 	

Possibilities are: 
	Areaout 
	self 
	touch - pointed finger 
	up - hands upwards 
	attack - perform attack animation 


+-------+---------------
| AD	| CastTime	
+-------+---------------
This seems to be how long in milliseconds the caster stays in the CastAnim pose. 	

There seem to be 2 settings: 
	1000 = most spells 
	1700 = spells with ray or cone shaped effects. 

Other values will probably work, however. This amount of time is passed before a new action can take place (after the spell script has fired). It usually just looks good for some spells like Cones, or for the "CastHandVisual" to work right. 


+-------+---------------
| AE	| CastVisual0	
+-------+---------------
(CastHeadVisual) 	

Not currently used for any spells 

+-------+---------------
| AF	| LowCastVisual0	
+-------+---------------
(CastHandVisual)

These effects happen to the caster after the conjuration effects take place. An example would be the force rings that radiate from the caster's hand after a Magic Missile spell or the cone of frost from a Cone of Cold spell. If concentration is disrupted, this is not fired. 

+-------+---------------
| AG	| CastVisual1	
+-------+---------------
(CastGrndVisual)

Not currently used for any spells 

+-------+---------------
| AH	| CastVisual2	
+-------+---------------


+-------+---------------
| AI	| CastSound	
+-------+---------------
The sound played after the Conjuration, if the conjuration is sucessful with no concentration interrupts. 	

placeholder_3 

+-------+---------------
| AJ	| Proj	
+-------+---------------
Whether there is a projectile model that moves between the caster and the target in the spell. If there is a projectile model, the spell script only fires once the model reaches the target location. This means that a fireball will have a natural delay before the impact script which does damage actually fires. 	

1 for yes, 0 for no 

+-------+---------------
| AK	| ProjModel	
+-------+---------------
The model that moves between the caster and the target. 	

The currently used ones are: 
	vpr_aroacid 
	vpr_ectoacid01 
	vpr_ectocold01 
	vpr_ectoevil01 
	vpr_ectofire01 
	vpr_ectomind01 
	vpr_ectonatr01 
	vpr_ectoodd01 
	vpr_ectosonc01 
	vpr_fireball 
	vpr_ringsmal 
	vpr_wraith 


+-------+---------------
| AL	| ProjSEF	
+-------+---------------


+-------+---------------
| AM	| LowProjSEF	
+-------+---------------


+-------+---------------
| AN	| ProjType	
+-------+---------------
The physics of the projectile 	

	accelerating - gains speed towards target; 
	homing - follows target at constant speed; 
	linkedspiral - like the Arcane Archer's Seeker Arrow; 
	ballistic - high angle, like a catapult; 
	bounce - low ballistic, bouncing off the ground (i. e. grenade-like weapons); 
	spiral - spiralling projectile like the Arcane Archer's Seeker Arrow; 
	**** - no projectile for the spell 


+-------+---------------
| AO	| ProjSpwnPoint	
+-------+---------------
Where the projectile starts at from the caster. 	

	hand - spawn from caster's hand 
	head - spawn from caster's head 
	**** - no projectile spawned 
	monster0 to monster9 - Monster nodes (HotU-specific, i.e. the beholder's eye nodes). 


+-------+---------------
| AP	| ProjSound	
+-------+---------------
The sound of the projectile 	

placeholder_4 

+-------+---------------
| AQ	| ProjOrientation	
+-------+---------------
Which direction to orient the projectile in 	

Set to path if there is a projectile 

+-------+---------------
| AR	| ImpactSEF	
+-------+---------------


+-------+---------------
| AS	| LowImpactSEF	
+-------+---------------


+-------+---------------
| AT	| ImmunityType	
+-------+---------------
Type of immunity needed to ignore the effects of this spell. 

Note: This column is not used by the game. 	

Note: there are three Mind-Affecting immunities and two Positive immunities, I'm not sure if this a typo or not - looks like one: 
	Acid 
	Cold 
	Death 
	Disease 
	Divine 
	Electricity 
	Fear 
	Fire 
	Mind_Affecting 
	Mind_Effecting (Typo?) 
	Mind-Affecting (Typo?) 
	Negative 
	Poison 
	Positive 
	Postive (Typo?) 
	Sonic 


+-------+---------------
| AU	| ItemImmunity	
+-------+---------------
Can the spell be added to an item, so that the user of the item is immune to the spell? 	

1 for yes, 0 for no. 

This should just be the availability to have "Immunity Spell:" on an item, not the fact items will be immune to this spell (Else, none of the crafting things would work!). Therefore, it is set to 1 for hostile spells which have Spell Resistance checks, and Epic Spells do not have it set to 1. Note: if a spell doesn't have a Spell Resistance check, immunity will not work. 


+-------+---------------
| AV-AZ	| SubRadSpell1 - 5	
+-------+---------------
These are for spells that have multiple ways of casting them. The values in these columns are the index value of "sub"-spells that will come up in another radial menu. Spells like Polymorph Self or Shapechange where you can pick a type of creature to turn into, or Shadow Conjuration where you can pick the spell to emulate. The maximum number of choices you have for a spell will be 5. The people who are planning on implementing radical new Polymorph spells where you can turn into all sorts of animals may want to look at this. 	

Index of each of the subspells in this very 2da. It has been reported that radials only work if the new spells use ID numbers directly consecutive to those already in use... But only because one has to remember the true SpellID is the line number *NOT* the index one has written (without respecting line count I believe). 

(1.32):Information in these fields is not computed correctly for custom content prior to HotU. With HotU these fields should work fine, BUT it will require some special tricks to make them useable with feats (i.e. a feat that opens into a subradial spell selection, like the Druid's wildshape). Prior to HotU using subradial spells with feats is not possible at all. 


+-------+---------------
| BA	| Category	
+-------+---------------
Possible values are equal to the various TALENT_CATEGORY_* constants in nwscript.nss, and are also listed in category.2da that this entry appears to reference (however category.2da has only one column besides the index, so its function is unclear). It is used in various AI scripts to select appropriate abilities for creatures or NPCs to use. Also note that TALENT_DISPEL is not used, and isn't called in the Bioware AI script files, and the POTION values should not be directly put into here - I have no idea how it is decided if one potion is a healing, beneficial or otherwise potion. iprp_spells.2da doesn't help. Speculation: if it finds a potion with a spell relating to the "AOE" or "Single" versions of conditional, Healing or beneficial, it uses it in the potion category. Items must be similar - it is game engine workings, nothing can be changed. New categories might not work. 

	From category.2da(AoE = Area of Effect) 
	1 Harmful_AOE_Discriminant (only affects ennemies) 
	2 Harmful_Ranged 
	3 Harmful_Touch 
	4 Beneficial_Healing_AOE 
	5 Beneficial_Healing_Touch 
	6 Beneficial_Conditional_AOE 
	7 Beneficial_Conditional_Single 
	8 Beneficial_Enhancement_Area Effect 
	9 Beneficial_Enhancement_Single 
	10 Beneficial_Enhancement_Self 
	11 Harmful_AOE_Indiscriminant 
	12 TALENT_CATEGORY_BENEFICIAL_PROTECTION_SELF 
	13 TALENT_CATEGORY_BENEFICIAL_PROTECTION_SINGLE 
	14 TALENT_CATEGORY_BENEFICIAL_PROTECTION_AOE 
	15 TALENT_CATEGORY_BENEFICIAL_SUMMON 
	16 TALENT_CATEGORY_PERSISTENT_AREA_OF_EFFECT 
	17 TALENT_CATEGORY_BENEFICIAL_HEALING_POTION 
	18 TALENT_CATEGORY_BENEFICIAL_CONDITIONAL_POTION 
	19 TALENT_CATEGORY_DRAGONS_BREATH 
	20 TALENT_CATEGORY_BENEFICIAL_PROTECTION_POTION 
	21 TALENT_CATEGORY_BENEFICIAL_ENHANCEMENT_POTION 
	22 TALENT_CATEGORY_HARMFUL_MELEE 
	23 TALENT_DISPEL 


+-------+---------------
| BB	| Master	
+-------+---------------
Used in conjunction with the SubRadSpell columns. For a subspell this is the parent spell that called it. The actual effect is that the uses-per-day of the master spell is reduced by one when this spell is cast, along with that of all the other subspells. Generally all sub-spells will want this and no others will. Subspells without this set do not work correctly, you need to have it set else when you rest, you may only cast the spells that reference the master spell. Therefore, Acid Fog (Line 0, with no master entry) cannot be directly added to Shades. This is why Bioware needed new Shades: Fireball entries, among other things. 	

Index of the master spell in this very 2da. It is a good idea to keep all spells which use the same Master spell next to each other. A subspell can only be on one sub-dial (although, I suppose, it could be used independantly of that sub-dial too). 

+-------+---------------
| BC	| UserType	
+-------+---------------
Type of capacity this line actually implements. I can't remember any engine use for this entry other than a cosmetic one in the toolset, but put the appropriate value anyway. 	

	1 = Spells 
	2 = Creature Power 
	3 = Feat 
	4 = Item Power 

If it is only a Creature Power put 2. Only an Item Power, 4. Only a feat put 3. If it is simply a spell or a spell and (a Creature Power or an Item Power) put 1. 

Notes: 
	UserType 4 (Item) spells will never show up in the special abilities panel (toolset) on creatures. Use for things like "Sequencer Robe", or "Unique Power". 
	UserType 3 (Feat) will not show up as separate special abilities/spells (toolset). Use for feats. 
	The talent system in the AI makes use of these values, i.e. putting a 3 (feat) will prevent creatures from using a spell via TalentSpell, TalentFeat must be used instead. 
	In addition certain game mechanisms make use of this data field, it may affect if a spell can be counterspelled, is affected by dispel magic, etc. It also affects if the spell can be interrupted. (i.e. feats cannot be interrupted). 
	It's important that you put the correct use into this field. 


+-------+---------------
| BD	| SpellDesc	
+-------+---------------
True Spell Only 

StrRef for the description of the spell: reference to dialog.tlk or the custom tlk file for the module 

See the talk table description to learn how to reference the custom tlk instead of dialog.tlk (HotU/patch feature, 1.59+). 

+-------+---------------
| BE	| UseConcentration	
+-------+---------------
Determines if a Concentration check is needed to successfully cast the spell if interrupted (e.g., if hit during combat) 	

0 for no, 1 for yes 

For spells always 1. The only records which have a 0 are uninterruptible ones like constant creature powers, abilties, innate powers, feats, and basically any non-player spells. Also note that even if a spell is added as a Creature Ability in the Toolset, and this is 1, it requires concentration to cast. As noted in Spells, the duration of the conjuration time must be complete without the concentration being broken for the impact script to fire. With this set to 0, it only requires the time to complete - it doesn't cause Attacks of Oppotunity nor get stopped by damage. 


+-------+---------------
| BF	| SpontaneouslyCast	
+-------+---------------
This is for the Cleric's spontaneous casting. Only Cure/Cause wounds should have this. Note that there is no way to define what class uses the spells, and it is NOT alignment-restricted to 3E rules - it only works for Clerics, and only should really be used for healing spells. 	

1 for yes, 0 for no 

+-------+---------------
| BG	| SpontCastClassReq	
+-------+---------------


+-------+---------------
| BH	| AltMessage	
+-------+---------------
This is the StrRef for the message in dialog.tlk that is displayed to people other than the caster, for example "SoAndSo smites evil". 	

See the talk table description to learn how to reference the custom tlk instead of dialog.tlk (Patch 1.59+) You can use the token <CUSTOM0> in the string that is referenced by this line to make the name of the creature using the spell appear: "<Custom0> smites evil" would translate into "Big Troll smites evil". 

+-------+---------------
| BI	| HostileSetting	
+-------+---------------
Should a NPC consider this an attack if they are affected by the spell? 	

1 for yes, 0 for no. 

It seems SignalEvent() called in the scripting engine has nothing to do with this 2da entry (although they are usually the same, of course). This is probably to cause the repadjust.2da values to change the internal reputations even if the NPC has no script attached to it (This may be why it happens anyway). Plot creatures would ignore this. It might have something to do with other game engine things - and should always be set to 1 for hostile spells. 


+-------+---------------
| BJ	| FeatID	
+-------+---------------
The ID of the feat this "spell" implements. There are a few feats that are activated like spells, and you can make your own. Actually I'm pretty sure this reference is of no use to the engine, it's the other way around that matters most (the reference from feat.2da to this 2da). However do put the correct one. It will makes things easier for you, and it could be usefull to get this data from the ImpactScript (there is no function doing it for now, except for Get2daString, but it might change one day). 	

Index of the feat in feat.2da. You know what? It is actually the line number in the 2da that matters, not the index written in the first column which might (but should not) be bogus. How extraordinary!
 
If you are trying to create a subradial feat, the instructions for the FeatID to use in this field are here. 

+-------+---------------
| BK	| Counter1	
+-------+---------------
Reference to the first counterspell 	

Index of the counterspell in this 2da... line number... bogus 

Jasperre: Is this really bogus...? ...Bioware uses it for both NwN, SoU and HotU spells for the counterspells (Haste and Slow for example). It points to another spells.2da line entry. Change this if any information comes up. 


+-------+---------------
| BL	| Counter2	
+-------+---------------
Reference to the second counterspell 	

Index of the counterspell in this 2da... line number... bogus 

+-------+---------------
| BM	| HasProjectile	
+-------+---------------
HotU-specific field, introduced to optimize performance. Controls if a projectile information needs to be sent to each client that can see the spell being cast. 	

You need to set this field to 1 if any of the following conditions is met: 
	CastHandVisual is not empty OR 
	Proj is not empty OR 
	ProjModel is not empty 

In all other conditions this field should be set to 0 to prevent the game from sending unneccessary packets to the clients. This information is by Georg, Here. 

+-------+---------------
| BN	| AsMetaMagic	
+-------+---------------


+-------+---------------
| BO	| TargetingUI	
+-------+---------------


+-------+---------------
| BP	| CastableOnDead	
+-------+---------------


+-------+---------------
| BQ	| REMOVED
+-------+---------------


