Server Totals
Elysia - (2)
M'Chek - (2)
Mikona - (1)
Wilderness - (1)
Ferrell - (0)
Le'Or - (0)
Visimontium - (0)
Underdark - (0)
Deglos - (0)
Total players: 6
Gallery

Links Menu

How to .. make a gong sound.

Moderators: Nighthawk4, Dungeon Masters

How to .. make a gong sound.

PostAuthor: Starslayer_D » Mon Apr 28, 2003 9:25 am

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.

Starslayer_D
Master Sage
 
Posts: 5182
Joined: Thu Oct 24, 2002 7:35 pm
Location: Germany (+1 GMT)

Re: How to .. make a gong sound.

PostAuthor: JollyOrc » Mon Apr 28, 2003 9:29 am

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 ?
User avatar
JollyOrc
QA Resource
 
Posts: 3900
Joined: Fri Jan 17, 2003 11:41 am
Location: Germany
Timezone: GMT+1

PostAuthor: Nightface » Mon Apr 28, 2003 9:42 am

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*
User avatar
Nightface
Sage
 
Posts: 1745
Joined: Fri Jan 03, 2003 11:13 am
Location: Los Angeles, CA

PostAuthor: Starslayer_D » Mon Apr 28, 2003 9:56 am

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)

Starslayer_D
Master Sage
 
Posts: 5182
Joined: Thu Oct 24, 2002 7:35 pm
Location: Germany (+1 GMT)

PostAuthor: Lafferty » Mon Apr 28, 2003 1:42 pm

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
Tool for crafters Do you want some human to your salt? nomanisanisland.monolar.de
User avatar
Lafferty
Scholar
 
Posts: 1130
Joined: Tue Feb 11, 2003 5:08 pm
Location: look at my hands... they are HUGE. And they cant touch themselves...

PostAuthor: Nightface » Mon Apr 28, 2003 8:41 pm

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!
User avatar
Nightface
Sage
 
Posts: 1745
Joined: Fri Jan 03, 2003 11:13 am
Location: Los Angeles, CA

PostAuthor: Starslayer_D » Tue Apr 29, 2003 8:28 am

Thanks, folks, i am going to test this for the doorbell.


Now, how to make a gong simply sound OnUse ?

Starslayer_D
Master Sage
 
Posts: 5182
Joined: Thu Oct 24, 2002 7:35 pm
Location: Germany (+1 GMT)

PostAuthor: Lafferty » Tue Apr 29, 2003 11:23 am

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...
Tool for crafters Do you want some human to your salt? nomanisanisland.monolar.de
User avatar
Lafferty
Scholar
 
Posts: 1130
Joined: Tue Feb 11, 2003 5:08 pm
Location: look at my hands... they are HUGE. And they cant touch themselves...

PostAuthor: Starslayer_D » Tue Apr 29, 2003 11:41 am

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.

Starslayer_D
Master Sage
 
Posts: 5182
Joined: Thu Oct 24, 2002 7:35 pm
Location: Germany (+1 GMT)

PostAuthor: Drakuul » Mon Aug 25, 2003 4:43 am

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.
Image
User avatar
Drakuul
Sage
 
Posts: 2379
Joined: Tue May 20, 2003 3:17 pm
Location: UK, South Wales

PostAuthor: Jordicus » Mon Aug 25, 2003 4:53 am

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
User avatar
Jordicus
Team Member; Retired with Honors
 
Posts: 8048
Joined: Tue Jan 21, 2003 3:46 pm
Location: Whitehall, PA (GMT -4)

PostAuthor: JollyOrc » Mon Aug 25, 2003 4:56 am

believe it or not, that's one of the things already done...

Lisas Bathroom Hak !
User avatar
JollyOrc
QA Resource
 
Posts: 3900
Joined: Fri Jan 17, 2003 11:41 am
Location: Germany
Timezone: GMT+1

PostAuthor: Drakuul » Mon Aug 25, 2003 5:10 am

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.
Image
User avatar
Drakuul
Sage
 
Posts: 2379
Joined: Tue May 20, 2003 3:17 pm
Location: UK, South Wales


Return to NWN Scripting

Who is online

Registered users: Bing [Bot], Google [Bot]