To avoid this I'm trying to have the script scan all the target's equipped items for 100% damage immunity effects, and if it finds one, change my script's matching damage immunity effect to EffectDarkVision (randomly picked useless effect). As far as I can tell, the problem is detecting the damage immunity item property. I've checked that the script does look through the equipped items and their properties, it just won't detect the fire immunity iprop on the elemental I've been testing with (yes, I did make sure the elemental has a hide with fire immunity), so the script still keeps applying the default +50% fire damage immunity effect on it and making it take extra fire damage. What am I doing wrong here? I'll only the post the parts relevant to the problem:
int nDamageImmunityPercent = 50;
effect eDamageImmunity1 = EffectDamageImmunityIncrease(DAMAGE_TYPE_ACID, nDamageImmunityPercent);
effect eDamageImmunity2 = EffectDamageImmunityIncrease(DAMAGE_TYPE_BLUDGEONING, nDamageImmunityPercent);
// Same thing with all possible damage types, won't post all. Skipping to relevant part
for(nSlotNum = 0; nSlotNum < NUM_INVENTORY_SLOTS; nSlotNum++)
{
oItem = GetItemInSlot(nSlotNum, oTarget);
if(GetIsObjectValid(oItem))
{
iProp = GetFirstItemProperty(oItem);
while (GetIsItemPropertyValid(iProp))
{
if (iProp == ItemPropertyDamageImmunity(DAMAGE_TYPE_ACID, 100))
//Here's the problem
{
eDamageImmunity1 = EffectDarkVision();
}
else if (iProp == ItemPropertyDamageImmunity(DAMAGE_TYPE_FIRE, 100))
{
eDamageImmunity6 = EffectDarkVision();
}
// All damage types again...
iProp = GetNextItemProperty(oItem);
}
}
}
eLink = eDamageImmunity1;
eLink = EffectLinkEffects(eLink, eDamageImmunity2);
eLink = EffectLinkEffects(eLink, eDamageImmunity3);
// all damage types again...
eLink = SupernaturalEffect(eLink);
eLink = SetEffectSpellId(eLink, nSpellId);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oTarget);
Modifié par manageri, 02 octobre 2013 - 10:27 .





Retour en haut






