ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Rain on Clothes Audio Script

1 2 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Oldest Up Sort by Ascending
  23:35:41  7 April 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567
Thanks for the responses, guys.

Yes, merging my rain on clothes audio with the default rain would be easy, but that is not the implementation I am looking for. I want them to be called separately and I am at least willing to spend a good bit of effort trying to see if there is an easier way to implement it.

In a perfect world, I want the rain_on_clothes audio to be "culled" in the same way the rain audio is (ie based on the rain's draw vector), except not to 50% volume - all the way to 0%. But I know that stuff is hard-coded and I can't access it.

Is there a variable that stores the current volume of the rain? I know there is the rain_factor() function, but I don't think that is related to volume - only how "intensely" it is raining.
  19:04:25  7 April 2013
profilee-mailreply Message URLTo the Top
{imperialreign}
Звуковой Шаман
(Resident)

 

 
On forum: 10/29/2008
Messages: 3075
In response to Wobbles - it doesn't exactly work that way... the engine handles the "rain effectors" (i.e. rain draw, rain splashes and sound playback) via the engine libraries. Rain draw is "culled" if there are solid objects in the path of the draw vector... anything from a building, to a tree, to AI objects. If the actor goes inside a building, the engine will continue to draw rain *around* said structure or object. Typically, though, the draw diameter around the actor is only something like 15M-20M (I don't remember the exact distance that was figured out) - beyond that distance, to reduce rendering stress, rain is not draw at all. Whenever the actor is "under cover," (i.e. where rain is being culled), the engine also lowers the rain playback volume by roughly 50%, to give the impression of being under cover and not directly in the rain... so, without a method of some sort similar to what Daemonion is working out, there's essentially no other way to get both sounds to cooperate aside from editing the engine render libraries...

