The iprp_onhitspell.2da is used for the On Hit: Cast Spell item property and defines the spells that are cast. These can be put on weapons and ammo to hit a target, or be on shields or armor when hit by an attacker.

Additional Values

You can simply add additional spells into this 2da as new lines, since there is a SpellIndex column to link to the appropriate spells.2da entry.

Engine Functionality

Only one On Hit: Cast Spell on an attacking item can fire at once in a given attack meaning with multiple properties only the first added will fire. To work around this you could have a custom spell fire which then fires whatever effects you need (albeit with some problems if you have other scripts looking for particular spell IDs, although NWNX can work around this).

They can be combined with On Hit properties (see iprp_onhit.2da) although they usually have % chances to fire, the On Hit: Cast Spell properties happen 100% of the time.

When added to ammunition a bug is present: if the last arrow/bolt/bullet is fired then the On Hit: Cast Spell fails since the projectile lands after the ammunition is destroyed.

You can also apply this to creature hides, armor and shields. It triggers when you get hit. However note that if you have a creature with armor equipped it takes precedence over the creature hide. A shield if equipped always fires however.

Note that in cases of the plot flag, On Hit: Cast Spell will fail to fire at all.

Spell Information Used

The spells will have this set of information when "cast" in the triggering script and acts very similar to the Cast Spell item property (Eg scrolls, potions etc.):

  • Caster (OBJECT_SELF): The attacker
  • Target: The target of the attack
  • Cast item: The weapon with the item property that hit
    • To test if the casting item is a weapon with a On Hit: Property rather than it being a scroll or "Use" item property check the item properties on the item
    • Note while GetLastSpellCastClass() starts as CLASS_TYPE_INVALID it changes to the casters last spell casting class so don't use it, only check the item
  • Caster level: 1 - 40 - set on the item property
  • Spell save DC: Automatically assigned as if the character had 16 (+3) ability score, and using the Innate spell level. EG: level 0 is DC of 13, level 9 a DC of 22. You can obviously override this in the spell script.

Since you can set any caster level you might have for things like caster level of 1 for a high level spell - this may cause unintentional effect to expire very quickly for instance.

2da Columns

Since the 2da is hardcoded changing any of these values isn't that useful, except maybe if you've replaced Knock or the Dispel spells with alternatives and need to rename or alter them.

Column LabelExample

Valid Values

Description and Notes
LabelSleepHuman readable stringUnused by the game
Name750Dialog.tlk string reference

The TLK entries simply state the number - eg; 750 is "Acid Fog". Usually the same TLK string is used in spells.2da

SpellIndex0Index into spells.2daSpell to fire on hit
Cost0.5FloatSee parent page on how costs are calculated. Bioware tended to use the innate spell level, or 0.5 for cantrips.

2da Contents

2DA V2.0

      Label                          Name    SpellIndex   Cost   
