WorldBuilding/MissionEditor/Adding Lightning

From TDN

This page is a Work In Progress.

Introduction

Lightning makes for some really good effects - You will need to prepare a series of lightning images.

Setup

The strikeTextures should be the 'bolt' part of a lightning strike. The flashTexture should be the cloud layer that lights up when lightning strikes. And the fuzzyTextures should be a blurring of the strikeTextures that get stretched over time. Make sure you have the correct audio descriptions setup. Most of the setup is fairly self explanatory.

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

datablock AudioProfile(thunderCrash1)
{
   filename  = "~/data/sound/lightning_crack1.wav";
   description = AudioStrike;
};

datablock AudioProfile(thunderCrash2)
{
   filename  = "~/data/sound/lightning_crack2.wav";
   description = AudioStrike;
};

datablock AudioProfile(thunderCrash3)
{
   filename  = "~/data/sound/lightning_crack3.wav";
   description = AudioStrike;
};

datablock AudioProfile(thunderCrash4)
{
   filename  = "~/data/sound/lightning_crack4.wav";
   description = AudioStrike;
};

datablock AudioProfile(LightningHitSound)
{
   filename = "~/data/sound/lightning_hit1.wav";
   description = AudioHit;
};

datablock AudioProfile(LightningRumble1)
{
   filename = "~/data/sound/lightning_rumble1.wav";
   description = AudioRumble;
};

datablock AudioProfile(LightningWind)
{
   filename = "~/data/sound/lightning_wind.wav";
   description = AudioWind;
};

datablock AudioProfile(LightningStatic)
{
   filename = "~/data/sound/lightning_static.wav";
   description = AudioStatic;
};

// Images and Settings
datablock WeatherLightningData(LightningThunder){
   strikeTextures[0] = "~/data/environment/thunder/lightning1frame1";
   strikeTextures[1] = "~/data/environment/thunder/lightning1frame2";
   strikeTextures[2] = "~/data/environment/thunder/lightning1frame3";
   strikeTextures[3] = "~/data/environment/thunder/lightning2frame1";
   strikeTextures[4] = "~/data/environment/thunder/lightning2frame2";
   strikeTextures[5] = "~/data/environment/thunder/lightning2frame3";
   
   flashTextures[0] = "~/data/environment/thunder/cloudflash";
   flashTextures[1] = "~/data/environment/thunder/cloudflash2";
   flashTextures[2] = "~/data/environment/thunder/cloudflash3";
   flashTextures[3] = "~/data/environment/thunder/cloudflash4";
   
   fuzzyTextures[0] = "~/data/environment/thunder/lightning1blur";
   fuzzyTextures[1] = "~/data/environment/thunder/lightning2blur";
   
   strikeSound = LightningHitSound; 
   
   thunderSounds[0] = thunderCrash1;
   thunderSounds[1] = thunderCrash2;
   thunderSounds[2] = thunderCrash3;
   thunderSounds[3] = thunderCrash4;
   thunderSounds[4] = thunderCrash1;
   thunderSounds[5] = thunderCrash2;
   thunderSounds[6] = thunderCrash3;
   thunderSounds[7] = thunderCrash4;
};


Add this to your *.mis file:

         new WeatherLightning() {
         position = "12.531 313.022 227.912";
         rotation = "1 0 0 0";
         scale = "500 500 500";
         dataBlock = "LightningThunder";
         strikesPerMinute = "9";
         boltDeathAge = "1.4013e-045";
      };