Several questions with movements and some SWEP

Hello Facepunch,

Currently, I’m working on a mod to redesign and rebalance some of the basic mechanics of TTT, because the existing shooting mechanics are honestly just plain bad. I’ve made a lot of progress, but there’s a few things I’ve ran into I can’t seem to figure out and which I can’t seem to find by searching.

Jumping Power

self:SetJumpPower() seems to work a little unexpectedly.

Obviously, how high you actually go on the jump will depend on the gravity in the server, that’s a given. However, setting sv_gravity doesn’t appear to take full effect on jumppower until after restarting the server. It still has SOME effect without restarting, the gravity is clearly higher, yet the jump is far too high. On an actual hosted server, not even restarting it appears to fix it.

Example:

https://my.mixtape.moe/ycpcny.webm[/vid]

Player speed
Two things with this. For one, player max speed appears to be affected by sv_accelerate, but only if it’s under 8.

If it’s under 8, actual max speed seems to be given by the formula maxspeed0.125sv_accelerate.

I did get a patchwork fix for this in my code in the form of this:



self:SetWalkSpeed(moveSpeed/(0.125*5.5))


But it’s not very pretty, and I can’t seem to figure out how to actually call the var, so I just wrote the number instead. If this really is the only way to do it, could anyone tell me how to actually call the var for it?

Second off, I’m struggling to figure out how to actually set shiftwalking speed.

SetWalkSpeed appears to simply set your normal walking speed. SetCrouchedWalkSpeed obviously sets your crouch multiplier, and SetRunSpeed doesn’t appear to do anything discernible to me. Shiftwalking speed, I’m struggling to figure out if does anything at all, at least in this mode, and I couldn’t find anything online. Any tips?

Viewmodel issues
Viewmodels generally seem to work alright, but particularly the M4 and USP’s seems to break very easily.

The M4’s is off centre until I fire at least one bullet. It gets reset to the broken state on deploy or reload.

The USP’s silencer simply disappears after the first shot.

Example
[vid]https://my.mixtape.moe/pdbmbn.webm

Server sided stuff
This might be beyond my programming ability, but does anyone have any pointers on how to deal with server/client being out of sync when shooting?

Basically, while client side prediction is fine for bulletholes, I’d like to at least have bloodsplatter only appear when it’s a confirmed hit by the server.

I use fairly buck-standard SWEP with my own custom recoil system(first based it on this guy’s recoil system, but it basically has no resemblance at this point, beyond sharing a few variable names). My base is at the bottom, but do note that it is EXTREMELY messy, basically uncommented and not quite finished yet. I need to clean it up and comment it at some point, but today is not that day.

weapon_ttbase.lua

Bump.

Any help would be much appreciated.

I can’t really help a lot as I’m on mobile, but regarding the viewmodels I can help as I know off the top of my head.

The m4 does that because that is how it was animated (basically, the last frame of the animation when he deploys, shoots, reloads are all different). The best fix I can think of is forcing it to the idle animation after shooting.

The USP has two shooting animations. One when it is silenced, and one when it is unsilenced. You’re using the unsilenced animation, which is what is causing it to disappear.

Thanks for replying.

For the M4, I’m not really sure how to do that. The animations aren’t in any actual path, but rather seem to be of the form

ACT_VM_(whatever type of animation)

Would something like at the end of the primary attack function putting



self:SendWeaponAnim(ACT_VM_IDLE)


Or whatever the equivalent animation would be fix it?

For the USP, I have



SWEP.PrimaryAnim = ACT_VM_PRIMARYATTACK_SILENCED


So, I’m not really sure why it isn’t working. Shouldn’t that be the silenced animation?

If you place the idle animation after the shooting animation, you’ll only see the idle animation. My suggestion would be for you to run a timer that then plays the idle animation.

As for the USP, it could be that the SendWeaponAnim in the primaryattack isn’t actually calling self.PrimaryAnim, but rather ACT_VM_PRIMARYATTACK directly. Check the code, and if you can’t fix it, put the code here.

Cheers, got that problem fixed. Thanks a lot for your help.