I started looking into this item property, as I was hoping to allow buffing of various ammo types with the bless spell. The spell does already have a bonus of sorts, but I was considering adding some others …
EG: On Hit Cast Spell: Slay Rakshasa (using IP_CONST_ONHIT_CASTSPELL_ONHIT_SLAYRAKSHASA)
I note that this supposedly adds the “ONHIT_SlayRakshasa” property from the iprp_onhitspell.2da. This in turn is supposed to fire the spell index 689, which fires the x2_s3_slayraks script.
I copied the redundant script from NWN1 data and edited it to fire debug.
Here is the problem … When trying to add this property to a bunch of arrows, it did not appear to take hold. HOWEVER, if I add the property at build time to the arrows, then my debug script does indeed fire!
So, it appears I can add On Hit Cast properties to arrows, but currently, only directly from the toolset, as this ItemPropertyOnHitCastSpell property does not appear to work with ammo. Now, it may work with normal weapons, I guess, but I have not had time to test it yet.
Anyway, does anyone know if this function can add On Hit Cast properties to “normal” weapons (not ammo), and/or, should this also have worked with ammo?
I suppose I can do some kind of item replacement upon casting if need be, but I’d rather simply add the property if possible. i.e. Switch the target stack with a stack with the property already on them. And I believe I should be able to address the “badstref” where the old 2da line is left blank (because there are no official Rakshasa’s in NWN2).
I would just like to know if anyone has been able to ascertain the limitations (or not) when it comes to applying this property to weapon items.
Thanks in advance. Must sleep now.
before I go, here is a snippet of the Bless spell script I was playing around with …
if(GetObjectType(oTarget) == OBJECT_TYPE_ITEM)
{
// BLESSED AMMUNITION (ARROW = 20 BOLT = 25 BULLET = 27)
int AmmoType = GetBaseItemType(oTarget);
if (AmmoType == 20 || AmmoType == 25 || AmmoType == 27)
{
SendMessageToAllPCs(GetName(oCaster) + " blesses the ammunition.");
itemproperty ipBonusDamage = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_PIERCING, IP_CONST_DAMAGEBONUS_1);
if(AmmoType == 27){ipBonusDamage = ItemPropertyDamageBonus(IP_CONST_DAMAGETYPE_BLUDGEONING, IP_CONST_DAMAGEBONUS_1);}
IPSafeAddItemProperty(oTarget, ipBonusDamage, fDuration, X2_IP_ADDPROP_POLICY_KEEP_EXISTING);
// RAKSHASA SLAY PROPERTY (ARROWS AND BOLTS ONLY) (IP_CONST_ONHIT_CASTSPELL_ONHIT_SLAYRAKSHASA)
/*
if(AmmoType != 27)
{
IPSafeAddItemProperty(oTarget, ItemPropertyOnHitCastSpell(123,1), fDuration, X2_IP_ADDPROP_POLICY_KEEP_EXISTING );
SendMessageToAllPCs(GetName(oCaster) + " ADDED PROPERTY TO AMMO.");
}*/
SignalEvent(GetItemPossessor(oTarget), EventSpellCastAt(OBJECT_SELF, SPELL_BLESS, FALSE));
ApplyEffectToObject(nDurType, eVis, GetItemPossessor(oTarget), fDuration);
return;
}
}