using a sound

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

using a sound

Post by bongobeat »

Hello

I am trying to use some official sound in my mod:
I m running the game/editor on a mac os x platform.
how can i play any game's sounds?
eg: i want use the cube monster walk sound

i have define a script like this:
(the path of the sound is indicated in LoG modding section, so i use this one)

Code: Select all

defineSound = {
name = "cube",
filename = "assets/samples/monsters/cube_walk.wav",
loop = true,
volume = 2,
minDistance = 20,
maxDistance = 120,
}
then i have use a second script to play it:

Code: Select all

function playsound()
playSound("cube")
end
and then i have put a hidden plate which activate the "function playsound" script

but it indicates " warning! no such sample: cube"

these scripts work on any other additional sounds, but not with the game's sounds: is the path wrong?
can you help me please?
User avatar
JohnWordsworth
Posts: 1397
Joined: Fri Sep 14, 2012 4:19 pm
Location: Devon, United Kingdom
Contact:

Re: using a sound

Post by JohnWordsworth »

You can find a list of all of the pre-defined sound assets on the following page: http://www.grimrock.net/modding/list-of ... ed-sounds/

If you just want to use them as-is, then you don't need to re-define them in your mod, you can just use playSound('cube_move'); and it'll play the sound effect as defined by the default lua definitions.

If you did want to redefine them to use your own custom parameters (change the volume maybe), then what you are doing looks almost right. However, you have a syntax error in your definition, you are using defineSound = { ... }, but you should really just be using defineSound{ ... } (notice the lack of an = sign). defineSound{ ... } in lua is the equivalent of calling defineSound({...}), but what you are doing is resetting the defineSound variable from a function to a table. At that point, you are not creating the sound to play later.

You can find the original definitions in asset_pack_v2/assets/scripts/sounds.lua and copy/paste them into your own mod and change the name / parameters. The definition for the cube_move sound is as follows;
SpoilerShow
defineSound{
name = "cube_move",
filename = "assets/samples/monsters/cube_walk.wav",
loop = false,
volume = 1,
minDistance = 2,
maxDistance = 12,
}
Note that in your definition, you have set minDistance to 20. I think this is the number of spaces away that you must be before the sound effect plays! 20 spaces is a lot :p.
My Grimrock Projects Page with links to the Grimrock Model Toolkit, GrimFBX, Atlas Toolkit, QuickBar, NoteBook and the Oriental Weapons Pack.
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: using a sound

Post by bongobeat »

Hi, thanks for the answer!

ahhh! i see! i forgot to put the right name off the sound! (cube_move) ! ^^

ok i have try without the = , but it don't works

works for me with = , thank you anyway ^^

Code: Select all

defineSound = {
name = "cube_move",
filename = "assets/samples/monsters/cube_walk.wav",
loop = true,
volume = 1,
minDistance = 2,
maxDistance = 12,
}
well i want use it with custom settings, i have tried the playSound('cube_move');
it works but it plays the sound when i try the mod (in the editor)

by the way: you said that the mindistance 20 is too big, but if i change this settings, the editor don't apply anny change
minDistance = 2, or minDistance = 20, it plays the sound when i am activating him.

or if i change the "loop = false" to true
it doesn't make a loop, it's been played one time and stop, is that normal?


about the loop, i have added some sounds in sounds.lua

Code: Select all

defineSound{
   name = "Volcano",
   filename = "mod_assets/sounds/mine/VolcanoFire.wav",
   loop = true,
   volume = 1.4,
   minDistance = 6,
   maxDistance = 12,
}
this one is with a loop = true
when i activate the sound (always when testing in editor), it plays it everywhere and indefinitely (cause of the loop) and even if i change level!

modifying the maxDistance dont do anything
how can i stop it at a certain distance?
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

Re: using a sound

Post by bongobeat »

Hi

i didnt mean stop it, how can i set that the sound fade out?
still it didnt apply the minDistance or maxDistance settings...
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Post Reply