Page 1 of 1

How to .. make a gong sound.

Posted: Mon Apr 28, 2003 9:25 am
by Starslayer_D
I am currently redecorating my Temple, and with the process, two gong-related questions came up:

A: If I have a free-standin gong, how to I make it produce a sound when used?

B: If I have a pull-cchain Doorbell, how do I make her sound be heard i naother area (upstairs)?

Answering these would greatly help me in finishing the area.

Re: How to .. make a gong sound.

Posted: Mon Apr 28, 2003 9:29 am
by JollyOrc
Starslayer_D wrote:I am currently redecorating my Temple, and with the process, two gong-related questions came up:

A: If I have a free-standin gong, how to I make it produce a sound when used?

B: If I have a pull-cchain Doorbell, how do I make her sound be heard i naother area (upstairs)?

Answering these would greatly help me in finishing the area.
I know I'm not really helping here, but I know that the 1%ers have it set up that pulling the chain activates a light in the upper floor. Guess that this script can be altered to sound something.

Is there a gong in the soundset ?

Posted: Mon Apr 28, 2003 9:42 am
by Nightface
Yep, this can be done. You need to have an invisible object in each place you want the gong to be heard. Here's the script I use (although I'd be interested in seeing if anybody has a more efficient method):

Code: Select all

void main()
{
    object oBell1 = GetObjectByTag("sk_doorbell1");
    object oBell2 = GetObjectByTag("sk_doorbell2");
    object oBell3 = GetObjectByTag("sk_doorbell3");

    AssignCommand(oBell1,PlaySound("as_cv_gongring2"));
    AssignCommand(oBell2,PlaySound("as_cv_gongring2"));
    AssignCommand(oBell3,PlaySound("as_cv_gongring2"));

}
You'll need one object line and one AssignCommand for each invisible object. The tag of each invisible object should match the appropriate tag named in the object line. The above example will force the invisible objects to play the sound, and when they are placed in scattered locations, will ensure that you can hear it wherever you need. If you need more than three, just add invisible objects to the floorplan, and add corresponding lines to match. :)

Tanmar
*amateur code monkey*

Posted: Mon Apr 28, 2003 9:56 am
by Starslayer_D
Does this work even with the invisible object being in a different area then the activator? eg: upstairs and groundfloor

And what script do I use on a gong wich simply is supposed to sound inplace? (like those in the OC: Creator race ruins)

Posted: Mon Apr 28, 2003 1:42 pm
by Lafferty
If you want the sound to be heard in the whole other area(s)

use this... you can also adjust the volume
(put in OnUsed or in OnDamaged of a placeable like the gong)

Code: Select all

// Script for the Twospring house doorbell
void main()  {

    //Plays the sound as_cv_gongring1 at the players location

    PlaySound("as_cv_gongring1");

    /*plays the same sounds at the locations of the other two sound
     sources: in the main floor and in the private rooms*/

    object oSound1 =GetObjectByTag("twsp_bell_lower");
    object oSound2 =GetObjectByTag("twsp_bell_upper");

    // The sounds volume is defined 0, so it has to be raised first

    SoundObjectSetVolume(oSound1, 96);
    SoundObjectSetVolume(oSound2, 72);

    // Playing the sounds of the placed sounds

    SoundObjectPlay(oSound1);
    SoundObjectPlay(oSound2);

    // resetting the sound volume. This has to be delayed

    DelayCommand(5.0, SoundObjectSetVolume(oSound1, 0));
    DelayCommand(5.0, SoundObjectSetVolume(oSound2, 0));

}

I used this code for my house...
twsp_bell_lower / ...._upper are sound sources.

Originally i set them to mute... but it didnt work. I always heard the gong sound a few secs after i entert a floor.
So i set their volume to 0... The script does the rest.

For the sound to be heard in the whole area you need to edit the sound source properties. The nice thing is you can also edit the sound source properties to allow variation is loudness and pitch.

AH.... you may notice that the gong is louder in the lower floor than in the upper. :)

I hope this is helpful

Posted: Mon Apr 28, 2003 8:41 pm
by Nightface
DOH! Forgot to mention that my doorbell had to be put in the OnUsed slot of the gong/pullchain/whatever. (I use the pullchain)

Nice design, Lafferty! I especially like the variable volume capabilities!

Posted: Tue Apr 29, 2003 8:28 am
by Starslayer_D
Thanks, folks, i am going to test this for the doorbell.


Now, how to make a gong simply sound OnUse ?

Posted: Tue Apr 29, 2003 11:23 am
by Lafferty

Code: Select all

// put this in OnUsed of a placeable
// Plays a sound at the location of the placeable
void main() {
  // Plays sound "as_cv_gongring1"
  PlaySound("as_cv_gongring1"); 
}
as you may see this is part of my originally posted script...

Posted: Tue Apr 29, 2003 11:41 am
by Starslayer_D
Doh...

I can place sound effects just right, play with light and music, and give those huge echoing rooms a nice cozy feeling.. but scripting?

Visit my temple of Angadar once it is finished :) I treat you to a nice fey wine or two.

Posted: Mon Aug 25, 2003 4:43 am
by Drakuul
Is there anyway to put a PlaySound command when someone sits on a chair? I have a really disgusting idea for a toilet in my house I'm designing.

Posted: Mon Aug 25, 2003 4:53 am
by Jordicus
you could maybe do it with a combination. make a script for a specific chair. When the chair is used, then the PC would sit on the chair and then you could delay specific sound effects and make the PC stand back up after a certain amount of time. I'm sure you could even play with some water sounds for a nice flush.. :P

Posted: Mon Aug 25, 2003 4:56 am
by JollyOrc
believe it or not, that's one of the things already done...

Lisas Bathroom Hak !

Posted: Mon Aug 25, 2003 5:10 am
by Drakuul
Excellent! I'm not the only one thinking like this... got the water sound effect for the hand cranked flush... got the slurpy dropping sound effect for the toilet.