Page 1 of 1
sound scripting
Posted: Fri May 17, 2013 2:16 am
by dukester70
so my issue is that i get a stackoverflow on my etitly script from the playsound
defineSound{
name = "rat_2",
filename = "mod_assets/samples/dungeon/rats_2.wav",
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 1,
}
and my scripte et.
function playSound()
playSound ("rats_2")
Re: sound scripting
Posted: Fri May 17, 2013 3:29 am
by Neikun
I'm not sure.
Have you tried
Code: Select all
function playSound()
playSound ("rats_2")
end
Also, your playSound says "rats_2"
but your defined sound is "rat_2"
This sort of error is almost always just a typo.
Re: sound scripting
Posted: Fri May 17, 2013 4:01 am
by JohnWordsworth
Suggestions...
1. As Neikun said, make sure you call 'playSound(...)' with the same name that you have defined in your defineSound command.
2. Make sure your function has a unique name that doesn't hide an existing function. If the function you are making is indeed called playSound, then when you try to call 'playSound' from within that function you are calling that function from within itself, which is causing infinite recursion (that would cause a crash). You might want to use a different name for your function to play that SFX.
Code: Select all
function playRatSound()
playSound("rat_2");
end
3. If your wav file is of an invalid format, that too can cause a crash / problems. I've outlined a bunch of settings I have successfully used here:
http://grimwiki.net/wiki/Custom_Sound_Tutorial
Re: sound scripting
Posted: Fri May 17, 2013 5:04 am
by Neikun
Also, for future reference, please don't post the same question in multiple spots because you hadn't received an answer yet.
The best course of action is to start your own thread as you've done here. And then simply bump if you feel your question has been forgotten. If the topic is still on the first page, it's too early to bump.
Welcome to the forums! =D
Re: sound scripting
Posted: Fri May 17, 2013 11:44 am
by Komag
I cleaned up the other posts.

Re: sound scripting
Posted: Fri May 17, 2013 9:52 pm
by dukester70
thank you all for the help will try out the links and sorry for being impatient and posting everywhere... again thank you and will tell how it worked out....

Re: sound scripting
Posted: Sat May 18, 2013 8:29 pm
by dukester70
thank you all again .... and thank you john ... i did have to rename the playsound and add the rat to it and it worked
