Jump to content

Recommended Posts

Hello all,

I am making a character with the extended sample character template, and so far it's all good. But because my character is... a little on the heavy side... I've been trying to make the sound that plays when you walk around different to the default one. I put this code in the master_postinit:

inst.footstep_path_override = "dontstarve/creatures/leif/walk_vo"

which would hopefully change the walk sound to the one that the treeguard makes.

Well I guess it kinda worked, because the character makes no sound when he walks around, but that's not really the... desired effect.

So would I have to make custom walk sounds, or am I just not doing it properly?

Spoiler

My character is Fat Bastard.... so yeah :p

 

Link to comment
https://forums.kleientertainment.com/forums/topic/68658-changing-walk-sound/
Share on other sites

Well, two issues.

One, DS and ROG don't have the footstep override. Only SW has it.

Two, you are changing the path with that.

But the game doesn't use footstep_path as a sound to use path, it uses that to build the new paths where the sounds actually are.

You can see it in worldtiledefs.lua.

 

Use something like:

local _PlayFootstep = GLOBAL.PlayFootstep
GLOBAL.PlayFootstep = function(inst, volume)
	_PlayFootstep(inst, volume)
	if inst and inst:HasTag("player") then
		volume = volume or 1
		local sound = inst.SoundEmitter
		if sound then
			local tile, tileinfo = inst:GetCurrentTileType()
			if tile and tileinfo then
				sound:PlaySound("dontstarve/creatures/leif/walk_vo", nil, volume)
			end
		end
	end
end

That will mix the heavy sound with the step for the player, only.

@DarkXero Well, I tried putting this in master_postinit, and it crashes, but even when it's not in master_postnit it still crashes.

Also I wasn't sure about some of the _'s 

--you wrote _PlayFootstep sometimes
local _PlayFootstep = GLOBAL.PlayFootstep
GLOBAL.PlayFootstep = function(inst, volume)
_PlayFootstep(inst, volume)

so what's the reason behind that?

27 minutes ago, NeddoFreddo said:

Well, I tried putting this in master_postinit, and it crashes, but even when it's not in master_postnit it still crashes.

What DLC of Don't Starve are you trying to run it on? Shipwrecked?

It should go in modmain, not master_postinit, unless you take the GLOBALs away.

27 minutes ago, NeddoFreddo said:

what's the reason behind that?

I put the _ as I could put old_PlayFootstep or whatever_just_save_it or idontwanttocopypastetheentirefunction as variable names.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...