Working on a range of feats for new races that give damage resistance. They are auto-activated feats (persistent/active).
I set up 3 targets, each one with one of the feats DR 5/Slashing, DR5/Bludgeoning and DR5/Piercing. I dropped 3 weapons in my test module, one of each type of damage and went and attacked the targets.
In almost every test it reported Damage resistance absorbs 0 points of damage. Once or twice it reported reducing the damage but then couldn't get it to duplicate - that happened after i went in as DM, possessed the creature and activated the feat manually... but i feel that may be a red herring.
I thought i spotted the problem in that i had iType and iSpecific backwards in my EffectDamageResistance function - but tried changing them around and same results occurred. I've not tested the other types yet either so not sure if they are working.
So, before i break my head against this and get into more in-depth debugging, let me ask: anyone got any experience with this function, especially with using physical damage types? Spot anything that i'm doing stupid?
/* Feat created by Agony_Aunt/Loki_999 for SCoD PW
adds DR effect to target */
//#include "nw_i0_spells"
#include "x2_inc_spellhook"
const int FEAT_DR_CI10 = 2290;
const int FEAT_DR_EVIL10 = 2291;
const int FEAT_DR_MAGIC10 = 2292;
const int FEAT_DR_MAGIC15 = 2293;
const int FEAT_DR_BLUDG15 = 2294;
const int FEAT_DR_LAW15 = 2295;
const int FEAT_DR_AS5 = 2296;
const int FEAT_DR_AS10 = 2297;
const int FEAT_DR_BLUDG5 = 2298;
const int FEAT_DR_SLASH5 = 2299;
const int FEAT_DR_PIERCE5 = 2321;
void main()
{
//SpeakString("Firing Aura");
if (!X2PreSpellCastCode())
{
// If code within the PreSpellCastHook (i.e. UMD) reports FALSE, do not run this spell
return;
}
object oTarget = GetSpellTargetObject();
if (!GetHasSpellEffect(GetSpellId(), oTarget))
{
int iFeat = GetSpellFeatId();
int iAmount;
int iType;
int iSpecific;
switch(iFeat)
{
case FEAT_DR_CI10: iAmount=10; iType=DR_TYPE_GMATERIAL; iSpecific = GMATERIAL_METAL_COLD_IRON; break;
case FEAT_DR_EVIL10: iAmount=10; iType=DR_TYPE_ALIGNMENT; iSpecific = ALIGNMENT_EVIL; break;
case FEAT_DR_MAGIC10: iAmount=10; iType=DR_TYPE_DMGTYPE; iSpecific = DAMAGE_TYPE_MAGICAL; break;
case FEAT_DR_MAGIC15: iAmount=15; iType=DR_TYPE_DMGTYPE; iSpecific = DAMAGE_TYPE_MAGICAL; break; // check this to be used and not IP_CONST
case FEAT_DR_BLUDG15: iAmount=15; iType=DR_TYPE_DMGTYPE; iSpecific = DAMAGE_TYPE_ALL; break; // bug in definitions, ALL = BLUDGEONING and vice versa
case FEAT_DR_LAW15: iAmount=15; iType=DR_TYPE_ALIGNMENT; iSpecific = ALIGNMENT_LAWFUL; break;
case FEAT_DR_AS5: iAmount=5; iType=DR_TYPE_GMATERIAL; iSpecific = GMATERIAL_METAL_ALCHEMICAL_SILVER; break;
case FEAT_DR_AS10: iAmount=10; iType=DR_TYPE_GMATERIAL; iSpecific = GMATERIAL_METAL_ALCHEMICAL_SILVER; break;
case FEAT_DR_BLUDG5: iAmount=5; iType=DR_TYPE_DMGTYPE; iSpecific = DAMAGE_TYPE_ALL; break; // bug in definitions, ALL = BLUDGEONING and vice versa
case FEAT_DR_SLASH5: iAmount=5; iType=DR_TYPE_DMGTYPE; iSpecific = DAMAGE_TYPE_SLASHING; break;
case FEAT_DR_PIERCE5: iAmount=5; iType=DR_TYPE_DMGTYPE; iSpecific = DAMAGE_TYPE_PIERCING; break;
}
effect eRes = EffectDamageReduction(iAmount, iSpecific, 0, iType);
eRes = SupernaturalEffect(eRes);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eRes, oTarget);
}
}





Retour en haut







