Corehound Posted February 20, 2012 Share Posted February 20, 2012 Hey everyone :thumbsup: I'm currently working on a mod where I need an armor to play a custom sound in a loop to imitate heavy footsteps, but only on key pressed. I basically have all the lines I need, but I can't seem to find out how I make the sound loop with a specific interval, at the moment I basically get spammed by the sound, with the sound sounding like it loops about 200 times per second :confused: Any way to adjust this? :unsure: Any help on this would be greatly appreciated :thumbsup: http://www.fallout3nexus.com/imageshare/images/1680733-1296223756.png Link to comment Share on other sites More sharing options...
caramellcube Posted February 21, 2012 Share Posted February 21, 2012 if you just need to add a delay, then timer loop might do it, something like this maybe... float NameTimer Begin GameMode set NameTimer to NameTimer + GetSecondsPassed If NameTimer > 1 PlaySound Something Set NameTimer to 0 Endif End Haven't tested it, but it looks like it should work. Link to comment Share on other sites More sharing options...
Corehound Posted February 21, 2012 Author Share Posted February 21, 2012 if you just need to add a delay, then timer loop might do it, something like this maybe... --Snip-- Haven't tested it, but it looks like it should work. This is basically the script I have, that I need to integrate with the delay. scn CTPCMech02SoundMoveSCRIPT Begin GameMode Playsound CTPCMech01SoundIdle01SOUN Endif if iskeypressed 17 playsound CTPCMech01SoundRun01SOUN Endif if iskeypressed 31 playsound CTPCMech01SoundRun01SOUN Endif End So where do I fit the "if iskeypressed 17" part into the code you mention? :unsure: Also the "NameTimer", do I leave it like that, or am I to replace this with a custom name of my choosing? :unsure: Sorry for the many questions, been looking for a solution for this for some time now :tongue: http://www.fallout3nexus.com/imageshare/images/1680733-1296223756.png Link to comment Share on other sites More sharing options...
caramellcube Posted February 21, 2012 Share Posted February 21, 2012 Hmm, now it's an untested mod of some untested code, and it's limited to both keys having the same sound and both sounds having the same loop time, but this might work. (I should be able to re-write it later if needed, for now it's a bit rushed). scn CTPCMech02SoundMoveSCRIPT float CTPCTimer Begin GameMode set CTPCTimer to CTPCTimer + GetSecondsPassed If (CTPCTimer > 1) if (iskeypressed 17) + (iskeypressed 31) playsound CTPCMech01SoundRun01SOUN else Playsound CTPCMech01SoundIdle01SOUN endif Set CTPCTimer to 0 Endif End Questions are what the forum is for :) I just put Name in there as a placeholder for whatever prefix you use, so I've replaced it with CTPC for this version. You can make variables with whatever name you like as long as it doesn't conflict, though a well organised standard makes it so much easier. Link to comment Share on other sites More sharing options...
Corehound Posted February 21, 2012 Author Share Posted February 21, 2012 Hmm, now it's an untested mod of some untested code, and it's limited to both keys having the same sound and both sounds having the same loop time, but this might work. (I should be able to re-write it later if needed, for now it's a bit rushed). --Snip-- Questions are what the forum is for :) I just put Name in there as a placeholder for whatever prefix you use, so I've replaced it with CTPC for this version. You can make variables with whatever name you like as long as it doesn't conflict, though a well organised standard makes it so much easier. This actually what I ended up with: scn CTPCMech02SoundMoveSCRIPT float WalkTimer Begin GameMode if iskeypressed 17 set WalkTimer to WalkTimer + GetSecondsPassed if WalkTimer > 0.68 PlaySound CTPCMech01SoundRun01SOUN Set WalkTimer to 0 Endif Endif if iskeypressed 31 set WalkTimer to WalkTimer + GetSecondsPassed if WalkTimer > 0.68 PlaySound CTPCMech01SoundRun01SOUN Set WalkTimer to 0 Endif Endif if iskeypressed 16 set WalkTimer to WalkTimer + GetSecondsPassed if WalkTimer > 0.68 PlaySound CTPCMech01SoundRun01SOUN Set WalkTimer to 0 Endif Endif if iskeypressed 18 set WalkTimer to WalkTimer + GetSecondsPassed if WalkTimer > 0.68 PlaySound CTPCMech01SoundRun01SOUN Set WalkTimer to 0 Endif Endif EndWorks like a charm, the difficult part actually turned out to be getting the timing correct, as the delay had to be timed with the movement of the legs and the feet touching the ground :thumbsup: Thanks a bunch for pointing me in the right direction, I was completely lost on this script, so you've really saved me a headache on this one :happy: Link to comment Share on other sites More sharing options...
Recommended Posts