0     Acid_Fog                       750     0            6      
1     Bestow_Curse                   754     4            3      
2     ****                           ****    ****         ****      
3     Blindness_and_Deafness         758     8            2      
4     Call_Lightning                 761     11           3      
5     Chain_Lightning                764     14           6      
6     Cloudkill                      773     23           5      
7     Confusion                      776     26           3      
8     Contagion                      777     27           3      
9     Darkness                       786     36           2      
10    Daze                           787     37          0.5     
11    Delayed_Blast_Fireball         789     39           7      
12    Dismissal                      790     40           4      
13    Dispel_Magic                   791     41           3      
14    Doom                           796     46           1      
15    Energy_Drain                   801     51           9      
16    Enervation                     802     52           4      
17    Entangle                       803     53           1      
18    Fear                           804     54           3      
19    Feeblemind                     805     55           5      
20    Fire_Storm                     807     57           7      
21    Fireball                       808     58           3      
22    Flame_Lash                     810     60           2      
23    Flame_Strike                   811     61           4      
24    Ghoul_Touch                    814     64           2      
25    Grease                         816     66           1      
26    Greater_Dispelling             817     67           5      
27    Greater_Spell_Breach           822     72           6      
28    Gust_of_Wind                   2682    75           3      
29    Hammer_of_the_Gods             826     76           4      
30    Harm                           827     77           6      
31    Hold_Animal                    831     81           2      
32    Hold_Monster                   832     82           4      
33    Hold_Person                    833     83           2      
34    Implosion                      837     87           9      
35    Incendiary_Cloud               839     89           8      
36    Lesser_Dispel                  844     94           2      
37    ****                           ****    ****        0.5      
38    Lesser_Spell_Breach            848     98           4      
39    ****                           ****    ****        0.5      
40    Light                          850     100         0.5     
41    Lightning_Bolt                 851     101          3      
42    Magic_Missile                  857     107          1      
43    Mass_Blindness_and_Deafness    860     110          8      
44    Mass_Charm                     861     111          8      
45    Melfs_Acid_Arrow               865     115          2      
46    Meteor_Swarm                   866     116          9      
47    Mind_Fog                       868     118          5      
48    ****                           ****    ****        0.5      
49    Phantasmal_Killer              877     127          4      
50    Poison                         879     129          3      
51    Power_Word_Kill                881     131          9      
52    Power_Word_Stun                882     132          7      
53    ****                           ****    151          1      
54    Scare                          905     155          1      
55    Searing_Light                  906     156          3      
56    Silence                        913     163          2      
57    Slay_Living                    ****    164          5      
58    Sleep                          915     165          1      
59    Slow                           916     166          3      
60    Sound_Burst                    917     167          2      
61    Stinking_Cloud                 921     171          3      
62    ****                           ****    172          4      
63    Storm_of_Vengeance             923     173          9      
64    Sunbeam                        933     183          7      
65    Vampiric_Touch                 938     188          3      
66    Wail_of_the_Banshee            940     190          9      
67    Wall_of_Fire                   ****    ****         ****
68    Web                            942     192          2      
69    Weird                          943     193          9      
70    Word_of_Faith                  944     194          7      
71    ****                           ****    ****         ****      
72    Creeping_Doom                  6330    364          7      
73    Destruction                    6332    366          7      
74    Horrid_Wilting                 6333    367          8      
75    Ice_Storm                      6334    368          5      
76    Negative_Energy_Burst          6336    370          3      
77    Evards_Black_Tentacles         6341    375          4      
78    ****                           ****    386          1      
79    Flare                          56      416         0.5     
80    Bombardment                    382     423          8      
81    Acid_Splash                    383     424         0.5     
82    Quillfire                      1773    425          3      
83    Earthquake                     384     426          8      
84    Sunburst                       385     427          8      
85    Banishment                     387     430          6      
86    Inflict_Minor_Wounds           ****    431         0.5     
87    Inflict_Light_Wounds           ****    432          1      
88    Inflict_Moderate_Wounds        ****    433          2      
89    Inflict_Serious_Wounds         ****    434          3      
90    Inflict_Critical_Wounds        ****    435          4      
91    BalagarnsIronHorn              502     436          2      
92    Drown                          508     437          6      
93    Electric_Jolt                  1852    439         0.5     
94    Firebrand                      1895    440          5      
95    Wounding_Whispers              2362    441          3      
96    Undeaths_Eternal_Foe           2365    444          9      
97    Inferno                        2368    446          5      
98    Isaacs_Lesser_Missile_Storm    2377    447          4      
99    Isaacs_Greater_Missile_Storm   2378    448          6      
100   Bane                           2663    449          1      
101   Spike_Growth                   2671    454          3      
102   Tashas_Hideous_Laughter        2678    457          2      
103   Bigbys_Interposing_Hand        2683    459          5      
104   Bigbys_Forceful_Hand           2684    460          6      
105   Bigbys_Grasping_Hand           2685    461          7      
106   Bigbys_Clenched_Fist           2686    462          8      
107   Bigbys_Crushing_Hand           2687    463          9      
108   Flesh_to_stone                 3044    485          6      
109   Stone_to_flesh                 3046    486          6      
110   Crumble                        3837    512          6      
111   Infestation_of_Maggots         3844    513          3      
112   Great_Thunderclap              3850    515          7      
113   Ball_Lightning                 3853    516          5      
114   Gedlees_Electric_Loop          3863    520          2      
115   Horizikauls_Boom               3865    521          1      
116   Mestils_Acid_Breath            3869    523          3      
117   Scintillating_Sphere           3879    526          3      
118   Undeath_to_Death               2796    528          6      
119   Stonehold                      3778    547          6      
120   ****                           ****    ****         **** 
121   Evil_Blight                    8943    566          5      
122   ONHIT_Teleport                 83473   668          1   
123   ONHIT_SlayRakshasa             83565   689          3  
124   ONHIT_FireDamage               83614   696          3      
125   ONHIT_UniquePower              83675   700          0.5      
126   ONHIT_PlanarRift               83771   702          3      
127   OnHIT_Darkfire                 83829   703          3      
128   ****                           ****    ****         ****
129   OnHitFlamingSkin               83888   721          1      
130   OnHit_ChaosShield              83474   669          6   
131   ****                           ****    ****         ****  
132   OnHitRuinArmorBebilith         84424   756          5
133   OnHitDemilichTouch             84433   758          9
134   OnHitDracolichTouch            84440   760          8
135   Intelligent_Weapon_OnHit       84474   768          1
136   OnHitParalyze                  84608   788          8
137   OnHitDeafenClang               85387   790          6
138   OnHitKnockDown                 85454   791          5
139   OnHitFreeze                    85455   792          5
140   Combust                        3859    518          5
  • No labels