ProjectsWhat's NewDownloadsCommunitySupportCompany
Forum Index » S.T.A.L.K.E.R.: Shadow of Chernobyl Forum » Mod discussion
snd_zoomin and snd_zoomout

1 2 3 4 | Next 10 events »| All Messages
Posted by/on
Question/AnswerMake Newest Up Sort by Descending
  22:41:04  11 December 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567
snd_zoomin and snd_zoomout

I noticed that the binoculars (in w_binoc.ltx) have the variables snd_zoomin and snd_zoomout. These sounds are triggered when the player enters (zoomin) and exits (zoomout) the "iron sights" of the binoculars.

I want a snd_zoomin and snd_zoomout variable for each weapon, not just the binoculars.

I tried simply adding those lines into a random weapon .ltx file, but it doesn't seem to work. I also searched the entire gamedata folder for the phrase "snd_zoomin" and it only appears in w_binoc.ltx

How can I have a snd_zoomin and snd_zoomout for each weapon? Ideally, I'd want, say, w_pm.ltx to read:
snd_draw					= weapons\pm\draw
snd_holster					= weapons\pm\holster
snd_shoot					= weapons\pm\shot
snd_shoot1					= weapons\pm\shot1
snd_shoot2					= weapons\pm\shot2
snd_shoot3					= weapons\pm\shot3      
snd_empty					= weapons\pm\empty
snd_reload					= weapons\pm\reload
snd_zoomin					= weapons\in
snd_zoomout					= weapons\out

  00:33:16  12 December 2012
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
 

Message edited by:
Alundaio
12/12/2012 0:43:20
Messages: 2230
I use a function to tell if the actor is zoomed in or out with a Scope or binoculars using these functions:


-------------------
-- call from stalker_binder:update() 
-------------------
local actor_scope
function actor_on_update()
	local wpn = db.actor:active_item()
	if (wpn) then
		if (wpn:section() == "wpn_binoc" or alun_utils.addon_attached(wpn,"sc")) then
			if (device().fov < 50) then
				if not (actor_scope) then
					actor_scope = true
					actor_on_weapon_zoom_in(wpn)
				end
			else
				if (actor_scope) then
					actor_scope = nil
					actor_on_weapon_zoom_out(wpn)
				end
			end
		else
			if (actor_scope) then
				actor_scope = nil
				actor_on_weapon_zoom_out(wpn)
			end
		end
	end
end

-------------------
-- actor_on_weapon_zoom_in(wpn)
-------------------
function actor_on_weapon_zoom_in(wpn)

end

-------------------
-- actor_on_weapon_zoom_out(wpn)
-------------------
function actor_on_weapon_zoom_out(wpn)

end



You could trigger the sounds manually inside the zoom_in or zoom_out functions. You'll need to play with device().fov more then likely.
  00:39:19  12 December 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567
Of course you have an answer for this problem, Alundaio

Do I add those functions inside bind_stalker? Also, I am not clear on how to use a function to play a sound. I'll do some digging and see if I can find some examples that are already in the game.
  01:07:33  12 December 2012
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
 

Message edited by:
Alundaio
12/12/2012 1:23:12
Messages: 2230

---QUOTATION---
Of course you have an answer for this problem, Alundaio

Do I add those functions inside bind_stalker? Also, I am not clear on how to use a function to play a sound. I'll do some digging and see if I can find some examples that are already in the game.
---END QUOTATION---



http://pastebin.com/WxtrAdWA

Just save that as daemonion_sound.script inside your script folder and then call daemonion_sound.actor_on_update() inside bind_stalker.script update function.


--                          [section]  = { sound, fov }

local sections_zoom_in = {

                                                        ["wpn_pm"] = {[[weapons\nv_start]],54},

 

}



Just add your own sections to the tables with the FOV you want it triggered at and the sound file you want played. Unfortunately, play_at_pos doesn't move with the object. I don't know how else to do it. Example should play Night vision sounds when you zoom in and out with PM unless the fov is set too low.

EDIT: updated the pastebin for a change to fov. Vanilla camera FOV is 55, so anything lower then that will trigger the script.
  02:25:58  12 December 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
Messages: 567
To add in the other weapons, do I do so like this?

http://pastebin.com/v8ECefrS
  02:49:19  12 December 2012
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
 

Message edited by:
Alundaio
12/12/2012 2:50:34
Messages: 2230

---QUOTATION---
To add in the other weapons, do I do so like this?

http://pastebin.com/v8ECefrS
---END QUOTATION---



Yep
  03:20:54  12 December 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
 

Message edited by:
Daemonion
12/12/2012 3:22:47
Messages: 567
I added this line to my bind_stalker:

http://pastebin.com/6er2V8GX

Is that correct?

and the FOV in the daemonion_sound.script should always be one less than what is listed in scope_zoom_factor in the w_xxx.ltx, correct?
  03:44:44  12 December 2012
profilee-mailreply Message URLTo the Top
Alundaio
Sad Clown
(Resident)

 

 
On forum: 04/05/2010
 

Message edited by:
Alundaio
12/12/2012 3:48:25
Messages: 2230

---QUOTATION---
I added this line to my bind_stalker:

http://pastebin.com/6er2V8GX

Is that correct?

and the FOV in the daemonion_sound.script should always be one less than what is listed in scope_zoom_factor in the w_xxx.ltx, correct?
---END QUOTATION---



I'm not sure about zoom_factor. The default fov already is 55, so I don't know why zoom_factor is 55 for these weapons because when you zoom in it's about 48 for wpn_pm.

Is it working properly? I did test it in cop.
  04:38:19  12 December 2012
profilee-mailreply Message URLTo the Top
Daemonion
All About Audio
(Resident)

 

 
On forum: 09/27/2011
 

Message edited by:
Daemonion
12/12/2012 4:41:32
Messages: 567

---QUOTATION---
I added this line to my bind_stalker:

http://pastebin.com/6er2V8GX

Is that correct?

and the FOV in the daemonion_sound.script should always be one less than what is listed in scope_zoom_factor in the w_xxx.ltx, correct?

I'm not sure about zoom_factor. The default fov already is 55, so I don't know why zoom_factor is 55 for these weapons because when you zoom in it's about 48 for wpn_pm.

Is it working properly? I did test it in cop.
---END QUOTATION---


It is not working properly, no. Does the CoP bind_stalker also use function actor_binder:update(delta)?

To clarify, I do not need to make any changes to any w_xxx.ltx file, correct?
  04:41:29  12 December 2012
profilee-mailreply Message URLTo the Top
Nuor
Senior Resident
 

 
On forum: 03/10/2009
Messages: 735

	local sc_factor = 90
	if sys_ini:line_exist(scope_type, "scope_zoom_factor") then
		sc_factor = sys_ini:r_string(scope_type, "scope_zoom_factor") or 90
	end
	local zoom_threshold = sc_factor/90 * 67.5 + 0.1
	local zoom_on = device().fov

	if  zoom_on < zoom_threshold then ...



I use something near to this. I never really fine tuned it.
 
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.