Page 1 of 1

HELP: How can i play an .ogg sound file

Posted: Sat Sep 15, 2012 10:37 am
by Daght
How can I play a .wav or .ogg sound triggered by an hidden pressure plate?
Thanks.

Re: HELP: How can i play an .ogg sound file

Posted: Sat Sep 15, 2012 10:44 am
by Shroom

Code: Select all

playSound("level_up")
You can find a list of these sound assets http://www.grimrock.net/modding/list-of ... ed-sounds/

So create a function in a lua entity

Code: Select all

function playLevelUp()
   playSound("level_up")
end
Then add a connector from the plate, to the enity and select the function you want

Re: HELP: How can i play an .ogg sound file

Posted: Sat Sep 15, 2012 11:12 am
by Daght
Shroom wrote:

Code: Select all

playSound("level_up")
You can find a list of these sound assets http://www.grimrock.net/modding/list-of ... ed-sounds/

So create a function in a lua entity

Code: Select all

function playLevelUp()
   playSound("level_up")
end
Then add a connector from the plate, to the enity and select the function you want
If i got an external file, i must mention the extention or simply the name? And, the this function will watch in the asset/sound folder automaticaly?

Re: HELP: How can i play an .ogg sound file

Posted: Wed Sep 19, 2012 9:48 am
by antti
Daght wrote:
Shroom wrote:

Code: Select all

playSound("level_up")
You can find a list of these sound assets http://www.grimrock.net/modding/list-of ... ed-sounds/

So create a function in a lua entity

Code: Select all

function playLevelUp()
   playSound("level_up")
end
Then add a connector from the plate, to the enity and select the function you want
If i got an external file, i must mention the extention or simply the name? And, the this function will watch in the asset/sound folder automaticaly?
You need to define a new sound asset and refer to the asset's name from you level script. Add something like this to your sounds.lua:

Code: Select all

defineSound{
	name = "cool_sound",
	filename = "mod_assets/sounds/cool_sound.wav,
	loop = false,
	volume = 0.8,
}
And then the following to a script entity:

Code: Select all

function playCoolSound()
	playSound("cool_sound")
end