Jump to content
The Dark Mod Forums

Footstep sounds and lock picking


Melkesideck
 Share

Recommended Posts

3 hours ago, datiswous said:

Can you recommend a tutorial about sound recording for this purpose?

https://wiki.thedarkmod.com/index.php?title=Sound_File_Formats

Getting the recorded sound into the game is a different story. Best way is to look at the existing sounds and how they're done.

Sounds are called from a shader file, like textures.

  • Thanks 2

I always assumed I'd taste like boot leather.

 

Link to comment
Share on other sites

On 9/7/2021 at 6:17 PM, AluminumHaste said:

Yes their is, the sound shaders can pick from a list of sounds, we do it for things like eating apple and bread, and footsteps I believe. Not entirely sure if that works for doors.

I already found different sounds and changed them in the prefabs, but would it be possible to do this on the fly using scripts or defs? The classname is atdm:mover_door.

 

Link to comment
Share on other sites

21 minutes ago, wesp5 said:

I already found different sounds and changed them in the prefabs, but would it be possible to do this on the fly using scripts or defs? The classname is atdm:mover_door.

 

Doors and lids both use that class, and I'm not entirely sure there's a property that will 100% accurately distinguish between them. Maybe it's possible to use a script to check if a mover_door is a frob_peer of an atdm:froblock entity?

Changing the sound spawnarg via script should work fine. Most of the time when a sound is played in TDM, it reads the sound spawnarg.

Link to comment
Share on other sites

18 minutes ago, Dragofer said:

Changing the sound spawnarg via script should work fine. Most of the time when a sound is played in TDM, it reads the sound spawnarg.

Can you please take a look at this? I could provide you with sounds that would fit better for a lot of the containers that use the default door sound right now. They are all already included in TDM, so nothing else would need to be changed! One way to find most container entities would be to check that the angle of opening movement is on the z axis.

Edited by wesp5
  • Like 1
Link to comment
Share on other sites

19 hours ago, OrbWeaver said:

 

You're welcome to produce your own versions and then distribute this as a separate PK4 which people can download. I know at least one other forum member has done this in the past. If enough people like the alternatives better than the versions currently in the mod, they could even be integrated by default at some point.

That was me. :)  The alternate footstep sounds are still available here:

 

 

  • Like 2

"Einen giftigen Trank aus Kräutern und Wurzeln für die närrischen Städter wollen wir brauen." - Text aus einem verlassenen Heidenlager

Link to comment
Share on other sites

17 hours ago, wesp5 said:

Can you please take a look at this? I could provide you with sounds that would fit better for a lot of the containers that use the default door sound right now. They are all already included in TDM, so nothing else would need to be changed!

Alright - this script rolls a random int between 0 and 4, then assigns one of 5 pairs of open and close sounds to doors that have been identified as chest lids on the basis of the frob_master being an atdm:froblock. It needs to be called once at map start, and you could change the names of the soundshaders ("door_open_02" etc.) to ones that you think go well together.

Spoiler
void tdm_chest_sounds()
{
	entity e;
	entity m;
	float i;
	string s;

	do
	{
		e = sys.getNextEntity("classname","atdm:mover_door",e);

		if (e)
		{
			m = e.getEntityKey("frob_master");

			if ( (m != $null_entity) && ( m.getKey("classname") != "atdm:froblock" ) )
			{
				continue;	//skip, this is not a chest lid
			}

			i = int( sys.random(4.99) );	//random int from 0 to 4, rounded down

			if ( e.getKey("snd_open") == "door_open_01" )
			{
				if      ( i == 0 )	s = "door_open_02";
				else if ( i == 1 )	s = "door_open_03";
				else if ( i == 2 )	s = "door_open_04";
				else if ( i == 3 )	s = "door_open_05";
				else if ( i == 4 )	s = "door_open_06";

				e.setKey("snd_open", s);
			}

			if ( e.getKey("snd_close") == "door_shut_01" )
			{
				if      ( i == 0 )	s = "door_shut_02";
				else if ( i == 1 )	s = "door_shut_03";
				else if ( i == 2 )	s = "door_shut_04";
				else if ( i == 3 )	s = "door_shut_05";
				else if ( i == 4 )	s = "door_shut_06";

				e.setKey("snd_close", s);
			}

		}

	}	while (e);
}

 

Btw, scripting in TDM is now more thoroughly documented on the Wiki, so it'd be worth familiarising with for doing tasks like this. In this particular case, this page would've been useful for identifying all entities of a certain type in the map.

17 hours ago, wesp5 said:

One way to find most container entities would be to check that the angle of opening movement is on the z axis.

