Jump to content

[Help] How to stop the 'flinch'/'hit' animation when attacked.

Recommended Posts

Hey DST modding community! It's been a while, but I'm working on a slightly simpler mod as a refresher for my bigger Wanon mod.

What I'm looking for is how to stop the 'flinch'/'hit' animation that plays when a character is attacked. I don't want to stop the damage from being taken, and I have a balance in place for the ability to avoid stun if I can't keep the slight pause from being hit, but the idea is this character (at least lore wise) actually can't feel pain. He wouldn't know when he's hurt, so he wouldn't realize he needs to back away from danger... thus the reaction to being hit wouldn't be to flinch.

I'm basically trying to stop the actual animation, but not the slight pause that the animation causes from being hit. Any idea where I can find and stop it, or even how I could edit it to be less of a reaction? Thanks!

  • Like 1
Link to comment
Share on other sites

I haven't played around with modding characters yet but your post got me interested.  I had a look at Wilson to see how he worked and in scripts/stategraphs/SGwilson.lua in the "hit" state there is:


I assume if you left that line out of your custom character then they won't show a reaction to getting hit.

The amount of time Wilson is stunned when hit is based on the length of the animation so you'd need to work out your own value for that.

inst.sg:SetTimeout(stun_frames * FRAMES)

Hopefully someone that knows more than me can add to this or correct any mistakes I've made.

Link to comment
Share on other sites

I would try overwriting the onenter function of the "hit" state by a stategraph post init, and make a different state to which the character would be redirected, where the character would be stunned less, what i mean is something like this:

AddStatgraphPostInit("wilson", function(self)
    local onenter = self.states.hit.onenter
    self.states.hit.onenter = function(inst, ...)
    	if inst:HasTag"unstunlockable" then 
        	return inst.sg:GoToState"hit_with_less_stunlock" 
        	return onenter(inst, ...) 

And then set up the hit_with_less_stunlock state with a differen timeline.

Edited by Bad Willow
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

  • Create New...