![]() |
![]() |
|||||||||||||||||||||||
|
|
||||||||||||||||||||||||
|
Adding & Removing Effects Intended Audience: [Printer Friendly / Syntax Highlight] If you scroll down the list of commands in your script editor, you will see a long list of commands that begin with the word 'Effect'. These are the basis for building all spells, special abilities and visual effects in the game. There are two commands that allow you to use them: ApplyEffectToObject and ApplyEffectAtLocation. Both of them are very similar in their structure, except the former targets a specific object (creature, item, placeable object, etc) and the other targets a specific location (a point in space). void ApplyEffectToObject (int nDurationType, effect eEffect, object oTarget, float fDuration=0.0f) Duration Type: the 'nDurationType' is asking for a constant that begins with DURATION_TYPE_*, of which there are only three. DURATION_TYPE_INSTANT would apply to any effect that is both immediate and permanent and cannot be removed. EffectDamage would be one example, as well as any of the 'fire-and-forget' visual effects. If not instant, the constant must be either DURATION_TYPE_PERMANENT or DURATION_TYPE_TEMPORARY. Permanent is as it sounds... the effect lasts until removed or dispelled. A temporary duration means that the effect must have a duration specified in the command (and is the only time this is so). Effect: This is the specific effect that you are going to use. It is common to define an effect variable first which contains all the pertinent information of the effect command, and then use that variable when applying... but it is not required. Target: this will either be the object (in ApplyEffectToObject) or the location (in ApplyEffectAtLocation). It can be declared seperately in a variable or defined in the command. Duration: a duration (in seconds) is only required for effects of DURATION_TYPE_TEMPORARY. When specified, it must be as a float... meaning the number must have a decimal place. So put '3.0' for 3 seconds, or '10.5' for 10 and a half seconds. Some Examples of Effects - on the use of an object, polymorph the user into a pixie - an item with the Unique Spell property (with the tag "WONDERFUL_WAND" that heals and hastes the target for 30 seconds: - in a creature's OnUserDefined, when an event #100 is sent, a generic bugbear is summoned without effects at a waypoint tagged "SUMMON_POINT": Visual Effects VFX_BEAM_* = these are the different types of beam visuals, and while grouped with the other visual effects, these constants are used with EffectBeam and not with EffectVisualEffect. This is an example of a magic well which, when used, creates an effect on itself and then applies a strength increase with an effect to the target (but can only be used once by them... if they use it again it strikes them with lightning for 8d6 damage): Removing Effects The thing to know about removing effects is that an effect has a unique 'pointer' established when it is applied. If you define a new effect variable later and define it as a similar type of effect, RemoveEffect will not target it. The easiest way to remove an effect is to scroll through the current effects that are applied to a target through the use of GetFirstEffect and GetNextEffect... and then filter out the specific effect you are looking for. Once you have found it (or them if you are removing more than one effect at a time) the pointer is set to the correct effect and you can remove it. The following commands are useful for filtering: GetEffectCreator = if you want to specify only effects that were applied by specific creatures or objects the basic script for removing an effect looks like this:
an example of removing a curse effect applied by a witch (with the tag "EVIL_WITCH") off of dialogue: Some Things To Be Aware Of - EffectKnockdown causes a crash when applied by anything other than a creature (will be fixed in next patch) - EffectHitPointChangeWhenDying doesn't work (will be fixed in next patch) - All effects are not permanent... they do not save with the character back to the vault, but will persist within the current module. The longest effect type currently is the extraordinary effect, which will resist dispel magic effects and resting. ExtraordinaryEffect and SupernaturalEffect are applied when declaring the effect command: effect eEffect = ExtraordinaryEffect (EffectSilence());
|
|||||||||||||||||||||||
|
|
||
|
Multiplayer Games at Neverwinter Connections
|
||
|
Buy Premium Modules
|
||
|
5,048,340 BioWare Users:
|
||