Effects

Attaching an Effect

Most effects can now be attached to most objects with geometry, such as vehicles, soldiers, and items, in addition to props. This is done in the ODF using the following standard tags:

AttachDynamic = “1”

AttachOdf = “<odf_name>”
AttachToHardpoint = “<hardpoint_name>”

AttachEffect = “<fx_name>”
AttachToHardpoint = “<hardpoint_name> [respawn_delay_min] [_max]”

Each AttachToHardpoint tag will create one instance of the last effect declared with AttachOdf or AttachEffect, attached to the specified hardpoint. Effects may also include additional parameters to control respawning. If no parameters follow, it will only spawn once. If one parameter follows, the effect will respawn after it dies after the given delay in seconds. If two parameters follow, the effect will respawn after it dies after a random delay in the given range. If an attached effect must remain attached to a moving or animated object, you must include the tag AttachDynamic = “1”.

Effect types

EntityLight

Type: ODF (use AttachODF to attach) or FX (AttachEffect)

LightBeam

Type: FX (AttachEffect)

Position(<x>, <y>, <z>);

Sets the head (light source end) position of the light beam in meters. Default is (0.0, 0.0, 0.0), the attachment point.

Length(<length>);

Sets this light beam to be cone shaped with the given length.

Direction(<x>, <y>, <z>);

Sets this light beam to be cone shaped, aligned along the given axis. Defaults to (0.0, 1.0, 0.0), the Y axis.

TailPosition(<x>, <y>, <z>);

Sets this light beam to be cone shaped and sets the tail (far end) position of the light beam in meters. Use as an alternative to Direction, Length to attach a beam to a target.

Color(<r>, <g>, <b> [, <a>]);

Sets the color of this light beam. Color channels are specified from 0 to 255. Alpha modulates the brightness.

DrawDistance(<distance>);

Sets the distance at which this light beam will fade out. Light beams always fade out by the end of the near scene, but may be faded sooner with this parameter.

InitialWidth(<x> [, <z>]);

Sets the width of this light beam at the light source end in meters. If z is not specified, the light beam will be elliptical – it’s width will be narrower when viewed from some angles. For halo shaped light beams, this only sets the size of the associated light flare, and z is ignored.

FinalWidth(<x> [, <z>]);

Sets the width of this light beam at the far end in meters. If z is not specified, the light beam will be elliptical – it’s width will be narrower when viewed from some angles. For halo shaped light beams, this sets the size of the halo. Z is ignored, as all halos are always round.

FadeLength(<length>);

Sets the length of the fade out of this light beam in meters. The total length (or radius) of a light beam is Length + FadeLength. Defaults to 1.0 meter.

FadeFactor(<factor>);

Sets the relative intensity of the light beam at the start of the fade out, from 0.0 to 1.0. Defaults to 0.2.

FlareIntensity(<factor>);

Sets the relative intensity of the light flare associated with the light beam, from 0.0 to 1.0.

BeamIntensity(<factor>);

Sets the relative intensity of the light beam, from 0.0 to 1.0, without affecting the light flare intensity.

FlareAngle(<angle>);

Sets the angle in degrees from the axis within which the flare associated with a cone shaped beam is visible.

Example

(This could be in my_light_beam.fx, or part of a world .fx file. If not in a world .fx file, the name of the file must match the name of the effect in order for. req files to be generated properly.)

LightBeam(“my_light_beam”)
{
    Color(255, 128, 0);
    Length(8.0);
    InitialWidth(1.0, 0.5);    // elliptical start
    FinalWidth(4.0, 2.0);    // elliptical end    
}

LensFlare

Type: FX (AttachEffect)

Size(<size>);

Sets the size of this lens flare. Defaults to 1.0.

Color(<r>, <g>, <b> [, <a>]);

Sets the color of this lens flare. Color channels are specified from 0 to 255. Alpha modulates the brightness.

DrawDistance(<distance>);

Sets the distance at which this lens flare will fade out. Lens flares always fade out by the end of the near scene, but may be faded sooner with this parameter.

Example
(Thia could be in my_lens_flare.fx or part of a world .fx file. If not in a world .fx file, the name of the file must match the name of the effect in order for req files to be generated properly)
LensFlare(“my_lens_flare”)
{
Color(255, 128, 0);
Size(1.0);
}

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License