It'd also identify all horizontal doors as chest lids. My approach with looking for frob_masters might not cover 100% of cases, but I don't think it'll yield false positives.

  • Thanks 1
Link to comment
Share on other sites

58 minutes ago, Dragofer said:

Alright - this script rolls a random int between 0 and 4, then assigns one of 5 pairs of open and close sounds to doors that have been identified as chest lids on the basis of the frob_master being an atdm:froblock. It needs to be called once at map start, and you could change the names of the soundshaders ("door_open_02" etc.) to ones that you think go well together.

Thanks, I think it should be the same sound each time so that player can recognize it and not be confused by different sounds. I have a few questions though: 1) What is the frob_master atdm:froblock identifier exactly? The fact that the chest has a base and a lid? 2) Will this be triggered by containers like cash boxes or jewelery boxes that should have a different sound and could these be identified by parts of their name instead? 3) How can I call this at map start in the first place? Can I call it from tdm_user_addons.script?

Edited by wesp5
Link to comment
Share on other sites

P.S.: So I figured out my own questions above in the meantime and got it to work with some sounds that are hopefully much more rare than the default door sounds. Weird enough the chest sounds included in the sfx pk4 are not recognized and several others I tried did not work either! Also while testing this in the Training Mission I again noticed that the first chest you have to lockpick already has it's parameters set wrong, like you can pick both bottom and lid even after the chest has been unlocked. I guess this could be fixed in the mission itself, but as I suppose that nobody is willing to do that, maybe the very same script could be used to implement the cool feature that dragofer uses in his missions, namely that the lid of a chest can only be frobed after the bottom has been unlocked at which time the bottom becomes unfrobbable. Dragofer, do you think this could work?

P.S.: Adding e.setFrobable(0); to the sound script makes the lid unfrobable, but then you can't open it after the chest unlocks. Where could it be set that after unlocking either the bottom opens the lid or the lid get's frobable again?

Edited by wesp5
Link to comment
Share on other sites

1) Froblock entities are frobable, lockable entities - so like a door that doesn't move. The most common chest setup in TDM is to create the chest body as a froblock and the lid as a door. Both entities can be locked, but usually it's the body.

They're linked as follows:

- they mutually have each other as frob_peers. This means they highlight together.

- the lid has the body as its frob_master. This means when you frob the lid, it gets passed to the chest.

- the body has the lid as its target. This means when you frob the body when it's unlocked, it sends a trigger to the lid so that it opens.

An alternative setup is just to create the body as a func_static and the lid as a locked door. The froblock entity is imo superfluous here - I think it's meant for making standalone locks that open something somewhere else.

For my missions, and in a prefabs update some years ago, to make it easier to get things out of chests the froblock body was set to unfrobable and the lock settings (locked, lockpick type and pins) applied to the lid instead. I doubt that you can change lock settings after the mission has started.

2) Additionally you can identify lids based on their model, spelling out the file path of every lid model in core TDM (something like if ( e.getKey("model") == "models/darkmod/containers/..." ) ). This won't catch lids that were created using DR, so you'll probably still want the froblock check at the end. Another clue is that the lid usually targets an atdm:target_setfrobable entity, which toggles frobability of items inside the chest.

Re: sfx sounds: are you sure you're using the soundshaders, and not the .ogg files directly?

Re: training mission: sounds like a bug. Do you see a similar behaviour in older missions, i.e. from 2012? Btw, kingsal said he's interested in reimagining the training mission at some point, and some might join him in that.

Link to comment
Share on other sites

2 hours ago, Dragofer said:

1) ... the body has the lid as its target. This means when you frob the body when it's unlocked, it sends a trigger to the lid so that it opens.

2) ... sfx sounds: are you sure you're using the soundshaders, and not the .ogg files directly?

3) ... training mission: sounds like a bug. Do you see a similar behaviour in older missions, i.e. from 2012?

1) The trigger does not seem to work if I set the lid to unfrobable at map start. Is there a way to set the frobable state of something dynamically during gameplay? Your old solution did not work with some missions, we need the body to be frobable because the lock normally is there and then the lid to be openable, not the other way around

2) What is the difference? I just copied the ogg name into the script file, but without the extension.

3) I never tested this with old missions, but it is the only one I ever remember it to have happened.

Edited by wesp5
Link to comment
Share on other sites

1) e.setFrobable(0) is the correct way to change frobability. What you could still try is use getKey and setKey to transfer the lock spawnargs from the body to the lid.

Otherwise the ultima ratio would be to respawn the lid with the body's lock spawnargs and set the body to unfrobable. I believe "respawning" via scripts means getting and temporarily storing all the spawnargs of the original lid + the body's lock and key related spawnargs, and using them to spawn a new one, as per the wiki.

