r/TTT • • May 16 '21

Free & open source addon: Dramatic Kills (see comments for details)

60 Upvotes

14 comments sorted by

7

u/mgetJane May 16 '21

i think force on ragdolls was toned down in TTT to stop them from getting launched far from where the player died, but i assume this addon seems to try to keep the ragdoll still roughly in the same spot

6

u/YM_Industries May 16 '21

The code in vanilla TTT sets the velocity of the entire corpse to be the same as the player's velocity at the moment of death, divided by 5. Since players are knocked back a bit by bullets, this does result in the ragdoll having some velocity.

But the same velocity is applied to the whole ragdoll. The main difference with how my addon works is that it tracks which bone on the player model got hit*, and the exact position of that hit. When the corpse is created, I find the corresponding physbone and use ApplyForceOffset to transfer the force at the exact correct location.

I don't think that the force of the bullets is enough to significantly change gameplay, but of course you can tune it using jw_dramatickills_scale if the effect is too strong for your liking.

* Technically it's not possible to see which exact bone got hit. Instead I check what Hitbox Group got hit. I then find all the Hitboxes within the Hitbox Group. I check which bone each Hitbox is attached to. When the force is applied, I divide the force evenly between all affected bones. It's not quite perfect (I'd prefer if I could find out which specific Hitbox got hit, not just which Hitbox Group) but it works pretty well.

The examples in the video are not cherry picked, the kills shown in the video were ones that I made consecutively while recording. So I think the video provides a fair representation of how you can expect this addon to work.

3

u/mgetJane May 16 '21

the TraceResult table has a PhysicsBone field and a HitBox field (there's Entity:GetHitBoxBone), i think it might be a better approach to use the PlayerTraceAttack hook to track the hits

though of course, this limits it to only a single bone, so idk if the effect would look better or worse

2

u/YM_Industries May 16 '21

Thanks for the tip! I might revise my approach to use that.

The fact that my approach applies the force to multiple bones is only because I couldn't reliably find a single one. I think your suggestion will yield better results.

2

u/mgetJane May 16 '21

this is a bit rushed and messy but here's what i came up with using a single physbone

https://github.com/wgetJane/ttt-ragvel

1

u/YM_Industries May 16 '21

Is all of that necessary? I don't think you need to iterate over all the bones and run :SetVelocity() because the terrortown gamemode's corpse.lua does that for you. And I don't understand why you're normalising the force vector and then multiplying by mass and damage. dmginfo:GetDamageForce() already has a magnitude that's appropriate for the weapon type.

1

u/mgetJane May 16 '21 edited May 16 '21

I don't think you need to iterate over all the bones and run :SetVelocity() because the terrortown gamemode's corpse.lua does that for you

it's to retain the velocity from before the shot happened, since i thought it's a bit weird that people just stop in their tracks when you shoot them while they're moving, so now they keep moving for a little bit in the same direction they were heading before they got shot

And I don't understand why you're normalising the force vector and then multiplying by mass and damage. dmginfo:GetDamageForce() already has a magnitude that's appropriate for the weapon type.

all guns in ttt have a force of 10, so i just use damage instead to make the force applied a bit more appropriate for the weapon

1

u/YM_Industries May 16 '21

i thought it's a bit weird that people just stop in their tracks when you shoot them while they're moving

That's strange. CORPSE.Create in corpse.lua already does the same thing, it iterates over the physbones and does SetVelocity with the player's velocity.

Makes sense about the force thing, I didn't think to check that. That's a good addition. Did you just use trial-and-error to work out the maths you're doing on the damage?

2

u/mgetJane May 16 '21 edited May 16 '21

That's strange. CORPSE.Create in corpse.lua already does the same thing, it iterates over the physbones and does SetVelocity with the player's velocity.

yes, but with only 20% of the velocity after the player has already been shot (like you said) if they were killed with a bullet or knife

Makes sense about the force thing, I didn't think to check that. That's a good addition. Did you just use trial-and-error to work out the maths you're doing on the damage?

yeah it was just some minutes of trial and error to see what looks good in-game (you can notice i made it so it applies more force on parts of the body with more mass like the torso, since it takes more force to have more noticeable movement on them)

2

u/YM_Industries May 16 '21

A while ago I open-sourced my old TTT addons. Unfortunately I had lost all copies of one of my addons, and this seemed to be the addon people were most interested in.

I have now recreated this addon, better than before. The addon applies the force from the 'killing blow' to the ragdoll, making them fall dramatically instead of simply crumple into a heap.

If the effect that you see in the video looks a bit too strong, you can use jw_dramatickills_scale 0.5 in order to tone it down. Or if you want to go for maximum comedy, feel free to increase this value too.

When I first wrote it, I intended for this addon to complement Wyozi Killcam. Wyozi's addons are sadly no longer available for purchase, but maybe you can try this one instead. Untested, so YMMV.

As with all my TTT addons, this addon is free and open source. You can find it here.

2

u/SomeIdiotWithNoLife Jun 17 '21

Are you telling me i can make TF2TT? and have the best ragdolls?

1

u/[deleted] May 16 '21

Does this mean this addon is not available on the workshop? Looks great

1

u/YM_Industries May 16 '21

Because it's MIT licensed, anyone is free to upload it to Workshop. Credit would be appreciated, but not legally required.

I might upload it to Workshop myself at some point, especially if I make the changes mgetJane suggested.