How to add in Lightning
by William Goh (Joondalup IT TAFE) · in Game Design and Creative Issues · 05/14/2009 (10:36 pm) · 2 replies
How do you add in Lightning to stronghold.exe? I tried adding in Lightning using the World Editor Creator --> Mission Objects --> Environment and double clicking on Lightning and naming it lightning. It doesn't appear on my list therefore I can't select it. What do I have to do to add in Lightning?
#2
First off you need some suitable thunder sounds and some datablocks:
Then you need the lightning storm datablock itself:
As an added bonus, if you want your lightning to do damage add this to the lightning datablock:
05/15/2009 (12:04 am)
Since you specifically mention Stronghold.exe I would assume you asking how to do this in TGEa. It seems as though the DefaultStorm datablock was overlooked. It's in the Demo project though, in "~/server/scripts/environment.cs".First off you need some suitable thunder sounds and some datablocks:
datablock SFXProfile(ThunderCrash1Sound)
{
filename = "~/data/sound/environment/ambient/thunder1";
description = Audio2d;
};
datablock SFXProfile(ThunderCrash2Sound)
{
filename = "~/data/sound/environment/ambient/thunder2";
description = Audio2d;
};
datablock SFXProfile(ThunderCrash3Sound)
{
filename = "~/data/sound/environment/ambient/thunder3";
description = Audio2d;
};
datablock SFXProfile(ThunderCrash4Sound)
{
filename = "~/data/sound/environment/ambient/thunder4";
description = Audio2d;
};
//datablock SFXProfile(LightningHitSound)
//{
// filename = "~/data/sound/crossbow_explosion";
// description = AudioLightning3d;
//};Then you need the lightning storm datablock itself:
datablock LightningData(DefaultStorm)
{
//strikeTextures[0] = "~/data/environment/lightning1frame1";
//strikeTextures[1] = "~/data/environment/lightning1frame2";
//strikeTextures[2] = "~/data/environment/lightning1frame3";
//strikeSound = LightningHitSound;
thunderSounds[0] = ThunderCrash1Sound;
thunderSounds[1] = ThunderCrash2Sound;
thunderSounds[2] = ThunderCrash3Sound;
thunderSounds[3] = ThunderCrash4Sound;
};I commented out the strikeTextures because TGEa doesn't use them -- at all. Regardless of how you set it up it always procedurally generates the lightning strike effect. But if you are using TGE then you can certainly make use of them and in this one case TGE truly outshines TGEa (TGE also has something called weatherLigtning which is even more impressive looking).As an added bonus, if you want your lightning to do damage add this to the lightning datablock:
directDamageType = $DamageType::Lightning; directDamage = 100;And then add this function:
function LightningData::applyDamage(%data, %lightningObj, %targetObject, %position, %normal)
{
%targetObject.damage(%lightningObj, %position, %data.directDamage, %data.directDamageType);
}
Torque 3D Owner Caylo Gypsyblood
www.garagegames.com/community/forums/viewthread/27850