EffectDamageImmunityDecrease(int, int)
Create a Damage Immunity Decrease effect.
effect EffectDamageImmunityDecrease(
int nDamageType,
int nPercentImmunity
);
Parameters
- nDamageType
- DAMAGE_TYPE_* to decrease immunity to
- nPercentImmunity
- The percent amount to lower the targets immunity by. 0 - 100.
Description
Returns a new effect object that when applied to a target will lower the amount of immunity the target has against damage when it is done to them by a certain type defined in the DAMAGE_TYPE constants group.
This effect means if we have 50% damage immunity decrease to fire, we take 50% more damage from any fire damage - so 50 damage would become 75.
The target this effect is applied to must be a creature for it to work. This effect should not be applied instantly, only temporarily or permanently.
Remarks
This will increase damage done to the target if it had no immunity to start with - noting that all increases and decreases of immunity to damage will stack (on hides, items, from effects or whaever) and the maximum is going to be 100% vulnerability (decrease immunity, double damage) or 100% immunity (increased immunity, no damage).
Effect functions are Constructors, which are special methods that help construct effect "objects". You can declare and link effects, and apply them using an ApplyEffectToObject() Command. Once applied, each effect can be got separately via looping valid effects on the target (GetFirst/NextEffect()). See the Effect tutorial for more details.
Effect Breakdown
Damage immunity increases from EffectDamageImmunityIncrease are added up and the decreases from EffectDamageImmunityDecrease are taken off, to get a final "Immunity amount".
This is capped at +100% immunity and down to a minimum of -100% vulnerability. Example effects:
- +100% - Totally immune to all damage of that type, eg 10 damage becomes 0 damage
- 50% - Takes 50% of the damage dealt by that type off the total amount, eg: 10 damage becomes 5 damage
- -50% - Adds 50% more on, so 10 damage becomes 15 damage
- -100% - Adds 100% more on, so 10 damage becomes 20 damage
When damage is applied to an object, it goes through this order: EffectDamageImmunity -> EffectDamageResistance -> EffectDamageReduction.
| nIndex | Parameter Value | Description and Notes |
|---|---|---|
| GetEffectInteger | ||
| 0 | nDamageType - DAMAGE_TYPE_* constants group. | Damage the immunity decrease is for. |
| 1 | nPercentImmunity | Percentage of immunity from this effect. |
Version
This function was updated in 1.89.8193.37 of NWN:EE. EffectDamageImmunityIncrease / EffectDamageImmunityDecrease now correctly calculate the full immunity if applied when already at 100 / -100 immunity.
Example
// Sample code for applying 50% vulnerability to fire to a target
// (or, in other words, a 50% decrease to any immunity it has).
void main()
{
// This is the Object to apply the effect to.
object oTarget = OBJECT_SELF;
// Create the effect to apply
effect eDamageImmunityDecrease = EffectDamageImmunityDecrease(DAMAGE_TYPE_FIRE, 50);
// Create the visual portion of the effect. This is instantly
// applied and not persistent with whether or not we have the
// above effect.
effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
// Apply the visual effect to the target
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
// Apply the effect to the object
ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDamageImmunityDecrease, oTarget);
}
See Also
| functions: | |
| constants: |
author: John Shuell, editor: Jasperre, additional contributor(s): Jasperre