Jump to content

Photo

how to allow only one instance of a sound at a time?

sound

  • Please log in to reply
5 replies to this topic

#1
LolzMan1325

LolzMan1325

    Old hand

  • Members
  • PipPipPip
  • 716 posts

i modified an existing mod to allow for hitsounds, but there's a problem: if you use a shotgun, it makes a hitsound for each individual pellet, and given how new vegas' sound works, this is considered "loud" and thus overrides most other sounds for a hot second.

 

is there a way to allow only one instance of a sound? I.E. a sound can not overlap itself, especially if multiple instances occur at the same time, inadvertently making the sound louder?



#2
UnvalidUserName

UnvalidUserName

    Enthusiast

  • Members
  • PipPip
  • 204 posts
There's the StopSound command from JIP, and that's about it. I recommend making some check to see if the script fired in the last 2 or 3 frames, and skip the PlaySound if it did.

#3
lStewieAl

lStewieAl

    Faithful poster

  • Premium Member
  • 1,434 posts
You could instead just prevent the sound playing within some time interval of another by storing and comparing the current time before playing the sound.

#4
LolzMan1325

LolzMan1325

    Old hand

  • Members
  • PipPipPip
  • 716 posts

so how would i check the number of frames passed? the only functions i've seen count in realtime or game time, not frames



#5
UnvalidUserName

UnvalidUserName

    Enthusiast

  • Members
  • PipPip
  • 204 posts
I assume you are working on that hitsound mod and therefore you want to use it in an event handler. If that's the case, it's easier to use GetSecondsPassed but you might need to test how it behaves if called multiple times in a same frame. It theory it should return 0 unless it's being called without breaking out of the UDF

#6
KiCHo666

KiCHo666

    A Nice Guy Fascist

  • Supporter
  • PipPipPipPip
  • 2,068 posts

You could try using NVSE's OnHit. That one won't register more than 1 shotgun pellet per hit.







Also tagged with one or more of these keywords: sound

Page loaded in: 1.178 seconds