Silent laser beams and security bots

A refuge for those migrating from the fallen DXEditing.com and a place for general discussion relating to Deus Ex editing (coding, mapping, etc).
Post Reply
User avatar
Andrievskaya Veronika
UNATCO
Posts: 151
Joined: Wed Mar 21, 2007 5:36 am
Location: Somewhere in Russia
Contact:

Silent laser beams and security bots

Post by Andrievskaya Veronika »

Once i needed to make laser beams noiseless, but changing BeamTrigger's defprops does not works.
So i used MissionScript to implement this. The idea is changing properties of laserbeams directly.
The functions are used in Timer();

You can get location of any Actor from the editor:
Image

Code: Select all

function MakeLasersQuiet()
{
  Local LaserEmitter L;
  Local LaserTrigger T;
    
//  Log("Searching laser beams by location...");
    foreach AllActors(class'LaserEmitter',L)
    {
      If (L.Location.X < -2000.0 && L.Location.X > -2800.0)
      {
//        Log("Beams were found! Making them quiet...");
//        Log("Location of the beams: "@ L.Location.X);
        L.SoundVolume=4;
        L.SoundRadius=8;
      }
    }

}
And similar solution for SecurityBots (but changing defprops will work for them as usually)
Here i needed to hide bots presence

Code: Select all

function ManageSecBots()
{
  local securityBot4 bot;
  
  foreach allactors(class'securitybot4', bot) //, 'SilentSecurityBots')
    {
      if (bot.location.Z < 30.424997)
//      If (bot.Location.Z < -2000.0 && bot.Location.Z > -2800.0)     
        {
//          Player.ClientMessage("SecurityBots are silent!");
          bot.TransientSoundVolume=0;
          bot.SoundRadius=0;
        }
        else
            {
//              Player.ClientMessage("Bots are looking for YOU! Run away!");
              bot.TransientSoundVolume=bot.default.TransientSoundVolume;
              bot.SoundRadius=bot.default.SoundRadius;
            }
    }
}
You can see how it works in my Delta 2 mod: http://www.offtopicproductions.com/foru ... =6&t=11697
Cybernetic pig
Illuminati
Posts: 2284
Joined: Thu Mar 08, 2012 3:21 am

Re: Silent laser beams and security bots

Post by Cybernetic pig »

Why not just add your own configurable bool that can be toggled in the editor:

Code: Select all

class BeamTrigger extends Trigger;

var() bool bSilent;  //LINE 1

function BeginPlay()
{
	Super.BeginPlay();

	LastHitActor = None;
	emitter = Spawn(class'LaserEmitter');

	if (emitter != None)
	{
		emitter.TurnOn();
		bIsOn = True;
                if (bSilent)                                           //LINE 2
                    emitter.AmbientSound = None;                          //LINE 3
               else                                                        //LINE 4
                   emitter.AmbientSound = emitter.default.AmbientSound; //LINE 5
	}
	else
		bIsOn = False;
}


That's all the code needed - five lines added to beam/laser trigger, and bSilent can be set to true via unreal editor for any laser trigger you please. Less code, and more convenient for any time you want to add new silent lasers too.
Doesn't have to be a bool to just disable ambient sound outright either, you can make it an int and use that to set the volume, so level designers can set it to any volume they please.
Same can be done for bots too ofc.

"var()" makes it a configurable variable in the unreal editor for level designers.
Post Reply