SpellsGenericAreaOfEffect

From NWN Lexicon
Jump to navigationJump to search


spellsGenericAreaOfEffect(object, location, int, float, int, effect, effect, effect, int, float, int, int, int, int, int, int, int, int, int, int, int, int)

Generic apply area of effect wrapper.

void spellsGenericAreaOfEffect(
    object oCaster,
    location lTargetLoc,
    int nShape,
    float fRadiusSize,
    int nSpellID,
    effect eImpact,
    effect eLink,
    effect eVis,
    int nDurationType = DURATION_TYPE_INSTANT,
    float fDuration = 0.0,
    int nTargetType = SPELL_TARGET_ALLALLIES,    
    int bHarmful = FALSE,
    int nRemoveEffectSpell = FALSE,    
    int nRemoveEffect1 = 0,
    int nRemoveEffect2 = 0,
    int nRemoveEffect3 = 0,
    int bLineOfSight = FALSE,
    int nObjectFilter = OBJECT_TYPE_CREATURE,
    int bPersistentObject = FALSE,
    int bResistCheck = FALSE,
    int nSavingThrowType = SAVING_THROW_NONE,    
    int nSavingThrowSubType = SAVING_THROW_TYPE_ALL
);

Parameters

oCaster

The creature that cast the spell.

lTargetLoc

The location where you want to apply the effect.

nShape

Radius around the caster to apply the effect to. SHAPE_* See remarks.

fRadiusSize

The size of nShape. RADIUS_SIZE_*

nSpellID

SPELL_*

eImpact

The visual effect you want to apply to lTargetLoc.

eLink

Linked effects to apply to each individual target.

eVis

The visual effect you want to apply to each individual target.

nDurationType

The duration type for the eLink effect. DURATION_TYPE_* (Default: DURATION_TYPE_INSTANT)

fDuration

The duration time for the eLink effect. (Default: 0.0)

nTargetType

Within the shape, what type of objects to apply the effects to. See remarks. (Default: SPELL_TARGET_ALLALLIES)

bHarmful

Determines if the spell is harmful to its target. (Default: FALSE)

nRemoveEffectSpell

Is this a remove effect spell? (Default: FALSE)

nRemoveEffect1

First effect, if any, to remove. (Default: 0)

nRemoveEffect2

Second effect, if any, to remove. (Default: 0)

nRemoveEffect3

Third effect, if any, to remove. (Default: 0)

bLineOfSight

This can be used to ensure that spell effects do not go through walls. (Default: FALSE)

nObjectFilter

Restrict results to this object type. OBJECT_TYPE_* (Default: OBJECT_TYPE_CREATURE)

bPersistentObject

Apply the effect to the calling object? See remarks. (Default: FALSE)

bResistCheck

Attempt spell resistance or not? (Default: FALSE)

nSavingThrowType

The type of saving throw to attempt to roll. SAVING_THROW_* (Default: SAVING_THROW_NONE)

nSavingThrowSubType

A more specific saving throw to attempt to roll. SAVING_THROW_TYPE_* (Default: SAVING_THROW_TYPE_ALL)


Description

Generic apply area of effect wrapper.



Remarks

As you can see by the parameter list (22 of them!) this function is quite configurable. Be aware that sometimes choosing one option will exclude using another option.

If bPersistentObject is TRUE, then the target to apply the effect to is generated by GetFirstObjectInShape .

Valid values for nTargetType (used in selecting individual targets) are:
  - SPELL_TARGET_ALLALLIES: All friendlies and anyone in the party.
  - SPELL_TARGET_SELECTIVEHOSTILE: Only harms enemies, ever.
  - SPELL_TARGET_STANDARDHOSTILE: This one is much more complex than the other two. Note the use of () and capital ORs and ANDs to denote nested conditions.
    * Not friendly.
    * oTarget hit themselves or their pet (familiar, summons, etc) with a spell.
    * (if oTarget is a PC OR the module flag "X0_G_ALLOWSPELLSTOHURT" is 10) AND oTarget is not friendly with oSource.
    * (not friendly AND the difficulty setting is greater than GAME_DIFFICULTY_NORMAL) AND the module switch "MODULE_SWITCH_ENABLE_NPC_AOE_HURT_ALLIES" is TRUE.

If nRemoveEffectSpell is FALSE, there is no need to set nRemoveEffect1, nRemoveEffect2, or nRemoveEffect3. If nRemoveEffectSpell is TRUE, the target must fail BOTH their spell resistance and saving throw tests in order for the specified effects to be removed. You can force these failures by setting bResistCheck to FALSE and nSavingThrowType to SAVING_THROW_NONE. If bResistCheck is TRUE, then each target will attempt to beat oCaster's spell resistance and thus avoid the spell.

If the target fails the spell resistance check, then they will attempt a saving throw roll (nSavingThrowType and nSavingThrowSubType). Should they fail, it is then time to zap them with the chosen effect.

If nSavingThrowType is set to SAVING_THROW_NONE, then there is no need to set nSavingThrowSubType.

eImpact and eVis are both optional. Set them to zero if you do not want a visual effect applied.


Requirements

#include " x0_i0_spells "


Version

???

See Also

functions: 

ApplyEffectAtLocation

constants: 

SPELL_*



author: Mistress