Difference between revisions of "EffectAbilityDecrease"

From NWN Lexicon
Jump to: navigation, search
(Created page with " =EffectAbilityDecrease(int, int)= Creates an ability decreasing effect on specified ability score. effect  EffectAbilityDecrease(     [[int ...")
 
Line 7: Line 7:
 
Creates an ability decreasing effect on specified ability score.
 
Creates an ability decreasing effect on specified ability score.
  
 +
<nwscript>
 
  [[effect | effect ]] EffectAbilityDecrease(
 
  [[effect | effect ]] EffectAbilityDecrease(
 
      [[int | int ]] nAbility,
 
      [[int | int ]] nAbility,
 
      [[int | int ]] nModifyBy
 
      [[int | int ]] nModifyBy
 
  );
 
  );
 +
</nwscript>
  
 
====Parameters====
 
====Parameters====
Line 42: Line 44:
 
====Example====
 
====Example====
  
<font color="#007f00">// Sample code for applying 1 strength damage to a target
+
<nwscript>
  </font>
+
// Sample code for applying 1 strength damage to a target
  <font color="#0000ff">void</font> main()
+
   
 +
  void main()
 
  {
 
  {
     <font color="#007f00">// This is the Object to apply the effect to.
+
     // This is the Object to apply the effect to.
</font>    <font color="#0000ff">object</font> oTarget = <font color="#0000ff">OBJECT_SELF</font>;
+
    object oTarget = OBJECT_SELF;
 
   
 
   
     <font color="#007f00">// Create the effect to apply
+
     // Create the effect to apply
</font>    <font color="#0000ff">effect</font> eDrain = EffectAbilityDecrease(ABILITY_STRENGTH, <font color="#7f007f">1</font>);
+
    effect eDrain = EffectAbilityDecrease(ABILITY_STRENGTH, 1);
 
   
 
   
     <font color="#007f00">// Create the visual portion of the effect. This is instantly
+
     // Create the visual portion of the effect. This is instantly
</font>    <font color="#007f00">// applied and not persistant with wether or not we have the
+
    // applied and not persistant with wether or not we have the
</font>    <font color="#007f00">// above effect.
+
    // above effect.
</font>    <font color="#0000ff">effect</font> eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
+
    effect eVis = EffectVisualEffect(VFX_IMP_REDUCE_ABILITY_SCORE);
 
   
 
   
     <font color="#007f00">// Apply the visual effect to the target
+
     // Apply the visual effect to the target
</font>    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
+
    ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
     <font color="#007f00">// Apply the effect to the object   
+
     // Apply the effect to the object   
</font>    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDrain, oTarget);
+
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eDrain, oTarget);
 
  }
 
  }
 +
</nwscript>
  
 
====See Also====
 
====See Also====

Revision as of 21:34, 25 August 2012



EffectAbilityDecrease(int, int)

Creates an ability decreasing effect on specified ability score.

 [[effect | effect ]] EffectAbilityDecrease(
     [[int | int ]] nAbility,
     [[int | int ]] nModifyBy
 );

Parameters

nAbility

ABILITY_*

nModifyBy

This is the amount by which to decrement the ability score.


Description

Removes specified amount nModifyBy from nAbility score on an object. nModifyBy must be a positive number less than 10; if a negative number is passed, nothing occurs.

The target this effect is applied to must be a creature for it to work. This effect cannot be applied instantly, only temporarily or permanently.



Remarks

Ability Decreases do NOT stack!

Stupidly, unlike EffectAbilityIncrease, only the highest penalty applies.

They do stack with penalties from EffectCurse() (which do not stack in themselves) and EffectNegativeLevel().

It is unknown if multiple penalties to statistics on items stack or not, and likely not.

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 seperately via. looping valid effects on the target (GetFirst/NextEffect()). See the Effect Tutorial for more details.


Version

1.62

Example

 // Sample code for applying 1 strength damage to a target
 
 void main()
 {
     // This is the Object to apply the effect to.
     object oTarget = OBJECT_SELF;
 
     // Create the effect to apply
     effect eDrain = EffectAbilityDecrease(ABILITY_STRENGTH, 1);
 
     // Create the visual portion of the effect. This is instantly
     // applied and not persistant with wether 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, eDrain, oTarget);
 }

See Also

functions: 

EffectAttackIncrease

constants: 

ABILITY_* Constants



 author: Jody Fletcher, editor: Jasperre, additional contributor(s): Matthew Miller, Jeremy Hinkle, LeegleechN, Charles Feduke, Jasperre