Game Development Community

Displaying particles in Scripts

by Matthew Shapiro · in Torque Game Engine · 10/02/2001 (10:29 pm) · 8 replies

There MUST be a way to show particle effects in scripts. Like the Splash particle. HOW! Please someone tell me, I would be forever grateful. I see the datablocks but i dont' see where the datablocks are being called... thanks...

#1
10/03/2001 (6:31 am)
do you have tribes 2 there are great examples of how to play withthe particle effects withtheir code
here is a snipit from the blaster in tribes two so you know what to look for
//--------------------------------------------------------------------------
// Explosion
//--------------------------------------
datablock ParticleData(BlasterExplosionParticle1)
{
   dragCoefficient      = 2;
   gravityCoefficient   = 0.0;
   inheritedVelFactor   = 0.2;
   constantAcceleration = -0.0;
   lifetimeMS           = 600;
   lifetimeVarianceMS   = 000;
   textureName          = "special/crescent4";
   colors[0] = "0.2 0.8 1.0 1.0";
   colors[1] = "0.2 0.4 1.0 1.0";    //red to blue
   colors[2] = "0.0 0.0 1.0 0.0";
   sizes[0]      = 0.25;
   sizes[1]      = 0.5;
   sizes[2]      = 1.0;
   times[0]      = 0.0;
   times[1]      = 0.5;
   times[2]      = 1.0;
};

datablock ParticleEmitterData(BlasterExplosionEmitter)
{
   ejectionPeriodMS = 7;
   periodVarianceMS = 0;
   ejectionVelocity = 2;
   velocityVariance = 1.5;
   ejectionOffset   = 0.0;
   thetaMin         = 70;
   thetaMax         = 80;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   orientParticles  = true;
   lifetimeMS       = 200;
   particles = "BlasterExplosionParticle1";
};
I hope that helps
#2
10/03/2001 (8:01 am)
the datablocks are here, but where's the command that starts them?

and i don't have T2
#3
10/03/2001 (10:05 am)
Particle emitters are attached to objects, and the object must have emitter C++ support code. In the case of the player, the player datablock has a water emitter attribute, when the player enters the water, he activates that emitter. The projectiles and vehicles also support emitters, but you can't simply start an emitter on it's own.

The ShapeImages support emitters as well, so you could create a mountable object that emits particles (such as a spray gun), and attached that to any shape base object. T2 had some little mini-vulcano shapes that emitted particles, I imaging they were done this way.

The only other option would be to create another C++ emitter object, but that would be a little more work.
#4
10/03/2001 (1:35 pm)
Hmm... I thought there was one already.

I know in T2 I can spawn a particle emitter, haven't checked in Torque yet as I've been working on other things.
#5
10/03/2001 (1:38 pm)
so how exactly would like a fireball work? a moving few polygons with the particle emitter attached?

(which means fireball type spells with particles flying accross the screen woudlnt' work right because the profectile code is broken?)
#6
10/03/2001 (5:18 pm)
Ahhh.... that's a different fish altogether.

Once the CVS is up you will be able to play with projectile code.
#7
10/03/2001 (5:40 pm)
i just wanted to try start making spells heh with the splash particles....
#8
10/03/2001 (5:47 pm)
Ok so i can't do moving ones yet but just to test it out how would i tell it that when i press this button, do the splash particle and heal a few HP?