Ask a simple question, get a simple answer

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
User avatar
THOM
Posts: 1274
Joined: Wed Nov 20, 2013 11:35 pm
Location: Germany - Cologne
Contact:

Re: Ask a simple question, get a simple answer

Post by THOM »

Ah, great - that works.

And thank you for the hint at the torches. Fixed that.
THOM formaly known as tschrage
_______________________________________________
My MOD (LoG1): Castle Ringfort Thread
My MOD (LoG2): Journey To Justice Thread | Download
User avatar
Eleven Warrior
Posts: 745
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Hi all.

I read somewhere here you can replace object sounds with other sound eg: Key Lock. How do I replace the key lock sound with a sound I have?

I tried the below but the Key Lock sound still activates:

Code: Select all

		{
			class = "Sound",
			sound = "silent",
			offset = vec(0, 1.5, 0),
			enabled = true,
		},
User avatar
Illidan
Posts: 19
Joined: Sat Mar 12, 2016 3:23 pm
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Illidan »

@Eleven Warrior:

Hi,
if you just want to replace a grimrock2 sound by an other grimrock2 sound like the "silent" or instead, for example, the "teleport" sound, then your wanted object lock-class should just look like this:
{
class = "Lock",
sound = "teleport",
},


But you need to import the sounds.lua from the original grimrock 2 asset in your init.lua:
import "mod_assets/scripts/sounds.lua"

All grimrock 2 sounds that are avaiable you find here: http://www.grimrock.net/modding_log1/li ... ed-sounds/

If you created a complete new sound you want to use insted of a grimrock2 sound, your new lock-object should look like this:

defineObject{
name = "my_new_lock",
components = {
{
class = "Model",
model = "assets/models/env/wall_lock.fbx", --(or whatever folder you have for your own lock, if you have created one)
offset = vec(0, 1.375, 0),
staticShadow = true,
},
{
class = "Clickable",
offset = vec(0, 1.375, 0),
size = vec(0.4, 0.4, 0.4),
--debugDraw = true,
},
{
class = "Lock",
sound = "my_new_key_lock_sound",
},
},
placement = "wall",
editorIcon = 20,
}


In addition you have to define a new sound in your sounds.lua (/mod_assets/scripts/sounds.lua), like this:

defineSound{
name = "my_new_key_lock_sound",
filename = "mod_assets/samples/env/my_new_key_lock_sound.wav",
loop = false,
volume = 1,
minDistance = 1,
maxDistance = 10,
}


Also you should have created a folder with your wav-file my_new_key_lock_sound.wav (important: must be a mono-sound file!) in your samples folder in your asset, like this:
/documents/AlmostHuman/Legend of Grimrock2/Dungeons/YourDungeonName/mod_assets/samples/env/

And then, you need to import the sounds.lua in your init.lua:
import "mod_assets/scripts/sounds.lua"

Now it should work correctly. ;)
I hope I have not misunderstood you. :?:
User avatar
Eleven Warrior
Posts: 745
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Thxs Illidan will try this out. I cant believe how easy it was lol Thxs again.
User avatar
Illidan
Posts: 19
Joined: Sat Mar 12, 2016 3:23 pm
Location: Germany

Re: Ask a simple question, get a simple answer

Post by Illidan »

Was a pleasure to help, Eleven Warrior! :P
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

I think that it also has to be a 44,100 MHz sample rate ~despite that other rates work with Windows.
minmay
Posts: 2780
Joined: Mon Sep 23, 2013 2:24 am

Re: Ask a simple question, get a simple answer

Post by minmay »

A 44,100 MHz sample rate would be a rather extreme choice. Even cats can only hear frequencies up to about 70 KHz, and thermal noise will nullify any fidelity benefits. Not to mention you'd be using 11 GB of storage for each second of 16-bit mono audio.

Sounds you use in the Grimrock games should always be 16-bit and have the sample rate set to 44,100 Hz. If you know exactly what you are doing, there are some specific cases where other sample rates work, but I do not want to elaborate on them. If you want to use a lower quality sound to save space, instead of saving it at its original sample rate you should change it to 44,100 Hz without resampling and use SoundComponent's pitch feature to play it at its original speed. Yes, the interpolation will be a little different but you are not justified in caring about that, since you already do not care much about quality if you are using a low sample rate.

In Grimrock 1, some especially lazy dungeon makers used non-44,100 Hz sample rates in unsafe contexts, which generally "work" on the Windows version but crash the OSX and Linux versions. I haven't checked to see if this is still true in Grimrock 2. Just always use 44,100 Hz, seriously.
Grimrock 1 dungeon
Grimrock 2 resources
I no longer answer scripting questions in private messages. Please ask in a forum topic or this Discord server.
User avatar
Eleven Warrior
Posts: 745
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Yep. I have saved the sample as 16 bit, 44,100 Hz, mono, .wav as it said in the forums ages ago.
User avatar
Isaac
Posts: 3185
Joined: Fri Mar 02, 2012 10:02 pm

Re: Ask a simple question, get a simple answer

Post by Isaac »

minmay wrote:A 44,100 MHz sample rate would be a rather extreme choice. Even cats can only hear frequencies up to about 70 KHz, and thermal noise will nullify any fidelity benefits. Not to mention you'd be using 11 GB of storage for each second of 16-bit mono audio.
...

Just always use 44,100 Hz, seriously.
Did you just rebuke over an obvious typo, and reiterate its exact message? :roll:
User avatar
Eleven Warrior
Posts: 745
Joined: Thu Apr 18, 2013 2:32 pm
Location: Australia

Re: Ask a simple question, get a simple answer

Post by Eleven Warrior »

Hi all.

In the main game you start in a cage errrr (No shit) lol. How does it work when you hit the cage door with the stick, you see the animation of the cage door open. How is this done, I'm sure it simple. I tried it in my Mod but I don't see the door open at all.
Post Reply