ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
Need help with scripting ideas for audio!

1 2 3 4 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  23:40:02  19 October 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567
Need help with scripting ideas for audio!

I have a few ideas I wanted to run by you guys and see if you could provide any input.

Idea #1
Create a script which plays the sound of bullet casings hitting the ground when the player has fired a gun over certain terrain types.

As far as I know the terrain types are:
default
earth
grass
gravel
metal_plate
new_wood
t_water
tin


I know that the game can already tell what type of terrain the actor is on because the footstep sounds change depending on what texture (I'm assuming the terrain type is tied to the texture) the actor is standing on.

So, how could I go about applying bullet casing sounds to this after the actor shoots? I want to have bullet casings dropping be a separate audio file from gun shot audio.


Idea #2
If the player is outside (not indoors) and it is raining, I would love to create a script which triggers a sr_sound_act around the player that stays with the actor for the duration of the rainstorm/being outside in the rain. The sr_sound_act would play an audio file to mimic the sound of rain drops falling on their clothes.


Idea #3
I want to have different gun shot audio for the actor and for NPCs. For example, I would love for the actor to call "actor_ak47_shot1" when shooting an ak47 and an NPC to call "npc_ak47_shot1" when they are firing. This way, I could create separate first person and third person weapon audio.


Any ideas? Thank you!
  00:51:21  20 October 2012
profilee-mailreply Message URLTo the Top
Muad'Dib
Senior Resident
 

 
On forum: 01/24/2011
Messages: 421
Hey Daemonion,

About your first idea:

Sounds haven't link with textures, but with objects properties in Level Editor.
The link is between the sound and the object, not the texture.

Open LE
> object library
> select one object
> open properties
> check a sub object
The sound is control by the Game Mtl for each object.

[link]http://uppix.net/f/3/d/5345558d3a2df980e3d126b24b959.png[/link]

As example: in LE, you could create a concrete block with wood texture and metal footstep sound.

I don't know what files control the Game Mtl sound in game.
Maybe could you search in this way.
But i think that is a link with levels folder and levels compilation (.geom or other files).

For idea 2:
Look in actor.ltx and study this section:
[actor_hit_snds]
physic_strike =actor\pain1,actor\pain2,actor\pain3; ,actor\hurt4

Maybe could you create a new actor_hit_snds.
But you need to create a new hit section (without effect, it's as you want).
Your hit section will be active when it's raining and when actor is out a restrictor

In a russian winter mod, the health decrease by night like a frost effect:
[link]https://www.gsc-game.com/index.php?t=community&s=forums&s_game_type=xr&thm_page=1&thm_id=21730&page=1&sort=ASC&sec_id=16[/link]
I don't know how it do. Maybe could look in this one.

I hope that it can help you.

About idea 3, i don't understand what you want to create this.
In game, it's the same sound for one weapon, but the distance between npc and player decrease the sound effect of npc's weapon, isn't it?
So, you have one .ogg file but two sound sources, no?


I'm waiting to see all your new sounds features in lurk. Keep up the good work.
  02:15:46  20 October 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
About idea 3, i don't understand what you want to create this.
In game, it's the same sound for one weapon, but the distance between npc and player decrease the sound effect of npc's weapon, isn't it?
So, you have one .ogg file but two sound sources, no?
---END QUOTATION---


I really want to focus on the difference in perspective.

Firing from the first person perspective, I want the audio file to balance the mechanical noise of the bolt cycling, trigger resetting, etc etc along with the "bang." I also want it to be just a little beefier for the first person perspective.

However, I don't want those same sounds from NPCs. For the third person perspective (hearing an NPC fire the gun), I mostly want to focus on the "bang" as opposed to the mechanical noises.

I believe all the engine does is lower the volume the further away the player is from the sound source. I want to take it a step further than that and have NPCs use a completely different set of weapon audio.


Do you think this is possible to do with scripting?
  03:29:43  20 October 2012
profilee-mailreply Message URLTo the Top
Muad'Dib
Senior Resident
 

 
On forum: 01/24/2011
 

Message edited by:
Muad'Dib
10/20/2012 3:32:12
Messages: 421
Sorry, I'm not a scripter. So, i'm not sure if it's possible or not.

Maybe could you change the script that call sounds.

Look in xr_motivator.script:

function motivator_binder:hear_callback(self, who, sound_type, sound_position, sound_power)
if who:id() == self:id() then
return
end
local type = "NIL"
if bit_and(sound_type, snd_type.weapon) == snd_type.weapon then
type = "WPN"
if bit_and(sound_type, snd_type.weapon_shoot) == snd_type.weapon_shoot then
type = "WPN_shoot"
elseif bit_and(sound_type, snd_type.weapon_empty) == snd_type.weapon_empty then
type = "WPN_empty"
elseif bit_and(sound_type, snd_type.weapon_bullet_hit) == snd_type.weapon_bullet_hit then
type = "WPN_hit"
elseif bit_and(sound_type, snd_type.weapon_reload) == snd_type.weapon_reload then
type = "WPN_reload"
end
.......
end
end


Here the condition "who" isn't use. I don't thing it's the good writing (a good scripter could correct it) but the idea is here:

function motivator_binder:hear_callback(self, who, sound_type, sound_position, sound_power)
if who:id() ~= db.actor:id() then
if bit_and(sound_type, snd_type.weapon) == snd_type.weapon then
type = "WPN"
if bit_and(sound_type, snd_type.weapon_shoot) == snd_type.weapon_shoot then
type = "WPN_shoot2"
elseif bit_and(sound_type, snd_type.weapon_empty) == snd_type.weapon_empty then
type = "WPN_empty2"
elseif bit_and(sound_type, snd_type.weapon_bullet_hit) == snd_type.weapon_bullet_hit then
type = "WPN_hit2"
elseif bit_and(sound_type, snd_type.weapon_reload) == snd_type.weapon_reload then
type = "WPN_reload2"
end
end
end
if not who:id() ~= db.actor:id() then
if bit_and(sound_type, snd_type.weapon) == snd_type.weapon then
type = "WPN"
if bit_and(sound_type, snd_type.weapon_shoot) == snd_type.weapon_shoot then
type = "WPN_shoot"
elseif bit_and(sound_type, snd_type.weapon_empty) == snd_type.weapon_empty then
type = "WPN_empty"
elseif bit_and(sound_type, snd_type.weapon_bullet_hit) == snd_type.weapon_bullet_hit then
type = "WPN_hit"
elseif bit_and(sound_type, snd_type.weapon_reload) == snd_type.weapon_reload then
type = "WPN_reload"
end
end
end
end

And create new links for sounds in each weapons .ltx files

;Original sound for npc
snd_draw = weapons\pm_draw
snd_holster = weapons\generic_holster
snd_shoot = weapons\t_pm_shot ;pm_shoot
snd_empty = weapons\pistol_empty
snd_reload = weapons\pm_reload, 0.8
snd_close = weapons\generic_close

;new sound for player
snd_draw2 = weapons\pm_draw2
snd_holster2 = weapons\generic_holster2
snd_shoot2 = weapons\t_pm_shot2 ;pm_shoot
snd_empty2 = weapons\pistol_empty2
snd_reload2 = weapons\pm_reload2, 0.8
snd_close2 = weapons\generic_close2
  05:36:37  20 October 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735
"function motivator_binder:hear_callback(self, who, sound_type, sound_position, sound_power) ..."

The callback (callback.sound) value exists in lua_help but I don't see it used or activated anywhere. If it works I can see it being used in creative ways.
  07:03:13  20 October 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
In a russian winter mod, the health decrease by night like a frost effect:
[link]https://www.gsc-game.com/index.php?t=community&s=forums&s_game_type=xr&thm_page=1&thm_id=21730&page=1&sort=ASC&sec_id=16[/link]
I don't know how it do. Maybe could look in this one.

I hope that it can help you.
---END QUOTATION---


I downloaded this mod and unpacked .dbg and .dbh, but I can't unpack .dbf for some reason.

It only gives me gamedata\texture folder, so no config files
  07:13:08  20 October 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567

---QUOTATION---
"function motivator_binder:hear_callback(self, who, sound_type, sound_position, sound_power) ..."

The callback (callback.sound) value exists in lua_help but I don't see it used or activated anywhere. If it works I can see it being used in creative ways.
---END QUOTATION---


Hm, what would callback.sound do?
  08:56:26  20 October 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
 

Message edited by:
Daemonion
10/20/2012 9:08:18
Messages: 567
Alright, well, this is what I came up with so far, and it doesn't work. I have tried several combinations. I just want WPN_shoot for NPCs and WPN_shoot_actor for the Actor.

Here is my new xr_motivator.script: http://pastebin.com/yGKbb2aT

I noticed that the entire function was commented out before I started edited it. Does that mean the game does not use it? I removed the comments for testing. Also, I rearranged everything so that it became more like:

function motivator_binder:hear_callback(self, who, sound_type, sound_position, sound_power)
        local type = "NIL"
        if who:id() ~= db.actor:id() then
                do npc gunfire (WPN_shoot)
        end
        if who:id() == db.actor:id() then
                do actor gunfire (WPN_shoot_actor)
        end
end




I am using the makarov for testing, so, my w_pm.ltx reads:

snd_draw					= weapons\pm_draw
snd_holster				= weapons\generic_holster
snd_shoot					= weapons\t_pm_shot
snd_shoot_actor			        = daemonion\weapons\actor_shoot
snd_empty					= weapons\pistol_empty
snd_reload					= weapons\pm_reload, 0.8
snd_close					= weapons\generic_close

  09:42:53  20 October 2012
profilee-mailreply Message URLTo the Top
NatVac
Senior Resident
 

 
On forum: 06/15/2007
Messages: 4302
It was commented out in ZRP because it is not used. Look at motivator_binder:net_spawn() in the same file for the set_callback(hear_callback) line. You can re-enable that callback registration, but remove all the useless stuff in the hear_callback() function (where the type of the sound is set for a meaningless printf() call at the end) if you don't convert it into something useful.

Your pastebin code seems to double that "stuff", but I'm sure you are just trying to get it working.
  09:55:31  20 October 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
 

Message edited by:
Daemonion
10/20/2012 9:57:57
Messages: 567

---QUOTATION---
It was commented out in ZRP because it is not used. Look at motivator_binder:net_spawn() in the same file for the set_callback(hear_callback) line. You can re-enable that callback registration, but remove all the useless stuff in the hear_callback() function (where the type of the sound is set for a meaningless printf() call at the end) if you don't convert it into something useful.

Your pastebin code seems to double that "stuff", but I'm sure you are just trying to get it working.
---END QUOTATION---


So, I re-enabled this line:

	self.object:set_callback(callback.sound, motivator_binder.hear_callback, self)


and kept everything else the same. It still will not work, it seems. I am guessing that the huge chunk of code I put in is borked.

By "meaningless stuff," do you mean turning this:

function motivator_binder:hear_callback(self, who, sound_type, sound_position, sound_power)



into this?:

function motivator_binder:hear_callback(self, who, sound_type)

 
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-2021 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.