Table Effects
Functions to generate effects.
Functions
Tables
ParticleData | Structure for EmitAdvancedParticle table. |
Functions
- EmitLightningArc(src, dest, color, lifetime, amplitude, beamWidth, detail, smooth, endDrift)
-
Emit a lightning arc.
Parameters:
- src Vec3
- dest Vec3
- color Color (default Color(255, 255, 255))
- lifetime float Lifetime in seconds. Clamped to [0, 4.233] for now because of strange internal maths. (default 1.0)
- amplitude int "strength" of the lightning - the higher the value, the "taller" the arcs. Clamped to [1, 255]. (default 20)
- beamWidth int Clamped to [1, 127]. (default 2)
- detail int Higher numbers equal more segments, but it's not a 1:1 correlation. Clamped to [1, 127]. (default 10)
- smooth bool If true, the arc will have large, smooth curves; if false, it will have small, jagged spikes. (default false)
- endDrift bool If true, the end of the arc will be able to gradually drift away from its destination in a random direction (default false)
- EmitParticle(pos, vel, spriteID, gravity, rotVel, startColor, endColor, blendMode, startSize, endSize, life, applyDamage, applyPoison, spriteSeqID, startRot)
-
Emit a particle.
Parameters:
- pos Vec3 World position.
- vel Vec3 Velocity.
- spriteID int ID of the sprite in the sprite sequence object.
- gravity float Specifies if the particle will fall over time. Positive values ascend, negative values descend. Recommended range: [-1000 and 1000]. Default: 0
- rotVel float Rotational velocity in degrees. Default: 0
- startColor Color Color at start of life. Default: Color(255, 255, 255)
- endColor Color Color to fade toward. This will finish long before the end of the particle's life due to internal math. Default: Color(255, 255, 255)
- blendMode BlendID Render blend mode. TEN.Effects.BlendID.ALPHABLEND
- startSize float Size at start of life. Default: 10
- endSize float Size at end of life. The particle will linearly shrink or grow toward this size over its lifespan. Default: 0
- life float Lifespan in seconds. Default: 2
- applyDamage bool Specify if the particle will harm the player on collision. Default: false
- applyPoison bool Specify if the particle will poison the player on collision. Default: false
- spriteSeqID ObjID ID of the sprite sequence object. Default: Objects.ObjID.DEFAULT_SPRITES
- startRot float Rotation at start of life. Default: random
Usage:
EmitParticle( pos, Vec3(math.random(), math.random(), math.random()), 22, -- spriteID 0, -- gravity -2, -- rotVel Color(255, 0, 0), -- startColor Color(0, 255, 0), -- endColor TEN.Effects.BlendID.ADDITIVE, -- blendMode 15, -- startSize 50, -- endSize 20, -- life false, -- applyDamage true, -- applyPoison Objects.ObjID.DEFAULT_SPRITES, -- spriteSeqID 180 -- startRot )
- EmitAdvancedParticle(ParticleData)
-
Emit a particle with extensive configuration options including animations.
Parameters:
- ParticleData ParticleData The table holding all the particle data.
Usage:
local particle = { position = GetMoveableByName("camera_target_6") :GetPosition(), velocity = Vec3(0, 0, 10), spriteSeqID = TEN.Objects.ObjID.CUSTOM_BAR_GRAPHIC, spriteID = 0, lifetime = 10, maxYVelocity = 0, gravity = 0, friction = 10, startRotation = 0, rotationSpeed = 0, startSize = 80, endSize = 80, startColor = TEN.Color(128, 128, 128), endColor = TEN.Color(128, 128, 128), blendMode = TEN.Effects.BlendID.ADDITIVE, wind = false, damage = true, poison = false, burn = false, damageHit = 80, sound = 197, light = true, lightRadius = 6, lightFlicker = 5, animated = true, frameRate = .25, animationType = TEN.Effects.ParticleAnimationType.LOOP, } EmitAdvancedParticle(particle)
- EmitShockwave(pos, innerRadius, outerRadius, color, lifetime, speed, angle, hurtsLara)
-
Emit a shockwave, similar to that seen when a harpy projectile hits something.
Parameters:
- pos Vec3 Origin position
- innerRadius int (default 0) Initial inner radius of the shockwave circle - 128 will be approx a click, 512 approx a block
- outerRadius int (default 128) Initial outer radius of the shockwave circle
- color Color (default Color(255, 255, 255))
- lifetime float (default 1.0) Lifetime in seconds (max 8.5 because of inner maths weirdness)
- speed int (default 50) Initial speed of the shockwave's expansion (the shockwave will always slow as it goes)
- angle int (default 0) Angle about the X axis - a value of 90 will cause the shockwave to be entirely vertical
- hurtsLara bool (default false) If true, the shockwave will hurt Lara, with the damage being relative to the shockwave's current speed
- EmitLight(pos[, color][, radius][, shadows][, name])
-
Emit dynamic light that lasts for a single frame.
If you want a light that sticks around, you must call this each frame.
Parameters:
- pos Vec3 position of the light
- color Color light color (default Color(255, 255, 255)) (optional)
- radius int measured in "clicks" or 256 world units (default 20) (optional)
- shadows bool determines whether light should generate dynamic shadows for applicable moveables (default is false) (optional)
- name string if provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights) (optional)
- EmitSpotLight(pos, dir[, color][, radius][, falloff][, distance][, shadows][, name])
-
Emit dynamic directional spotlight that lasts for a single frame.
If you want a light that sticks around, you must call this each frame.
Parameters:
- pos Vec3 position of the light
- dir Vec3 normal which indicates light direction
- color Color (default Color(255, 255, 255)) (optional)
- radius int overall radius at the endpoint of a light cone, measured in "clicks" or 256 world units (default 10) (optional)
- falloff int radius, at which light starts to fade out, measured in "clicks" (default 5) (optional)
- distance int distance, at which light cone fades out, measured in "clicks" (default 20) (optional)
- shadows bool determines whether light should generate dynamic shadows for applicable moveables (default is false) (optional)
- name string if provided, engine will interpolate this light for high framerate mode (be careful not to use same name for different lights) (optional)
- EmitBlood(pos, count)
-
Emit blood.
Parameters:
- pos Vec3
- count int Sprite count. default: 1
- EmitAirBubble(pos[, size][, amp])
-
Emit an air bubble in a water room.
Parameters:
- pos Vec3 World position where the effect will be spawned. Must be in a water room.
- size float Sprite size. Default: 32 (optional)
- amp float Oscillation amplitude. Default: 32 (optional)
- EmitFire(pos, size)
-
Emit fire for one frame. Will not hurt player. Call this each frame if you want a continuous fire.
Parameters:
- pos Vec3
- size float (default 1.0)
- MakeExplosion(pos, size, shockwave)
-
Make an explosion. Does not hurt Lara
Parameters:
- pos Vec3
- size float (default 512.0) this will not be the size of the sprites, but rather the distance between the origin and any additional sprites
- shockwave bool (default false) if true, create a very faint white shockwave which will not hurt Lara
- MakeEarthquake(strength)
-
Make an earthquake
Parameters:
- strength int (default 100) How strong should the earthquake be? Increasing this value also increases the lifespan of the earthquake.
- GetWind()
-
Get the wind vector for the current game frame.
This represents the 3D displacement applied by the engine on things like particles affected by wind.()
Returns:
-
Vec3
Wind vector.
- EmitStreamer(mov, tag, pos, dir[, rot][, startColor][, endColor][, width][, life][, vel][, expRate][, rotRate][, edgeFeatherMode][, lengthFeatherMode][, blendID])
-
Emit an extending streamer effect.
Parameters:
- mov Moveable Moveable object with which to associate the effect.
- tag int[opt] Numeric tag with which to associate the effect on the moveable. Default: 0
- pos Vec3 World position.
- dir Vec3 Direction vector of movement velocity.
- rot float Start rotation in degrees. Default: 0 (optional)
- startColor Color Color at the start of life. Default: Color(255, 255, 255, 255)) (optional)
- endColor Color Color at the end of life. Default: Color(0, 0, 0, 0)) (optional)
- width float Width in world units. Default: 0 (optional)
- life float Lifetime in seconds. Default: 1 (optional)
- vel float Movement velocity in world units per second. Default: 0 (optional)
- expRate float Width expansion rate in world units per second. Default: 0 (optional)
- rotRate float Rotation rate in degrees per second. Default: 0 (optional)
- edgeFeatherMode Effects.StreamerFeatherMode Edge feather mode. Default: Effects.FeatherID.NONE (optional)
- lengthFeatherMode Effects.StreamerFeatherMode Length feather mode. Not implemented yet. (optional)
- blendID BlendID Renderer blend ID. Default: Effects.BlendID.ALPHA_BLEND (optional)
Tables
- ParticleData
-
Structure for EmitAdvancedParticle table.
Fields:
- position Vec3 World position.
- velocity Vec3 Velocity.
- spriteSeqID ObjID ID of the sprite sequence object. Default: Objects.ObjID.DEFAULT_SPRITES (optional)
- spriteID int ID of the sprite in the sprite sequence object.Default: 0 (optional)
- lifetime float Lifespan in seconds. Default: 2 (optional)
- maxYVelocity float Specifies ithe maximum Y velocity for the particle. Default: 0 (optional)
- gravity float Specifies if the particle will fall over time. Positive values ascend, negative values descend. Recommended range: [-1000 and 1000]. Default: 0 (optional)
- friction float Specifies the friction with which the particle will slow down over time. Default: 0 (optional)
- startRotation float Rotation at start of life. Default: random (optional)
- rotationSpeed float Rotational velocity in degrees. Default: 0 (optional)
- startSize float Size at start of life. Default: 10 (optional)
- endSize float Size at end of life. The particle will linearly shrink or grow toward this size over its lifespan. Default: 0 (optional)
- startColor Color Color at start of life. Default: Color(255, 255, 255) (optional)
- endColor Color Color to fade toward. This will finish long before the end of the particle's life due to internal math. Default: Color(255, 255, 255) (optional)
- blendMode BlendID Render blend mode. TEN.Effects.BlendID.ALPHA_BLEND (optional)
- damage bool Specify if the particle will harm the player on collision. Default: false (optional)
- poison bool Specify if the particle will poison the player on collision. Default: false (optional)
- burn bool Specify if the particle will burn the player on collision. Default: false (optional)
- wind bool Specify if the particle will be affected by wind in outside rooms. Default: false (optional)
- damageHit int Specify the damage particle will harm the player on collision. Default: 2 (optional)
- light bool Specify if the particle will be emit a light based on its color. Caution: Recommended only for a single particle. Having too many particles with lights can overflow the light system. Default: false (optional)
- lightRadius int measured in "clicks" or 256 world units. Default: 0 (optional)
- lightFlicker int The interval at which light should flicker. Default: 0 (optional)
- sound int ID to play. Corresponds to the value in the sound XML file or Tomb Editor's "Sound Infos" window. Looping sounds recommended. Caution: Recommended only for a single particle. Having too many particles with sounds can overflow the sound system. Default: None (optional)
- animated bool Specify if the particle will be animated. Default: false (optional)
- animationType ParticleAnimationType Specify the the type of animation the particle will use. Default: TEN.Effects.ParticleAnimationType.LOOP (optional)
- frameRate float The framerate with which the particle will be animated. Default: 1 (optional)