Author Topic: Placeables and Applying Damage Type Immunities  (Read 334 times)

Legacy_Guest_Chrysoli_*

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Placeables and Applying Damage Type Immunities
« on: June 30, 2011, 07:56:44 pm »


               Is it possible to have a usable, placeable object that can only be damaged or destroyed by fire or acid attacks ... i.e. - immune to all other types of damage or attacks?

I'm looking to restrict the way a player can harm this placeable to either fire or acid based spells, fire or acid arrows, or fire or acid grenades. I've having a heck of a time figuring out how to approach the scripting for this concept.

Scripting for the OnDamage event let me easily narrow down the damage taken to what (if any) was fire or acid damage - after the fact. However, I discovered from the Lexicon that I cannot *heal* placeables (to restore non-fire or non-acid damage hit points).

Is it possible to do something like this ... and if so - any pointers would be very much appreciated.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Placeables and Applying Damage Type Immunities
« Reply #1 on: June 30, 2011, 09:41:27 pm »


               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 .
                     
                  


            

Legacy_Guest_Chrysoli_*

  • Jr. Member
  • **
  • Posts: 53
  • Karma: +0/-0
Placeables and Applying Damage Type Immunities
« Reply #2 on: July 01, 2011, 05:18:40 am »


               Thank you so much. That's as simple as that - without the fire or acid immunity boosts and it's what I'm looking for. I feel a little sheepish right now - I should have known this - in fact - I believe I did know this was - some years back. Oh boy, this is getting a little scary how the mind can draw such a complete blank!

Thank you again!