EffectPoison(int)
Create a Poison effect.
effect EffectPoison( int nPoisonType );
Parameters
nPoisonType
The type of poison to use, as defined in the POISON_* constant group.
Description
Returns a new effect object that when applied to the target will cause them to be Poisoned with the nPoisonType type of posion as defined in the POISON_* constant group.
Remarks
Notes: Most Poisons do not do hit point damage. Poison effects do not currently stack, they overwrite each other. If the target makes his Saving Throw for the initial effect, he will by default save against the secondary effect.
Constructors are special methods that return a new instance of an object. In NWN Script each effect that you can place on an object has it’s own constructor that creates a new instance of the specified effect. This effect object can then be used in an ApplyEffectToObject() Command. See Effect Constructor for more details.
Version
1.22
Example
/* Place this in the OnUsed event of an object. It will remove all bad effects and then cause a new poison to attempt to infect the user of the object each time it is used. It loops through all poison defined in the game. */ //Returns TRUE if any negative effects are found on the target and removes them. int RemoveEffects(object oTarget); void main() { int nCurrentEffect; int nNextEffect; effect ePoison; object oPC; string sPoison; nCurrentEffect = GetLocalInt(OBJECT_SELF,"nCurrentEffect"); ePoison = EffectPoison(nCurrentEffect); oPC = GetLastUsedBy(); if(RemoveEffects(oPC)){ SendMessageToPC(oPC,"Negative Effects removed."); return; } SendMessageToPC(oPC,"Applying Poison number " + IntToString(nCurrentEffect)); ApplyEffectToObject(DURATION_TYPE_TEMPORARY,ePoison,oPC,30.0f); if( nCurrentEffect == 43) { nNextEffect=0; }else{ nNextEffect=nCurrentEffect+1; } SetLocalInt(OBJECT_SELF,"nCurrentEffect",nNextEffect); SendMessageToPC(oPC,"Next Poison number " + IntToString(nNextEffect)); return; } //Returns TRUE if any negative effects are found on the target and removes them. int RemoveEffects(object oTarget) { //Declare major variables effect eVisual = EffectVisualEffect(VFX_IMP_RESTORATION); int bValid = FALSE; effect eBad = GetFirstEffect(oTarget); //Search for negative effects while(GetIsEffectValid(eBad)) { if (GetEffectType(eBad) == EFFECT_TYPE_ABILITY_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_AC_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_ATTACK_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_DAMAGE_IMMUNITY_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SAVING_THROW_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SPELL_RESISTANCE_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_SKILL_DECREASE || GetEffectType(eBad) == EFFECT_TYPE_BLINDNESS || GetEffectType(eBad) == EFFECT_TYPE_DEAF || GetEffectType(eBad) == EFFECT_TYPE_PARALYZE || GetEffectType(eBad) == EFFECT_TYPE_NEGATIVELEVEL || GetEffectType(eBad) == EFFECT_TYPE_FRIGHTENED || GetEffectType(eBad) == EFFECT_TYPE_DAZED || GetEffectType(eBad) == EFFECT_TYPE_CONFUSED || GetEffectType(eBad) == EFFECT_TYPE_POISON || GetEffectType(eBad) == EFFECT_TYPE_DISEASE ) { //Remove effect if it is negative. RemoveEffect(oTarget, eBad); bValid = TRUE; } eBad = GetNextEffect(oTarget); } if(bValid) ApplyEffectToObject(DURATION_TYPE_INSTANT, eVisual, oTarget); return bValid; }
See Also
functions: | EffectDisease |
categories: | Effects Functions |
constants: | POISON_* Constants |
author: John Shuell
Send comments on this topic.