Page 1 of 2

How to make custom sound ?

Posted: Wed Oct 29, 2014 1:56 pm
by Rougecorne
Hello all !
How to make custom sound in Legend of Grimrock 2 ?

So, i create my audio file in OGG format. I create this script in sounds.lua

defineSound{
name = "introdungeon",
filename = "mod_assets/sounds/2007.ogg",
loop = false,
volume = 1.0,
}

But, when i reload my project, i have this message:

[string "SoundSystem.lua"] :0: Not a RIFF file.

Why ? :(

Re: How to make custom sound ?

Posted: Wed Oct 29, 2014 2:22 pm
by Prozail
i suspect it expects a .wav file.

All ingame "sounds" are .wav and all "AmbientTracks" (ie music) is ogg.

Re: How to make custom sound ?

Posted: Wed Oct 29, 2014 2:32 pm
by Rougecorne
Ok thank you
I don't have the error message, now.
But... why i can't play this sound in-game ? :x

It's strange

Re: How to make custom sound ?

Posted: Wed Oct 29, 2014 2:45 pm
by gambit37
Dungeon sounds need to be in WAV format, 16-bit 44.1Khz, mono. Do you have a sound converter to convert your OGG into the right format?

Re: How to make custom sound ?

Posted: Wed Oct 29, 2014 3:21 pm
by Rougecorne
I convert mp3 to this format (Wav, 16-bit 44.1Khz, mono).

What is the script to have the sound in-game ? :(

Re: How to make custom sound ?

Posted: Wed Oct 29, 2014 4:40 pm
by Jouki
Rougecorne wrote:I convert mp3 to this format (Wav, 16-bit 44.1Khz, mono).

What is the script to have the sound in-game ? :(
are you trying play that soiund by script or sound item?

Re: How to make custom sound ?

Posted: Wed Oct 29, 2014 4:47 pm
by Rougecorne
Yes, but the editor don't find the sound :/

The script for play sound is:

playSound(sound) or playSoundAt(sound, level, x, y), right ? :/

Re: How to make custom sound ?

Posted: Wed Oct 29, 2014 5:01 pm
by Lark
Some of this is probably a repeat of what you already know, but to add a sound effect to the game, do this:
  • Create your sound effect and make it a 16-bit 44.1Khz, mono .wav file and put it in your mod_assets\sounds directory under the dungeon you are editing.
  • Edit your mod_assets\scripts\sounds.lua.
  • Add the sound definition (see below) and save the file.
  • In your script, use playSound("woodCollapse") (in my example below). The name you use to play the sound must match the name in the definition, including case.
  • Trigger the script when you want the sound to play. That's all it takes!

Code: Select all

defineSound{
  name = "woodCollapse",
  filename = "mod_assets/sounds/woodCollapse.wav",
  loop = false,
  volume = 3,
  minDistance = 1,
  maxDistance = 1,
  }
I hope this helps, -Lark

Re: How to make custom sound ?

Posted: Wed Oct 29, 2014 5:21 pm
by Rougecorne
Thank you ! :D
It's work !

My problem is, when i make this script: "playSound("woodCollapse")", i write a bad name of sound.
Big thank you Lark !

But, i have an other question:

In this script:

playSoundAt("introdungeon", 1, 12, 18), 1 = what ? Because, i can't write '0' (For H)

Re: How to make custom sound ?

Posted: Wed Oct 29, 2014 5:40 pm
by Rougecorne
It's okay, i try this script :

function playCoolSound()
playSound("cool_sound")
end

And it work with an activator.