Jump to content

Custom footsteps


Recommended Posts

Has anyone ever been able to assign footstep sounds to a custom character? 

The first entity that comes to mind with this feature is Deerclops so I've checked his stategraph

local function DeerclopsFootstep(inst)
    inst.SoundEmitter:PlaySound("dontstarve/creatures/deerclops/step")
    ShakeAllCameras(CAMERASHAKE.VERTICAL, .5, .03, 1, inst, SHAKE_DIST)
end

 

CommonStates.AddWalkStates(states,
{
    starttimeline =
    {
        TimeEvent(7 * FRAMES, DeerclopsFootstep),
    },
    walktimeline =
    {
        TimeEvent(23 * FRAMES, DeerclopsFootstep),
        TimeEvent(42 * FRAMES, DeerclopsFootstep),
    },
    endtimeline =
    {
        TimeEvent(5 * FRAMES, DeerclopsFootstep),
    },
})

However I believe the way this is implemented is the steps are manually referenced after a set amount of time or frame after a state.

now the question is, is this workable for a basic player character since the anims / states are different?

Link to comment
Share on other sites

13 hours ago, ADM said:

inst.foleysound = "dontstarve/creatures/deerclops/step"

I guess this should works pretty fine

wow, that simple.

Seems to be adding an extra layer ontop of default steps though. Any chance to disable the default sets?

Link to comment
Share on other sites

7 hours ago, Hell-met said:

wow, that simple.

Seems to be adding an extra layer ontop of default steps though. Any chance to disable the default sets?

Not sure about that but maybe you can process a loop of a killsound just like this

inst.SoundEmitter:KillSound("character/character/step")

Link to comment
Share on other sites

17 hours ago, Hell-met said:

Update on this

it seems "inst.foleysound" is only clientside. Others can't hear the change

How can I make it so everyone hears the new sound?

Just put the foleysound code in your character's common_postinit or common_fn file and everyone should be able to hear it.

Link to comment
Share on other sites

29 minutes ago, Stormish said:

Just put the foleysound code in your character's common_postinit or common_fn file and everyone should be able to hear it.

Sounds like a good plan, however what if I want it to toggle on/off in real time for a perk?

Link to comment
Share on other sites

1 minute ago, Hell-met said:

Sounds like a good plan, however what if I want it to toggle on/off in real time for a perk?

Then you'll have to do some netcoding, which take some time and are kind of complicated to understand.

Link to comment
Share on other sites

3 minutes ago, Stormish said:

Then you'll have to do some netcoding, which take some time and are kind of complicated to understand.

Thanks, I suppose I'll figure something out before getting to that point.

One last thing If I may, would you know if its possible to attach game effects to player footsteps? Such as losing 1 hunger each footstep and the likes.

Link to comment
Share on other sites

2 minutes ago, Hell-met said:

Thanks, I suppose I'll figure something out before getting to that point.

One last thing If I may, would you know if its possible to attach game effects to player footsteps? Such as losing 1 hunger each footstep and the likes.

I don't know how it's done, but I know for sure that it can be possible.

Link to comment
Share on other sites

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
 Share

×
  • Create New...