HELP: How can i play an .ogg sound file

Talk about creating Grimrock 1 levels and mods here. Warning: forum contains spoilers!
Post Reply
User avatar
Daght
Posts: 146
Joined: Sun Apr 15, 2012 12:28 pm
Location: Italy

HELP: How can i play an .ogg sound file

Post by Daght »

How can I play a .wav or .ogg sound triggered by an hidden pressure plate?
Thanks.
If we do not end the war, the war will end us.
User avatar
Shroom
Posts: 98
Joined: Tue Mar 27, 2012 6:37 pm
Location: UK

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

Post 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
User avatar
Daght
Posts: 146
Joined: Sun Apr 15, 2012 12:28 pm
Location: Italy

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

Post 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?
If we do not end the war, the war will end us.
User avatar
antti
Posts: 688
Joined: Thu Feb 23, 2012 1:43 pm
Location: Espoo, Finland
Contact:

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

Post 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
Steven Seagal of gaming industry
Post Reply