Files

> > CS2D > Lua Scripts > Weapon Deploy/Draw Sound Effect
Files overviewCS2D overviewLua Scripts overview

English Weapon Deploy/Draw Sound Effect >

9 comments134 kb, 37 Downloads

old Weapon Deploy/Draw Sound Effect

Cure Pikachu
User Off Offline

What this script basically does is attempt (as much as possible) to emulate the sound effects that the Counter-Strike games make of you drawing/chambering your weapon whenever you switch into it. Also comes with an additional sound effect of you actually placing the bomb down when you successfully plant it.

No screenshots are provided! This script has nothing for you to experience visually; it's purely auditory.

> Installation
• Extract archive to CS2D directory, maintaining folder structure
• Copy the contents in servertransfer_wpnsnds.lst and append them into your own servertransfer.lst, otherwise other players who do not have the sounds can't hear them

> Customization
Weapon List >

These are the remaining settings:
-- Teammates only?
pikachu.wpnsnds.teamonly = true
-- Distance check in pixels
pikachu.wpnsnds.teamrange = 400
-- Extend to dead players spectating?
pikachu.wpnsnds.teamspec = true
-- Use exact player position instead of cache for distance checking?	
pikachu.wpnsnds.precisepos = false

•
pikachu.wpnsnds.teamonly
determines who else nearby can hear the weapon drawing sound effects you make.
true
for teammates only (default setting),
false
for everyone (using cs2d cmd sv_soundpos).
•
pikachu.wpnsnds.teamrange
determines how far approximately (in pixels) teammates can be from you to be able to hear you switching your weapon. The default value is 400 and the minimum value is 1 (Just to be safe, there is an error check in place).
•
pikachu.wpnsnds.teamspec
determines whether dead people or spectators are able to hear the weapon drawing sound effects you make if they focus on you or your nearby teammates. Setting it to
true
enables this (default setting).
•
pikachu.wpnsnds.precisepos
determines whether player positions for distance checks will be precise (i.e. use the players' x and y coordinates during the checks themselves) if
true
, otherwise it will instead use a system that caches player positions to the nearest tile (default is
false
)

Changelog >


P.S. I looked around the file archive earlier and was baffled by the non-existence of a script like this, I will have figured someone published their own version by now
edited 108×, last 11.01.24 02:12:16 pm
Approved by DC

Download Download

134 kb, 37 Downloads

Comments

9 comments
To the start Previous 1 Next To the start

Log in!

You need to log in to be able to write comments!Log in

old

Cure Pikachu
User Off Offline

@user Gaios: Right, what do you think of this?
More >
edited 3×, last 30.08.23 01:53:24 am

old

Gaios
Reviewer Off Offline

file cs2d Weapon Deploy/Draw Sound Effect has written
FIXED
The distance check formula used to check for nearby teammates was bugged (forgot to square the
y
value lol), replaced with something more modern: cs2d lua cmd closeplayers

I think you should consider caching player positions (eg. by cs2d lua hook tile - don't need to be accurate) and then use native Lua function to calc distance (or better: calc if position is within the distance)
Code >

Too many calls to CS2D's API in single frame will lead to TPS drops. Also the hook could be disabled if configuration for spec players is disabled.
player(0, 'table')
should definitely be cached, for example by cs2d lua hook connect and cs2d lua hook disconnect hooks.
I like it!

old

cs2d_is_a_Gem
User Off Offline

always excellent cure pikachu
I like it!

old

Gaios
Reviewer Off Offline

Ok, I like it
I like it!

old

Cure Pikachu
User Off Offline

3D Counter-Strike analogy it'd be like the SFX of you chambering your AK or M4 whenever you switch to it (the weapon draw animation)

old

Gaios
Reviewer Off Offline

Yes, and what does add yours?
I like it!

old

Cure Pikachu
User Off Offline

@user Gaios: Is there? I am only aware of the clipin and clipout ones, which are just for reloading

old

Gaios
Reviewer Off Offline

CS2D has native support for such sounds.
I like it!

old

zazz
User Off Offline

Pretty cool actually, it's so satisfying lol
I like it!
To the start Previous 1 Next To the start