i need to play sound, called "horror" in this place.
I already done all in the file "sounds.lua".
So i only need to do something with script.
Can anyone help me? :3
i used that script:
playSoundAt(sound, level, x, y), so i wrote this:
function playSound()
playSoundAt(horror, 10, 29, 16)
end
and pc says me:
bad argument #1 to 'playSoundAt' (string expected, got nil)
what i supposed to do? where is error?
can anyone help with sound script?
- JohnWordsworth
- Posts: 1397
- Joined: Fri Sep 14, 2012 4:19 pm
- Location: Devon, United Kingdom
- Contact:
Re: can anyone help with sound script?
Hi MYNAMEIS,
Sounds are one of those things that can be a little bit fiddly. Luckily, this looks like a nice easy fix. As the error states: "bad argument #1 to 'playSoundAt' (string expected, got nil)"
The function playSoundAt requires the name of the sound effect definition as the first parameter. This should be a "string" variable, what you have provided is a variable named horror, which presumably doesn't exist and is therefore nil. The solution is just to add quotes:
playSoundAt("horror", 10, 29, 16);
Hope your mod is going well!
Sounds are one of those things that can be a little bit fiddly. Luckily, this looks like a nice easy fix. As the error states: "bad argument #1 to 'playSoundAt' (string expected, got nil)"
The function playSoundAt requires the name of the sound effect definition as the first parameter. This should be a "string" variable, what you have provided is a variable named horror, which presumably doesn't exist and is therefore nil. The solution is just to add quotes:
playSoundAt("horror", 10, 29, 16);
Hope your mod is going well!
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
Re: can anyone help with sound script?
You also might consider naming the function something else just to be clear, because playSound is already a standard command
Finished Dungeons - complete mods to play
Re: can anyone help with sound script?
I agree with Komag,
try a function more like playHorror
Also, can we get a look at your sounds.lua?
try a function more like playHorror
Also, can we get a look at your sounds.lua?
"I'm okay with being referred to as a goddess."
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
Community Model Request Thread
See what I'm working on right now: Neikun's Workshop
Lead Coordinator for Legends of the Northern Realms Project
- Message me to join in!