EffectBeam(int, object, int, int, float, vector, vector)

From NWN Lexicon
Jump to: navigation, search

Create a Beam effect.

effect EffectBeam(
    int nBeamVisualEffect,
    object oEffector,
    int nBodyPart,
    int bMissEffect = FALSE,
    float fScale=1.0f,
    vector vTranslate=[0.0,0.0,0.0],
    vector vRotate=[0.0,0.0,0.0]
);

Parameters

nBeamVisualEffect
VFX_BEAM_* Constant defining the visual type of beam to use.
oEffector
The beam is emitted from this creature
nBodyPart
BODY_NODE_* Constant defining where on the creature the beam originates from.
bMissEffect
If this is TRUE, the beam will fire to a random vector near or past the target (Default: FALSE)
fScale
The scaling factor visual transform to apply to the visual effect. NWNEE only. (Default: 1.0f)
vTranslate
The translation vector visual transform to apply to the visual effect. NWNEE only. (Default: [0.0,0.0,0.0])
vRotate
The rotation vector visual transform to apply to the visual effect. NWNEE only. (Default: [0.0,0.0,0.0])

Description

Returns a new effect object defining the beam's properties to use when the effect is applied. This should only be applied to another object. Firing it at a location will not work.

Returns an effect of type EFFECT_TYPE_INVALIDEFFECT if nBeamVisualEffect is not valid.

The target you can apply this to can be any valid (non static) object that ApplyEffectToObject works on, but not a location. This effect should not be applied instantly, only temporarily or permanently.

The objects do not have to be creatures, and placeables work well with beams. Try to use the default chest body node.


Warning icon orange.png Caution: This section documents changes arising in NWN: Enhanced Edition content. The content is available in both the classic version and the Enhanced Edition of the game. However, the behavior may vary in each version. More details may be available in the [1] NWN Enhanced Edition patch notes.

As of 1.80.8193.14, this function now takes optional parameters that allow the scripter to apply visual transforms to the visual effect.

Remarks

Currently only two Body Nodes are defined for us, the Hand and the Chest, for standard NwN. For Hordes (and probably 1.61+) there are nodes for the separate Beholder eye stalks too.

Note that beams with sound, which are not dictated by _SILENT at the end, usually should not be used many at a time, because of the constant sound effect being played. For visuals only, use the _SILENT version of a beam.

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

This function was updated in 1.80.8193.14 of NWN:EE.

Example

// Apply a beam between 2 placeables, tagged as "BEAM1" 
// and "BEAM2". They could, of course, be any kind of 
// visible object, like a Creature or Door.
void main()
{
    // Get the 2 objects
    object oSource = GetObjectByTag("BEAM1");
    object oTarget = GetObjectByTag("BEAM2");
 
    // Declare the fire beam effect
    effect eBeam = EffectBeam(VFX_BEAM_FIRE, oSource, BODY_NODE_CHEST);
 
    // Apply it permanently
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eBeam, oTarget);
}

See Also

functions: 

EffectLinkEffects EffectVisualEffect

constants: 

VFX_BEAM_* Constants


 author: John Shuell, editor: Jasperre, additional contributor(s): Jasperre