Difference between revisions of "EffectMissChance"

From NWN Lexicon
Jump to: navigation, search
(Reworded because instant application possible but not proper usage)
m (See Also: added EffectConcealment to See Also)
 
(2 intermediate revisions by the same user not shown)
Line 18: Line 18:
 
''nMissChanceType''
 
''nMissChanceType''
  
[[ miss_chance_type | MISS_CHANCE_TYPE_NORMAL ]])
+
Refer to [[miss_chance_type | MISS_CHANCE_TYPE_* Constants]].
  
 
<br />
 
<br />
Line 58: Line 58:
  
 
{| class="seealso"
 
{| class="seealso"
 +
| width="1px" align="right" valign="top" | <font color="gray">functions: </font>
 +
|
 +
[[EffectConcealment]]
 +
|-
 
|-
 
|-
 
| width="1px" align="right" valign="top" | <font color="gray">constants: </font>
 
| width="1px" align="right" valign="top" | <font color="gray">constants: </font>

Latest revision as of 15:12, 12 July 2019

EffectMissChance(int, int)

Creates a miss chance effect.

effect EffectMissChance(
    int nPercentage,
    MISS_CHANCE_TYPE_NORMAL
);

Parameters

nPercentage

1-100 inclusive

nMissChanceType

Refer to MISS_CHANCE_TYPE_* Constants.


Description

Returns a new effect used to hinder the person it is applied to.

A miss chance percent of 20 means that there is a 20% chance, each attack (even if it misses naturally) that the attack will outright miss.

Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nPercentage < 1 or nPercentage > 100.

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

A drunk creature, or one hindered by a particular spell might have this applied to them - there is no default Bioware spell which uses this.

Do NOT confuse this with EffectConsealment which PROTECTS the creature it is applied to. This hinders attacks - not helps them.

It also doesn't stack - as EffectConsealment, only the highest "To miss" chance applies. Note that Blindness has a 50% miss chance-type effect, as they are blind. 50% is meant to be the highest chance of missing a target (someone in full cover).

It is reported in the combat information as "Attacker Miss Chance XXX%." in normal colors, when they do miss due to this effect.

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.


Version

1.62

Example

// On a lever, we apply a 50% miss chance (50% of the time,
// the targets attacks just miss) on the user of it.
 
void main()
{
    // Declare object and effect
    object oUser = GetLastUsedBy();
    effect eMiss = EffectMissChance(50, MISS_CHANCE_TYPE_NORMAL);
 
    // Apply it to them forever (or until they rest)
    ApplyEffectToObject(DURATION_TYPE_PERMAMENT, eMiss, oTarget);
}

See Also

functions:

EffectConcealment

constants: 

MISS_CHANCE_TYPE_* Constants



 author: John Shuell, editors: Jasperre, Mistress, additional contributors: Lilac Soul, Jasperre