But, that being said, it does give me an idea - though not sure how well it would work out... daemonion - (though I haven't actually hear the sound) you *could* attempt to re-edit the clothes sound and make it softer without as harsh of an "impact," then mix it with the rain sound at a slightly lower volume such that it would be noticeable... but, with volume reduced, the lower frequencies would be barely noticeable. Then pass it through the SDK with a bas volume of, taking a random guess here, or 0.75 instead of 1.00 - with the additional engine volume reduction, the rain *should* still be noticeable, but the player would "casually ignore" the clothes sound... perhaps trying different rain fall sounds, and/or different clothes edits might produce better results as well. Essentially, the rain fall would have to have more higher frequencies to survive the volume cut, if that makes any sense...

... you still might have an issue, though, where if someone stands perfectly still in-doors or under cover, they might notice if they're really paying attention to the background noises... just a quick thought, I doubt it would work out superbly, but might provide a "cheating" style work-around by taking natural advantage of how the engine handles rain, and how human hearing tends to work for the vast majority of people, lol. I've used this method with CS/CoP ambient backgrounds and such, but can take A TON of testing, tweaking, editing, fiddling, praying, soul selling, whiskey drinking, money laundering, miracle summoning and tear shedding to get right... and you still might get that one ass-hat that wants to bitch: "WTF does it sound like this for?! Derp."
  15:57:31  7 April 2013
profilee-mailreply Message URLTo the Top
Wobbles84
(Senior)
 
On forum: 10/08/2005
 

Message edited by:
Wobbles84
04/07/2013 16:09:24
Messages: 74
Sorry if this is a bit of a noobish post but, would it not be alot more efficient to record the rain on clothes sound with the normal rain audio in cubase or something like that and make a new rain ogg file. Then use that sound when you are outdoors? You don't really leave the first person view alot in stalker except when theres a fly-by camera sequence happening. So most of the time when you are hearing rain outdoors you should be hearing it on your clothes anyway. The only thing is getting the original rain ogg (without the clothes sound) to only play when you are in cover or going indoors. Would that not cut out alot of coding and also make it more compatible across mods and even games?
  11:31:08  7 April 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
 

Message edited by:
Daemonion
04/07/2013 11:32:38
Messages: 567
More Efficient Way?

I am trying to see if there is a more efficient way to play my rain_on_clothes audio.

Currently, my script to play the audio (http://pastebin.com/mapaX87Y) requires the info_portion interior_whitenoise_playing to be false, AND for it to be raining (obviously) in order for the audio to play.

The info_portion is true, which stops the audio, when the player walks inside a building ...but only if I have placed a space restrictor with scripting that gives the player that info_portion (http://i.imgur.com/6TKLyQn.jpg).

This means that the audio only works in areas that I have placed space restrictors with the proper script. Because of this, I am realizing that this means that the rain_on_clothes audio doesn't always work the way I want it to.

For example, what if the player is indoors, but standing under a hole in the roof? Rain falls through the hole onto the player. The audio should play, but it won't, because they are in the restrictor and the info_portion is true.

What about all of the little areas where the player can be under "cover," but there is no info_portion change? The player still hears rain drops on their clothes, but there is no space restrictor to tell them they are "under cover."

So, my idea is this: the engine has a hard-coded feature where the volume of the rain will lower if the player stands under cover (in a building, under a tree, etc). What if I made the rain_on_clothes audio stop playing when the rain volume is lowered instead of using info portions?

Example: Player stands out in the open, so rain is at full volume. Rain_on_clothes audio plays.

Player moves under a tree. Rain volume gets lowered to (I don't know exactly what it is)50%. Rain volume < 100%, so rain_on_clothes audio stops.

Would this work? How could I do it?


A video to clarify how things work: http://youtu.be/MbfEaIbqSxI (will be live in 30min)


Thanks!
  14:35:41  9 March 2013
profilee-mailreply Message URLTo the Top
NatVac
Senior Resident
 

 
On forum: 06/15/2007
Messages: 4286
>> It was actually due to me using ([[xxx]]) instead of ("xxx")

Not for the reason you think, Daemonion. While the two forms are functionally equivalent, they use different syntax; the square-bracket version doesn't need to escape the backslashes in the path (i.e., use two backslashes to tell the string parser to treat it as a single literal backslash).

So your first post had the correct syntax. The quoted string example needed the backslash pairs, but your subsequent post with square brackets changed from the original. (For those following the discussion, see how sound_theme.script uses both forms.)

Okay, that would have let the sound attempt to play once, maybe very briefly if at all due to the immediacy of a subsequent call. The real problem is that the script would create and try to use a new sound on each call to the function. You would not be managing the same sound and you would be using up more memory on each call until the garbage collector would have a chance to catch up.

The get_safe_sound_object() gives you the original sound, which you can control over time as conditions change. --At least in theory.
  07:05:15  6 March 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567
Natvac,
I always appreciate your responses. I am constantly trying to learn more to help myself and, I must admit, when I see you've stopped by a thread of mine I know I'm in for a treat

I finished the foundation of the script. I will now be adding extras to it, but here it is: http://pastebin.com/mapaX87Y

It was actually due to me using ([[xxx]]) instead of ("xxx" . I took your advice and am using safe sound object instead, though.
  07:45:10  5 March 2013
profilee-mailreply Message URLTo the Top
NatVac
Senior Resident
 

 
On forum: 06/15/2007
Messages: 4286
To clear up some older stuff first:

>> I actually tend to get this error anytime I write a script
>> that isn't fully functional. I get it all the time.

Exactly, Daemonion. Usual vanilla cause of this specific error is the invocation of _g.script's abort() by some test in another script, but the vanilla abort() has a script error -- printf("%s") -- that causes this crash. But you don't get to see the original reason for the call to abort(). (Modders can directly call printf() with bad data themselves, but printf() should never be called unless one replaces the function body with a more useful version of their own.)

You will still "get it all the time", but you will know what the problem is with the fixed _g.script, because the game will report the first error instead of the second. See http://www.metacognix.com/stlkrsoc/CrashesStillInTheGame.html about this _g.script:20 crash; it's #8 on the list.

---QUOTATION---
I'll try what you suggested, but that error usually tells me that something in the script isn't working as opposed to an external cause.
---END QUOTATION---


Yes. The abort function is passing in bad data in the vanilla _g.script.

And no. I seem to have this discussion with modders a lot. See my post in this thread for exactly what is going on:

---QUOTATION---
"fatal error pls help":
https://www.gsc-game.com/main.php?t=community&s=forums&s_game_type=xr&thm_id=21467&sec_id=16
---END QUOTATION---


I answered this problem because the actual problems were being hidden. Yes, as Decane pointed out, there were obvious issues. But I'm trying to give you the framework to solve problems on your own. And as you noted, "xxx" and [[xxx]] are equivalent.

One possible problem with your current code is the use of locals for rain_fps_l and rain_fps_r, combined with the use of the engine's sound_object() call rather than xr_sound.get_safe_sound_object().

The local call will result in a new sound_object each time unless you use the get_safe_sound_object() function.

I noticed that when I was playing a sound in game via ZSU's Execute Script Command, subsequent creations of sound_objects using the same sound would play the sound only briefly, cutting off most of it.

Another possibility is the use of "0" as the second argument in the sound_object() creation. That corresponds to sound_object.s3d. Have you tried using a "2" (sound_object.s2d) there?

The last (unlikely) possibility is the path. I assume daemonion\ is a subdirectory under sounds\ and your $game_sounds$ reference in fsgame.ltx is a valid reference to it.
  22:06:42  25 February 2013
profilee-mailreply Message URLTo the Top
chuppa
Senior Resident
 

 
On forum: 04/11/2008
Messages: 409
Oh! - yep, more xray hard coded fun. I hope you get it sorted as it will be a great feature
  21:38:14  25 February 2013
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
Total noob comment here - for which I apologise (my modding is limited to blending, config values tweaking and file replacement/shuffling) - but I'm a bit lost why you're trying to make a script function to detect whether the player is under cover etc. when the game already seems to have that function? - ie. local player environment sound clearly alters according to whether you're indoors or even under trees - tho only in volume I think...

I'm only jumping in on this because the idea is excellent - ie. I've puzzled from the first time I experienced rain in the game why we weren't getting that "rain on clothes" effect rather than just amplified generic environment rain volume - especially when the differentiation mechanics of being under cover was already there.
---END QUOTATION---


You are absolutely right - there is a sweet feature with the rain that lowers the volume is the player is under "cover" (ie, a tree) or indoors.

However, I believe that the feature is hard-coded, which means it is beyond my capability to get to. Furthermore, I need the rain on clothes audio to stop completely when the play is indoors (because the rain isn't hitting them anymore), not just decrease the volume.

Currently, I am setting up every building in the game with a space restrictor, which is essentially a 3D box that you can apply code to. Part of the code I'm using is an info_portion I made that essentially says "the actor is indoors." So, using this method, if the info_portion comes back true, it means that the actor is inside. So I am using that method instead.

Thanks for the idea. I'm stoked you like the feature. I really, really want it to work. I don't understand why that script isn't working.
  21:22:39  25 February 2013
profilee-mailreply Message URLTo the Top
chuppa
Senior Resident
 

 
On forum: 04/11/2008
Messages: 409
Total noob comment here - for which I apologise (my modding is limited to blending, config values tweaking and file replacement/shuffling) - but I'm a bit lost why you're trying to make a script function to detect whether the player is under cover etc. when the game already seems to have that function? - ie. local player environment sound clearly alters according to whether you're indoors or even under trees - tho only in volume I think...

I'm only jumping in on this because the idea is excellent - ie. I've puzzled from the first time I experienced rain in the game why we weren't getting that "rain on clothes" effect rather than just amplified generic environment rain volume - especially when the differentiation mechanics of being under cover was already there.
 
Each word should be at least 3 characters long.
Search:    
Search conditions:    - spaces as AND    - spaces as OR   
 
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
 

All short dates are in Month-Day-Year format.


 

Copyright © 1995-2020 GSC Game World. All rights reserved.
This site is best viewed in Internet Explorer 4.xx and up and Javascript enabled. Webmaster.
Opera Software products are not supported.
If any problem concerning the site functioning under Opera Software appears apply
to Opera Software technical support service.