Forum

> > CS2D > Scripts > Formular for calculating movement speed
ForenübersichtCS2D-Übersicht Scripts-ÜbersichtEinloggen, um zu antworten

Englisch Formular for calculating movement speed

5 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt Formular for calculating movement speed

FishyFinThing
User Off Offline

Zitieren
Hi there!

I just want to know how to calculate a player current movement speed?

All I know is that there a value called "speedmod" which is set on 0 by default.

And on top of that we add in weapon weight to get the value

But what is the true speed in term of pixel? I did some test but the result doesn't seem to be consistent.

Also, I want to know the true minimum speed.

It seem the speedmod limit is [-100,100] but when player get to a certain point before -100, they kind of stop moving.

alt Re: Formular for calculating movement speed

DC
Admin Off Offline

Zitieren
I'm pretty sure that I posted this at least once in the forum already... I can't find the post though
Does anyone know where I posted it? I don't want to write it again

In general you're right:
base speed + weapon modifier + speedmod

and base speed can be two different values (running or walking)

alt Re: Formular for calculating movement speed

DC
Admin Off Offline

Zitieren
Ah, perfect! Thank you!
That's what I posted in the forum somewhere. It's old but still true.

Only change is of course the frame rate from 50 to 60 FPS. But there's an unmentioned frame time based factor which makes the movement speed the same no matter what the FPS are (factor is higher with low FPS and lower with high FPS). So the values and the sample calculation should still be right.

alt Re: Formular for calculating movement speed

TrialAndError
User Off Offline

Zitieren
Also to calculate the speed you would need to halt a player with any weapon is to calculate the speed for the weapon with the highest weapon speed modifier (in this case, the knife and wrench).

Short answer: -27.5 (or -28, because decimals get truncated) to make a player halt with any weapon.

b: base speed = 2.0
w: weapon modifier = 0.75 (for knife and wrench)
s: speedmod = this is our unknown, is also divided by 10

(There's also a 1.2 multiplier)

so our formula would be:

(b + w + s/10) × 1.2 = 0
or
(2 + 0.75 + s/10) × 1.2 = 0

2+0.75 = 2.75

and multiply 2.75 and s/10 by 1.2:

3,3 + (s × 1.2)/10 = 0

which is

(s × 1.2) / 10 = 3.3

1.2/10 = 0.12

s × 0.12 = 3.3

s = 3.3/0.12 = 27.5

And there we have it. -27.5 (-28 because -27.5 will be truncated to -27) is the true minimum speed to stop with all weapons.
1× editiert, zuletzt 17.09.19 22:51:03
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antworten Scripts-ÜbersichtCS2D-ÜbersichtForenübersicht