wind in the trees

Post your scripting questions / solutions here

Moderator: Moderators

User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

wind in the trees

Post by wacko »

i try to get wind sounds where i have trees, but i still have 2 problems:

1st it seems to change direction when the player changes his heading (sound is coming from left/middle/right).
I used local as the channel to be used, but it didn't work

Code: Select all

local.master aliascache wind_trees sound/amb/Amb_WindTrees3.wav soundparms 0.1 0.0 1.0 0.0 3000 6000 local loaded maps "dm "
	
is there anything wrong?

2nd, i found two ways i could handle the speaker: with always_draw checked, which will let it play regardless whether i can 'see' it or with always_draw unchecked which turns it off when I can't 'see' the speaker.
with all my vis_leafgroups i now can hear the sound in some places in the building and can not hear it in other places outside where i ought to. Obviously not the effect i aspired...
now, will i have to fill the whole outside area with a trigger to activate the wind sound?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

sound

Post by tltrude »

A vis_leafgroup brush makes everything inside it vanish--when you are in the the one that targets it. Even a speaker entity will vanish and stop looping its sound.

It is better to use "auto" as the channel. If you uses "local" it has to be in quotes. Don't forget to put...

local.master = spawn ScriptMaster

above your "local.master aliascache" sound lines.

And, you can change how far the sound travels by changing the min/max numbers (3000 6000). The first number is the radius in which the sound will be full volume (3000 from the speaker in all directions). Between 3000 and 6000 the sound will fade. And, at 6000 the sound will cut off.

The easiest way to make a speaker is to make a 16X16 script_object with nodraw texture, and not solid set. Give it a targetname like "tree_speaker1". Then in the script add a thread like this:

------------------------------------
level waittill prespawn
thread start_sound

level waittill spawn
end

start_sound:

wait 1
$tree_speaker1 loopsound wind_trees

end

------------------------------------

I think "wind_trees" is already being used by ubersound, so it may be better to pick a another name for your sound alias.


Hope that helps!
Last edited by tltrude on Wed Nov 12, 2003 9:06 pm, edited 1 time in total.
Tom Trude,

Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Yup like tltrude said it should be "local":

local.master aliascache wind_trees sound/amb/Amb_WindTrees3.wav soundparms 0.1 0.0 1.0 0.0 3000 6000 "local" loaded maps "dm "

Otherwise 'local' is read as referring to the current ScriptThread object (like local.player) instead of as a string.
Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

mmm
in the ubersound.scr, 'local' is used without quotes, like all other channels. But I'll give it a try.

This might solve my 1st problem, my 2nd is still remaining: How could I set my speakers so they're heard just by players that are outside the building?

thanks so far!!
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Reading failure

Post by tltrude »

Read my post again, it tells about how to set the range of the sound. it also talks about how the sound can be switch off with a leaf group. So, you could make a tiny leafgroup around the speaker and target it with ones inside the building (only needs to be as big as the sound's max range).
Tom Trude,

Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Had a idea: if a vis_leafgroup can make a speaker stop playing, then:
i set around each wind speaker a small vis leafgroup brush with targetname wind_box_1 (and _2)
and fill up the building with vis_leafgroup brushes with target wind_box_1 wind_box_2.
This ought to stop playing the sound when players are in the building? Right?

lol: was just writing this post while u did yours! :D

oh, and "local" (in quotes) worked! weird...

thanks!!! :D :D
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

YES

Post by tltrude »

YES, YES, YES!

But, You don't have to fill the whole building. Just make the range of the sound smaller.

change: 3000 6000
to: 800 1024 or something like that.
Tom Trude,

Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Re: YES

Post by wacko »

tltrude wrote:YES, YES, YES!
:oops: :D
tltrude wrote:But, You don't have to fill the whole building. Just make the range of the sound smaller.
does this have a special advantage? I think in my case, it'll be easier to completely fill the building and give the speakers rather a min/max of 6000 6000 (big enough to cover the whole map and having no fading
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Well, ok

Post by tltrude »

You can go that route if you wish, but to many vis_leafgroups will case vis data to overload (max vis is 2Mb).
Tom Trude,

Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

okay, that's fine! visdatasize is 86224...
thanks for helping!
on the other hand, wasn't it u who said i should add some ambient sound to decalattack?! :wink: (just kidding)
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Tutorial

Post by tltrude »

Using leafgroups to turn off sounds indoors is a pretty neat trick. I'm glad "WE" thought of it. Maybe "WE" should make a tutorial for it!
Tom Trude,

Image
User avatar
wacko
Field Marshal
Posts: 2085
Joined: Fri Jul 05, 2002 8:42 pm
Location: Germany

Post by wacko »

Good idea! But I think it'd be better if we made it instead of me, because our English and scripting/mapping knowledge is much better than mine.
If we want me to help us, let me know! Or should I try to write the tut and we turn it into something useful afterwards? :wink:
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Tutorial

Post by tltrude »

I'll make a quick map and you can write the "step-by-step" readme file. For the targetnames, I will use vis1, vis2 etc...
Tom Trude,

Image
Krane
Lieutenant General
Posts: 782
Joined: Sat May 31, 2003 4:18 pm
Location: California, USA
Contact:

Post by Krane »

Sounds awesome guys! The idea is fantastic!! :D
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Interesting!!!

Post by tltrude »

I tried using two mp3 files as the sound alias' and found that only the first one would work--using the normal "local.master" lines. But, with this alteration, both of them work!!!

-----------------------------------------
local.master = spawn ScriptMaster
local.master aliascache outside_snd sound/amb_stereo/Amb_M4_CountryExt_02.mp3 soundparms 1.0 0.0 1.0 0.0 5000 5000 "local" loaded maps "dm moh obj train"

local.master2 = spawn ScriptMaster
local.master2 aliascache inside_snd sound/amb_stereo/Amb_M4_CountryInt_02.mp3 soundparms 1.0 0.0 1.0 0.0 256 300 "local" loaded maps "dm moh obj train"
-----------------------------------------
Tom Trude,

Image
Post Reply