Additional info (this is how it looks in spellhook script):
This function is located at the end of default spellhook, right after tag-based scripting OnSpellCastAt event:
//-----------------------------------------------------------------------
// Prevent any spell that has no special coding to handle targetting of items
// from being cast on items. We do this because we can not predict how
// all the hundreds spells in NWN will react when cast on items
//-----------------------------------------------------------------------
if (nContinue) {
nContinue = X2CastOnItemWasAllowed(oTarget);
}
And this is how it works (also from the spellhook):
//------------------------------------------------------------------------------
// GZ: This is a filter I added to prevent spells from firing their original spell
// script when they were cast on items and do not have special coding for that
// case. If you add spells that can be cast on items you need to put them into
// des_crft_spells.2da
//------------------------------------------------------------------------------
int X2CastOnItemWasAllowed(object oItem)
{
int bAllow = (Get2DAString(X2_CI_CRAFTING_SP_2DA,"CastOnItems",GetSpellId()) == "1");
if (!bAllow)
{
FloatingTextStrRefOnCreature(83453, OBJECT_SELF); // not cast spell on item
}
return bAllow;
}
(form x2_inc_craft.nss)
// 2da for matching spells to properties
const string X2_CI_CRAFTING_SP_2DA = "des_crft_spells" ;
End of additional info
'>