WorldBuilding/MissionEditor/Adding Fireballs

From TDN

Contents

Example from the warzone demo.
Enlarge
Example from the warzone demo.

Introduction

This effect adds the fireballs seen from the Tim Aste's Warzone demo. The fireball datablock makes use of various types of data together.

Setup

Make sure you have the correct audio descriptions set up. Most of the setup is fairly self explanatory.

Datablocks

For the fireball.cs file, placed in ~/server/scripts/enviro/:

//-----------------------------------------------------------------------------
// Torque Game Engine 
// Copyright (C) GarageGames.com, Inc.
//-----------------------------------------------------------------------------
datablock ParticleData(FireballAtmosphereCrescentParticle){
   dragCoefficient      = 2;
   gravityCoefficient   = 0.0;
   inheritedVelFactor   = 0.2;
   constantAcceleration = -0.0;
   lifetimeMS           = 600;
   lifetimeVarianceMS   = 000;
   textureName          = "~/data/shapes/particles/fireball/crescent3";
   
   colors[0]     = "1.0 0.75 0.2 1.0";
   colors[1]     = "1.0 0.75 0.2 0.5";
   colors[2]     = "1.0 0.75 0.2 0.0";
   
   sizes[0]      = 8.0;
   sizes[1]      = 12.0;
   sizes[2]      = 16.0;
   
   times[0]      = 0.0;
   times[1]      = 0.5;
   times[2]      = 1.0;
};

datablock ParticleData(FireballAtmosphereParticle){
   textureName          = "~/data/shapes/particles/smoke";
   dragCoefficient      = 0.0;
   windCoefficient      = 0.0;
   gravityCoefficient   = -0.0;
   inheritedVelFactor   = 0.85;
   
   lifetimeMS           = 2600;
   lifetimeVarianceMS   = 0;
      spinRandomMin = -100.0;
   spinRandomMax = 100.0;
 
  colors[0]     = "1.0 0.9 0.5 1.0";
   colors[1]     = "1.0 0.4 0.08 0.4";
   colors[2]     = "1.0 0.2 0.08 0.0";

   sizes[0]      = 10.0;
   sizes[1]      = 8.0;
   sizes[2]      = 1.0;
   times[0]      = 0.1;
   times[1]      = 0.3;
   times[2]      = 1.0;
 };

datablock ParticleEmitterData(FireballAtmosphereCrescentEmitter){
   ejectionPeriodMS = 25;
   periodVarianceMS = 0;
   ejectionVelocity = 40;
   velocityVariance = 5.0;
   ejectionOffset   = 0.0;
   thetaMin         = 0;
   thetaMax         = 80;
   phiReferenceVel  = 0;
   phiVariance      = 360;
   overrideAdvances = false;
   orientParticles  = true;
   lifetimeMS       = 500;

   particles = "FireballAtmosphereCrescentParticle";
};

datablock ParticleEmitterData(FireballAtmosphereEmitter){
   ejectionPeriodMS = 10;
   periodVarianceMS = 0;
   ejectionVelocity = 1.25;
   velocityVariance = 0.0;
   thetaMin         = 0;
   thetaMax         = 30;
   
   particles = "FireballAtmosphereParticle";
};

datablock ExplosionData(FireballAtmosphereBoltExplosion){
   emitter[0] = FireballAtmosphereCrescentEmitter;
   particleDensity = 250;
   particleRadius = 3.25;
   faceViewer = true;
    // Turned off.. 
   shakeCamera = true;
   impulseRadius = 5;
   lightStartRadius = 5;
   lightEndRadius = 2;
};

datablock DebrisData(AtmosFireball){
   emitters[0] = "FireballAtmosphereEmitter";
   explosion = FireballAtmosphereBoltExplosion;
   explodeOnMaxBounce = true;
   elasticity = 0.0;
   friction = 1.0;
   lifetime = 100.0;
   lifetimeVariance = 0.0;
   numBounces = 0;
   bounceVariance = 09;
   ignoreWater = false;
};

datablock FireballAtmosphereData(FireballAtmos){
   fireball = AtmosFireball;
};

Mission Object

Add this to your *.mis file:

new FireballAtmosphere() {
         position = "0 0 0";
         rotation = "1 0 0 0";
         scale = "1 1 1";
         dataBlock = "FireballAtmos";
         dropRadius = "700";
         dropsPerMinute = "25";
         minDropAngle = "15";
         maxDropAngle = "35";
         startVelocity = "350";
         dropHeight = "1000";
         dropDir = "0.212 0.212 -0.953998";
      };