Page tree
Skip to end of metadata
Go to start of metadata

Introduction

Syntax

Format: [ShapeName, AnimationName, Type, TimerPeriod, LifeTime, Position, MoveVelocity, RotationVelocity, Weight, Volume, Rubbing, Size, Color, AnimationPhase, RandomDirectionPeriod, RandomDirectionIntensity, OnTimer, BeforeDestroy, Object, Angle, OnSurface, Temperature, TIAlpha, CheckInterior, InteropIgnored]

Example

Create thunderbolt on logic named logic1

_pos = [ position logic1 select 0,position logic1 select 1,10 ];
drop ["blesk1","","Billboard",0.01,0.2,_pos,[0,0,0],0,1,1,0,[20 + random 20],[[1,1,1,1],[1,1,1,0.7]],[1,0],0,0,"","",""];

For several examples for the kind of effects that can be accomplished via particles, see ParticleTemplates.

// SCRIPT FOR GENERATING "FLIES" AROUND AN OBJECT

// FIXED PARAMS
_source = "#particlesource" createVehicleLocal getPos (_this select 0);
_source setParticleParams
/*Sprite*/		[["\ca\characters2\OTHER\FLY.p3d",1,0,1,0],"",// File,Ntieth,Index,Count,Loop(Bool)
/*Type*/			"spaceObject",
/*TimmerPer*/		1,
/*Lifetime*/		4,
/*Position*/		[0,0,0],
/*MoveVelocity*/	[0,0,0.5],
/*Simulation*/		1,1.30,1,0,//rotationVel,weight,volume,rubbing
/*Scale*/		[0.03,0.03,0.03,0],
/*Color*/		[[1,1,1,1],[1,1,1,1]],
/*AnimSpeed*/		[1.5,0.5],
/*randDirPeriod*/	0.01,
/*randDirIntesity*/	0.08,
/*onTimerScript*/	"",
/*DestroyScript*/	"",
/*Follow*/		_this];

// RANDOM / TOLERANCE PARAMS
_source setParticleRandom
/*LifeTime*/		[2,
/*Position*/		[2,2,0.25],
/*MoveVelocity*/	[0,0,0],
/*rotationVel*/		1,
/*Scale*/		0.02,
/*Color*/		[0,0,0,0.1],
/*randDirPeriod*/	0.01,
/*randDirIntesity*/	0.03,
/*Angle*/		10];

_source setDropInterval 0.003;

Parameters

The ShapeName is defined as an array. This should be the particle shape name, followed by three integers.

Example:
["\Ca\Data\ParticleEffects\FireAndSmokeAnim\SmokeAnim.p3d", 8, 5, 0]
1. Anim Divisor (1 for a 1x1, 8 for a 8x8, and so on)
2. Anim Starting Row
3. Number of Frames to Play (speed controlled by animation phase below)
    Note the following:
  • The image used for this particle effect is 8X8 effect frames. This means you need to use 8 as your Anim Divisor. Otherwise, the game either draws too much of the image used, or too little. This is highly visible in most situations.
  • The Anim Starting Row picks the corresponding superimposed number in the image above (0 picks the first smoke effect, 1 picks the second smoke effect, 2 picks the first fire effect, and so on).
  • The number in Number of Frames to Play should, in most cases, be the number of effects available to the animation. If you go over this (for example, selecting 9 in this 8X8 tile), it starts playing the animation frames of the next effect down. If there is nothing below to grab, it draws a blank for that frame. If 1 is used, it only plays the first frame of the selected row.
  • If you want to find how many rows a data source consists of, use ["...", 1, 0, 1] to see the full picture as a particle.
  • AnimationName - String: Has to exist, but is not interpreted.
  • Type - String: Type of particle (either "Billboard" or "SpaceObject").
  • TimerPeriod - Number: The period of calling the OnTimer event (seconds).
  • LifeTime - Number: Life time of the particle (seconds).
  • Position - Array or String: Either 3D coordinate [x,y,z], or name of the selection - in this case, the Object property must be set.
  • MoveVelocity - Array: 3D vector [x,y,z] which describes the velocity vector of the particle direction and speed in m/s.
  • RotationVelocity - Number: Number of rotations per second.
  • Weight - Number: Weight of the particle (kg).
  • Volume - Number: Volume of the particle (m^3).
  • Rubbing - Number: Impact of the density of the environment on this particle. 0: no impact (vacuum).
  • Size - Array: Size of the particle in time to render (m) (see Time Arrays).
  • Color - Array: Color of the particle in time to render (RGBA) (see Time Arrays).
  • AnimationPhase - Array: Phase of the animation in time. In other words, the play speed of the selected frames for the Number of Frames to Play. The higher the number, the faster it plays through the animation frames. If the Number of Frames to Play above is set to 1, this has no visible effect (see Time Arrays).
  • RandomDirectionPeriod - Number: Period of change of the velocity vector (seconds).
  • RandomDirectionIntensity - Number: Each MoveVelocity component is changed with random value from the interval <0, RandomDirectionIntensity>.
  • OnTimer - String: Name of the script to run every period determined by TimerPeriod property. The particle position is stored in the this variable.
  • BeforeDestroy - String: Name of the script to run right before destroying the particle. The particle position is stored in the this variable.
  • Object - Object: Object to bind the particle to.
  • Angle - Number: Starting angle of the particle (optional).
  • OnSurface (V3.4+) - Boolean: Placement of particle on a (water) surface, the at start of its existence. Works only if setParticleCircle > 0 (optional, default: true) (non-functional).
  • Temperature (V3.4+) - Number: Determines rendering color (in centigrade) in thermal views (TI). If the value is <= -273.15 (the default), then the engine falls back to the old behavior, where temperature is determined by how orange the particle is. In V3.5+, temperature can also be a Time Arrays (optional, default: -273.15).
  • TIAlpha (V3.5+) - Number or Array: Override of Alpha values for in TI views. Can be a number or a Time Arrays (optional, default: -1, falls back to old behavior).
  • CheckInterior (V18.1.0+) - Boolean:  If true, then the particles are checked against the bounding box of the vehicle that has a player in it, and is not rendered in Pass 3 (one of several rendering passes).
  • InteropIgnored (V19.1.0+) - Boolean: If true, the particles are not broadcast to IG views, using the interop.

Time Arrays

Some properties (for example, Size and Color) must (or can) be defined as arrays. The values in this array define a gradual change over time. For example, if the size is set as [1, 2], then at the beginning of the particle lifetime, its size is 1, and at the end, is 2. The arrays can contain as many (or as few) entries as are needed for smooth transitions. Intermediate steps are calculated using linear interpolation. If the array contains only one element, then no transition is applied.

Tutorials

Vektorboson's Drop Tutorial

See Also

setParticleCircle, setParticleParams, setParticleRandom, ParticleTemplates