Yes, it's possible. You don't need the ondamaged event at all. Just apply DamageImmunity effects to it (or damage resistance, or both).
Here's a sample function that takes a placeable object for its imput - you can tweak it however you like:
void ProtectPhylactery (object oPhyl) {
/* make sure the phylactery has some immunities */
effect eLink = EffectDamageResistance(DAMAGE_TYPE_BLUDGEONING, 20);
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_PIERCING, 20));
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_SLASHING, 20));
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_ACID, 20));
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_COLD, 20));
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_ELECTRICAL, 20));
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_FIRE, 20));
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_SONIC, 20));
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_MAGICAL, 20));
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_NEGATIVE, 20));
eLink = EffectLinkEffects(eLink, EffectDamageResistance(DAMAGE_TYPE_DIVINE, 20));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_SLASHING, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_BLUDGEONING, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_PIERCING, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_ACID, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_COLD, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_ELECTRICAL, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_FIRE, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_SONIC, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_MAGICAL, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_NEGATIVE, 25));
eLink = EffectLinkEffects(eLink, EffectDamageImmunityIncrease(DAMAGE_TYPE_DIVINE, 25));
eLink = ExtraordinaryEffect(eLink);
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oPhyl);
eLink = ExtraordinaryEffect(EffectImmunity(IMMUNITY_TYPE_DEATH));
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oPhyl);
}
The above also makes it immune to instant death effects.
Funky
Modifié par FunkySwerve, 30 juin 2011 - 08:41 .