SpawnParticle

From ZDoom Wiki
Jump to navigation Jump to search

void SpawnParticle (int color [, bool fullbright [, int lifetime [, int size [, fixed x [, fixed y [, fixed z [, fixed velx [, fixed vely [, fixed velz [, fixed accelx [, fixed accely [, fixed accelz [, int startalpha [, int fadestep]]]]]]]]]]]]]]);

Usage

Spawns a single particle at the x, y and z coordinates.

Parameters

  • color: The color of the particle. This is a hexadecimal value, e.g. 0xFF0000 (which is bright red).
  • fullbright: If true, it renders the particle fully bright. Default is false.
  • lifetime: The lifetime of the particle in tics. This ranges from 0 to 255. Default is 35.
  • size: The size of the particle, up to a maximum value of 65535. Default is 1.
  • x/y/z: The absolute map coordinates at which to spawn the particle. Default is 0.
  • velx/vely/velz: The velocity along the x/y/z axis. This is in absolute direction, not relative. Default is 0.
  • accelx/accely/accelz: Defines how much to accelerate this particle by over its lifespan. Default is 0.
  • startalpha: Specifies the alpha upon spawning. This ranges from 0 to 255. Default is 255.
  • fadestep: The amount the particle fades each tic. This ranges from -1 to 255, with -1 indicating automatic mode (a complete fadeout over the length of lifetime). The particle is automatically removed early if it fades completely before lifetime expires. Default is -1.

Examples

This a simplified version of the script that spawns the yellow "portal particles" at the start of Map01 of Eviternity. The particles are spawned randomly across the width and height of a linedef and slowly fade out.

Script "Eviternity_PortalParticles" ENTER
{ 
 SpawnParticle (0xFFE74B, 1, Random(30,45), 7 , Random(-184.0,-72.0), -736.0, Random(8.0, 120.0), 0.0, 3.0, 0.0, 0.0, 0.0, 0.0, 1.0, -1);
 Delay(1);
 Restart;
}