Game Development Community

The Color-changing Emitter!

by Spunky · in ThinkTanks · 03/08/2004 (9:56 am) · 8 replies

Here's some code I found for a color-changing emitter:


datablock particledata(lightparticle)
{
animateTexture = "1";
animTexName[0] = "game/data/shapes/tanks/AreaExplosion.jpg";
colors[0] = "0 0 1 1.000000";
colors[1] = "0 1 0 1.000000";
colors[2] = "1 0 0 1.000000";
colors[3] = "0.000000 0.000000 0.000000 1.000000";
constantAcceleration = "1";
dragCoefficient = "0.997067";
framesPerSec = "100";
gravityCoefficient = "-0.20757";
inheritedVelFactor = "0.297456";
lifetimeMS = "5000";
lifetimeVarianceMS = "250";
sizes[0] = "0.247922";
sizes[1] = "0.745389";
sizes[2] = "0.84409";
sizes[3] = "1.54513";
spinRandomMax = "500";
spinRandomMin = "90";
spinSpeed = "100";
textureName = "game/data/shapes/common/VolcanoExplosion.png";
times[0] = "5";
times[1] = "1.5";
times[2] = "9";
times[3] = "1";
useInvAlpha = "1";
windCoefficient = "0";
};
//
//
datablock particleemitterdata(lightparticleemitter)
{
className = "ParticleEmitterData";
ejectionOffset = "0";
ejectionPeriodMS = "2";
ejectionVelocity = "25.5";
lifetimeMS = "1";
lifetimeVarianceMS = "1";
orientOnVelocity = "1";
orientParticles = "0";
overrideAdvance = "1";
particleFarDist = "10000000000000";
particles = "lightparticle";
periodVarianceMS = "27";
phiReferenceVel = "0";
phiVariance = "360";
thetaMax = "90";
thetaMin = "90";
useEmitterColors = "0";
useEmitterSizes = "0";
velocityVariance = "100.0";
};



Try it out, it's REALLY COOL!
And please don't douse my entusiasm by saying someone else has done it, I have JUST figured out how to do emitters!
Also, can someone tell me how to do emitters to the sky? It would be awesome if I could have the sky rain this stuff down!

#1
03/08/2004 (11:58 am)
Read this thread about particleemitters. Once you figure it out just place one in the sky.
www.garagegames.com/mg/forums/result.thread.php?qt=16126

187
#2
03/08/2004 (1:49 pm)
Huh. It's not working.
Is this close to what I put down?

new ParticleEmitterNode(lightparticle) {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
datablock = "lightparticle";
emitter = "lightparticleemitter";
velocity = "1";
};
#3
03/08/2004 (2:16 pm)
You still need to add this to this to the .cs file

datablock ParticleEmitterNodeData(lightparticleemitternode)
{
   timeMultiple = 80;
}

Then change what you just posted to this
new ParticleEmitterNode(lightparticleemitternode) {
position = "0 0 0";
rotation = "1 0 0 0";
scale = "1 1 1";
datablock = "lightparticleemitternode";
emitter = "lightparticleemitter";
velocity = "1";
};
#4
03/08/2004 (3:21 pm)
Huh. Still not working.
Is this what the emitters.cs file should look like?

datablock particledata(lightparticleemitternode)
{
animateTexture = "0";
animTexName[0] = "game/data/shapes/common/electro03.png";
colors[0] = "0 1 0 1.000000";
colors[1] = "0 1 0 1.000000";
colors[2] = "0 1 0 0.385827";
colors[3] = "0 1 0 0.000000";
constantAcceleration = "0";
dragCoefficient = "0.99218";
framesPerSec = "1";
gravityCoefficient = "0";
inheritedVelFactor = "0";
lifetimeMS = "100";
lifetimeVarianceMS = "1000";
sizes[0] = "0.51492";
sizes[1] = "0.24519";
sizes[2] = "0.74571";
sizes[3] = "0.9451";
spinRandomMax = "500";
spinRandomMin = "-90";
spinSpeed = "0";
textureName = "game/data/shapes/tanks/speedyprojectile.jpg";
times[0] = "2";
times[1] = "4.2";
times[2] = "8.49804";
times[3] = "10";
useInvAlpha = "1";
windCoefficient = "1";
};
//
datablock particleemitterdata(lightparticleemitternode)
{
className = "ParticleEmitterData";
ejectionOffset = "0";
ejectionPeriodMS = "10";
ejectionVelocity = "0";
lifetimeMS = "0";
lifetimeVarianceMS = "0";
orientOnVelocity = "0";
orientParticles = "0";
overrideAdvance = "0";
particleFarDist = "1000";
particles = "projectile2particle";
periodVarianceMS = "9";
phiReferenceVel = "0";
phiVariance = "360";
thetaMax = "90";
thetaMin = "90";
useEmitterColors = "0";
useEmitterSizes = "0";
velocityVariance = "0";
};
datablock ParticleEmitterNodeData(lightparticleemitternode)
{
timeMultiple = 80;
}
#5
03/08/2004 (7:00 pm)
The emitters.cs file should look like this

