Author Topic: Sounds with Ghost Bricks  (Read 2319 times)

So I'm pretty sure there is no way around this, and it might have even been asked before, but it doesn't hurt to ask myself.

When creating a brick via script, a click sound gets played at the position of the brick. This sound does not seem to be played when the isPlanted field on the brick is set to 1/true, or .plant() is called on the brick.

It seems funny that calling an additional function seems to make the sound not play, and not calling it causes to play. My question is if there is a way to stop that sound. I've got a mod shifting sever ghost bricks around at once and it can be quite a cacophony.

like, music, or something like a jumpsound

like, music, or something like a jumpsound
The sound you hear when you place a brick down. Just like a click noise. It's not music.

The sound you hear when you place a brick down. Just like a click noise. It's not music.
package BrickSound
{
   function servercmdPlantBrick(%client)
   {
      parent::servercmdPlantBrick(%client);
      if(isObject(%client.player.tempBrick))
         serverPlay3d(%audioFile,%client.player.tempbrick.getTransform());
   }
};
activatePackage(BrickSound);


package BrickSound
Creating the package for the new command

  function servercmdPlantBrick(%client)
Re-Creating the PlantBrick command

     parent::servercmdPlantBrick(%client);
Calling the parent function, so we don't overwrite it

     if(isObject(%client.player.tempBrick))
Checking if the player's temp brick exists

        serverPlay3d(%audioFile,%client.player.tempbrick.getTransform());
Playing the %audioFile (which doesn't exist, you will have to change to an actual datablock) at the position of the player's temp brick

activatePackage(BrickSound);
Activating the package containing our new function

edit-
OH, VIA SCRIPT...

how are you calling it?

Could you do:
        serverPlay3d(%audioFile,%client.player.tempbrick.getTransform());
?

edit again-

I think you are trying to remove the brickplant sound....
« Last Edit: March 24, 2013, 01:21:43 AM by MARBLE MAN »

Yes. You misread what my problem is :P
I want no sounds to play haha.

Maybe make static shape appear that looks like a ghost brick except isn't?
Can't think of much else

Maybe make static shape appear that looks like a ghost brick except isn't?
Can't think of much else
Can you create static shapes of variable size to accommodate for different sized bricks? Like do they require models or can they be generated on the fly? Or anyone have an example script that utilizes static shapes?

Can you create static shapes of variable size to accommodate for different sized bricks? Like do they require models or can they be generated on the fly? Or anyone have an example script that utilizes static shapes?

Uh I've seen it done where you take like a modeled box and then you can change the zscale, yscale, and xscale on it to change it into whatever shape you want, but I actually don't really know of any good examples.

datablock AudioProfile(BrickRotateSound) {
   fileName = "base/data/sound/clickRotate.wav";
   description = "AudioClose3d";
   preload = "1";
};
datablock AudioProfile(brickPlantSound) {
   fileName = "base/data/sound/ClickPlant.wav";
   description = "AudioClose3d";
   preload = "1";
};

change these

datablock AudioProfile(BrickRotateSound) {
   fileName = "base/data/sound/clickRotate.wav";
   description = "AudioClose3d";
   preload = "1";
};
datablock AudioProfile(brickPlantSound) {
   fileName = "base/data/sound/ClickPlant.wav";
   description = "AudioClose3d";
   preload = "1";
};

change these
Unfortunately editing those did not work. I tried editing the fileName to a different sound file; I tried taking out the fileName; I tried deleting the datablock as a whole. All to no avail.

And yes I did this during the add-on loading process, and when I did check it after all was loaded, the info had changed. I even tried some functions such as transmitDatablocks() mid-game as well.

Unfortunately editing those did not work. I tried editing the fileName to a different sound file; I tried taking out the fileName; I tried deleting the datablock as a whole. All to no avail.

And yes I did this during the add-on loading process, and when I did check it after all was loaded, the info had changed. I even tried some functions such as transmitDatablocks() mid-game as well.
brickRotateSound = "locationOfEmptyWavFile.wav";

brickRotateSound = "locationOfEmptyWavFile.wav";
I can't tell if you know what you're doing or not. I appreciate the attempt to help, but you cannot just set an object to a string... If you meant to have me change brickRotateSound.filename to that, that is what I tried in my last post and that does not work.

One interesting thing I've noticed, is that my brick move sound and brick rotate sound are the same. They seem to be the same even when running a server with no add-ons. Anyone else notice this?

Edit: So a temporary fix is just to turn the pref $Pref::Audio::PlayBrickMoveSound to 0 on the client. I would still like a server-sided fix, but for any that are wondering that pref is stored on the client and will not play any brick movement sounds.
« Last Edit: March 27, 2013, 02:05:42 PM by lilboarder32 »

Try renaming the sound file as the server starts.

I ran into a similar problem when trying to change the skins of some default guis.  It won't let you change the bitmap path.  However, a fix I did find was to create a new gui control profile with the same name (the name part is probably unnecessary), then do

guiobject.setProfile(guiobject.profile.getname());

Not sure if audio profiles have the equivalent of .setProfile() but thought I might throw that out there.