2) 99%+ of the time, entities, scripts and code require soundshaders. Soundshaders reference .ogg's and include information on radius, volume, looping etc. They're defined in .sndshd files.

Link to comment
Share on other sites

5 minutes ago, Dragofer said:

1) e.setFrobable(0) is the correct way to change frobability. What you could still try is use getKey and setKey to transfer the lock spawnargs from the body to the lid.

It seems frob_lock in tdm_frobactions.script could be the place. If we could find the lid of a chest there, we could make the base unfrobable and the lid frobable. Like below although this does not work because I know nothing about scripting ;):

void frob_lock(entity ent)
{
    ent.Open();
    ent.setFrobable(0);
    lid = ent.getEntityKey("frob_peer");  (or whatever the correct key is to find the lid)
    lid.setFrobable(1);
}

Edited by wesp5
Link to comment
Share on other sites

9 minutes ago, wesp5 said:

we could make the base unfrobable and the lid frobable.

That's simple enough with the original sound script. m is the base (frob_master) and e is the lid (which is already frobable anyway), so:

Quote

m = e.getEntityKey("frob_master");

if ( ( m != $null_entity ) && ( m.getKey("classname") == "atdm:froblock" ) )

{

m.setFrobable(0);

e.setFrobable(1);

}

else

{

continue;

}


 

Link to comment
Share on other sites

19 hours ago, Dragofer said:

That's simple enough with the original sound script. m is the base (frob_master) and e is the lid (which is already frobable anyway), so:

But this is not what I want, because it makes just the lid frobable from the start. You might remember that I already added your only-lid-is-frobably def to my UP once, only to get stuck in a mission where the base needed to be frobable. Which of course makes more sense too, because all chests have the lock on the base and not on the lid. So the best way would be to dynamically swap frobability from base to lid once the chest unlocks.

Edited by wesp5
Link to comment
Share on other sites

Bad news, I played around some more with the chests and noticed that e. g. the jewelery box in Sothas "Bakery Job" needs the lid to be frobable to work and I know of another mission, where the base needs to be frobable, so it would probably break some missions if we changed anything there! But at least the script below could be included into the core mod to change the lid sounds, and if it isn't I will include it into my patch. Also somebody should take a look at the tutorial mission as it does not give a good first impression when the first chest you open already has a bug in that you can unlock it twice!

// Modified chest sounds, by Dragofer and wesp

void tdm_chest_sounds()
{
    entity e;
    entity m;
    float i;
    string s;

    do
    {
        e = sys.getNextEntity("classname","atdm:mover_door",e);

        if (e)
        {
            m = e.getEntityKey("frob_master");

            if ( (m != $null_entity) && ( m.getKey("classname") != "atdm:froblock" ) )
            {
                continue;    // skip, this is not a chest lid
            }

            if ( e.getKey("snd_open") == "door_open_01" )
            {
                s = "door_open_creaky02";
                e.setKey("snd_open", s);
            }

            if ( e.getKey("snd_close") == "door_shut_01" )
            {
                s = "door_shut_creaky02";
                e.setKey("snd_close", s);
            }

        }

    }    while (e);
}

 

Edited by wesp5
Link to comment
Share on other sites

On 9/7/2021 at 12:31 PM, Zerg Rush said:

...Not good, if you don't have moose arrows in this moment.

I soooo want to play a mission with a moose arrow now

Could even start small with a mouse arrow, or if you're hungry a mousse arrow

Sorry couldn't resist 😉

  • Thanks 1
  • Haha 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


  • Recent Status Updates

    • jaxa

      Alder Lake has arrived:
      https://forums.thedarkmod.com/index.php?/topic/18055-2016-cpugpu-news/page/15/&tab=comments#comment-466190
       
      · 0 replies
    • irg

      Watching warmly for The Black Parade, The Broken Goddess and Blood Death Wish Ep.4. Sometimes the best things in life actually are free.
      · 1 reply
    • STiFU

      We are taking our son on his very first holiday trip to see the sea for the first time. 🙂 Will be back in a week.
      · 2 replies
    • Gilkar

      When I was a young man my father was so ignorant I could hardly stand to have him around. As I grew older I was amazed at how much the old man had learned in such a short time.
      · 2 replies
    • jaxa

      RTX 3090 Super, RTX 3070 Ti 16 GB, RTX 2060 12 GB
      https://wccftech.com/nvidia-launching-rtx-3090-super-rtx-3070-ti-16gb-and-rtx-2060-12gb-by-january-2022/
      · 0 replies
×
×
  • Create New...