That ended up being easier than I thought, though I'm sure it can be improved. This is just the OnHit spell script itself. I'll leave you to apply the item property to the weapon.
A word of caution: unless you're using nwnx_combat, only one OnHit Cast Spell property fires on a given weapon per hit. That means this will conflict with spells like Darkfire that add OnHit Cast Spell item properties. If this is too big a compromise, I suggest trying ShadoOow's method above.
// The base DC to resist any effect from dirty fighting.
const int DIRTY_FIGHTING_DC_BASE = 10;
// A number to add to the DC for each attack the PC loses to use dirty fighting.
const int DIRTY_FIGHTING_DC_MOD = 5;
// A number to add to the DC for the various types of effects. Use to make some
// abilities harder or easier to resist to avoid over/underpowered effects.
const int DIRTY_FIGHTING_DC_MOD_BLINDNESS = 0;
const int DIRTY_FIGHTING_DC_MOD_KNOCKDOWN = 0;
const int DIRTY_FIGHTING_DC_MOD_STUNNED = 0;
const int DIRTY_FIGHTING_DC_MOD_DAZED = 0;
const int DIRTY_FIGHTING_DC_MOD_SLOW = 0;
void main()
{
object oPC = OBJECT_SELF;
object oTarget = GetSpellTargetObject();
// Sanity check
if (GetObjectType(oTarget) != OBJECT_TYPE_CREATURE) return;
// Figure out how many attacks oPC is giving up to perform this move.
int nHD = GetHitDice(oPC);
int nBAB = GetBaseAttackBonus(oPC);
int nAttacks;
// BAB increases after 21st level don't increase the number of attacks. If
// he's epic level, we need to figure attacks based on his pre-epic BAB.
if (nHD > 20)
nAttacks = (nBAB - (nHD - 17) / 2) / 5;
else
nAttacks = (nBAB - 1) / 5;
// This basic DC can be modified later depending on the effect.
int nDC = DIRTY_FIGHTING_DC_BASE + (DIRTY_FIGHTING_DC_MOD * nAttacks);
// Randomly determine the effects of the hit. Could change the die size and
// cases to prefer some effects over others.
effect eDirty;
switch (d6())
{
case 1:
nDC += DIRTY_FIGHTING_DC_MOD_BLINDNESS;
eDirty = EffectBlindness();
break;
case 2:
nDC += DIRTY_FIGHTING_DC_MOD_KNOCKDOWN;
eDirty = EffectKnockdown();
break;
case 3:
nDC += DIRTY_FIGHTING_DC_MOD_STUNNED;
eDirty = EffectStunned();
break;
case 4:
nDC += DIRTY_FIGHTING_DC_MOD_DAZED;
eDirty = EffectDazed();
break;
case 5:
nDC += DIRTY_FIGHTING_DC_MOD_SLOW;
eDirty = EffectSlow();
break;
case 6:
return; // Nothing!
}
// If we fail our save, apply the effect!
if (!ReflexSave(oTarget, nDC))
ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDirty, oTarget, 6.0);
}
Modifié par Squatting Monk, 02 février 2014 - 05:59 .