datablock particledata(lightparticle)
{
  animateTexture = "0";
  animTexName[0] = "game/data/shapes/common/electro03.png";
  colors[0] = "0 1 0 1.000000";
  colors[1] = "0 1 0 1.000000";
  colors[2] = "0 1 0 0.385827";
  colors[3] = "0 1 0 0.000000";
  constantAcceleration = "0";
  dragCoefficient = "0.99218";
  framesPerSec = "1";
  gravityCoefficient = "-1";
  inheritedVelFactor = "0";
  lifetimeMS = "500";
  lifetimeVarianceMS = "1000";
  sizes[0] = "0.51492";
  sizes[1] = "0.24519";
  sizes[2] = "0.74571";
  sizes[3] = "0.9451";
  spinRandomMax = "500";
  spinRandomMin = "-90";
  spinSpeed = "0";
  textureName = "game/data/shapes/tanks/speedyprojectile.jpg";
  times[0] = "2";
  times[1] = "4.2";
  times[2] = "8.49804";
  times[3] = "10";
  useInvAlpha = "1";
  windCoefficient = "1";
};
//
datablock particleemitterdata(lightparticleemitter)
{
  className = "ParticleEmitterData";
  ejectionOffset = "0";
  ejectionPeriodMS = "10";
  ejectionVelocity = "0";
  lifetimeMS = "0";
  lifetimeVarianceMS = "0";
  orientOnVelocity = "0";
  orientParticles = "0";
  overrideAdvance = "0";
  particleFarDist = "1000";
  particles = "lightparticle";
  periodVarianceMS = "9";
  phiReferenceVel = "0";
  phiVariance = "360";
  thetaMax = "90";
  thetaMin = "90";
  useEmitterColors = "0";
  useEmitterSizes = "0";
  velocityVariance = "0";
};
datablock ParticleEmitterNodeData(lightparticleemitternode)
{
  timeMultiple = 80;
}


And the part you put in the .mis file should look like this

new ParticleEmitterNode(lightparticleemitternode) {
      position = "-144.619 20.0121 105.355";
      rotation = "0.0116031 -0.00690149 -0.999909 86.1322";
      scale = "1 1 1";
      datablock = "lightparticleemitternode";
      emitter = "lightparticleemitter";
      velocity = "1";
   };
#6
03/08/2004 (7:17 pm)
I just tested it and it definitely works.
#7
03/10/2004 (11:39 am)
Okay, I got some weird emitters going, but none from the sky. Is that just an example of the position in your second line of copying and pasting?
#8
03/12/2004 (2:10 pm)
Which bit do i put into my.mis file to get it to work, the re-sizing dunt effect me, so i need all in the .mis file.
dis bit??

datablock particledata(lightparticle)
{
animateTexture = "0";
animTexName[0
= "game/data/shapes/common/electro03.png"; colors[0] = "0 1 0 1.000000";
colors[1] = "0 1 0 1.000000";
colors[2] = "0 1 0 0.385827";
colors[3] = "0 1 0 0.000000"; constantAcceleration = "0";
dragCoefficient = "0.99218";
framesPerSec = "1";
gravityCoefficient = "-1";
inheritedVelFactor = "0";
lifetimeMS = "500";
lifetimeVarianceMS = "1000";
sizes[0] = "0.51492";
sizes[1] = "0.24519";
sizes[2] = "0.74571";
sizes[3] = "0.9451";
spinRandomMax = "500";
spinRandomMin = "-90";
spinSpeed = "0"; textureName = "game/data/shapes/tanks/speedyprojectile.jpg"; times[0] = "2";
times[1] = "4.2";
times[2] = "8.49804";
times[3] = "10";
useInvAlpha = "1";
windCoefficient = "1";
};
//
datablock particleemitterdatalightparticleemitter)
{
className = "ParticleEmitterData"; ejectionOffset = "0";
ejectionPeriodMS = "10";
ejectionVelocity = "0";
lifetimeMS = "0";
lifetimeVarianceMS = "0";
orientOnVelocity = "0";
orientParticles = "0";
overrideAdvance = "0";
particleFarDist = "1000";
particles = "lightparticle";
periodVarianceMS = "9";
phiReferenceVel = "0";
phiVariance = "360";
thetaMax = "90";
thetaMin = "90";
useEmitterColors = "0";
useEmitterSizes = "0";
velocityVariance = "0";
};
datablock ParticleEmitterNodeData(lightparticleemitternode){ timeMultiple = 80;}

cpt Rik