Player hit reactions/Flinch on Bullet Hit

Hey everyone,

I was wondering if anyone could make (or point me to) a mod that makes the player stagger or flinch when getting shot—basically the same way NPCs react when they take a bullet.

I think it’d add a lot of immersion and balance, but I haven’t found anything like it so far. If someone knows a workaround or is down to create it, I’d really appreciate it!


Thanks in advance.
 
Hi, while I have not found the code that actually handles damage to NPCs/player, I found this snippet in game_lib.lua of SRIV (probably the same code as SRTT) :
Code:
-- Make a human play a direction stumble, blocking until the animation is done
--
-- name:            (string) name of character
-- nav_name:        (string) name of navpoint indicating the direction to stumble
-- percentage:        (float, optional) percentage done to check for (defaults to 0.8)
-- do_flinch:        (boolean, optional) true if a flinch should be in place of the stumble animations
--
-- If possible, the <a>action_play</a> script action should be used instead where possible.
--
function action_play_directional_stumble(name, nav_name, percentage, do_flinch)
    while not action_play_directional_stumble_do(name, nav_name, do_flinch) do
        thread_yield()
    end

    repeat
        thread_yield()
    until action_play_is_finished(name, percentage)
end
This is taken from nclok's SuperUI file, probably it is his comment
 
Back
Top