Please or Register to create posts and topics.

How to change player's speed ?

Hi,
I'm searching for a way to counter the speed of the player, like when he's falling.
I know there's a critical speed threshold (hardcoded btw ??), but I'd like to know if I can change it at runtime via console command in some way.

Example: I teleport the player after a high fall and so when it reappears he obviously maintain his previous speed. Ho to change it?

What I tried is using speedmod and it can stop it also, but when re-enable, the speed returns the one before.

another solution could be using a trigger_vphys, but seems cheap.

Any idea?
Thanks!

gallardo wrote:
Hi,
I'm searching for a way to counter the speed of the player, like when he's falling.
I know there's a critical speed threshold (hardcoded btw ??), but I'd like to know if I can change it at runtime via console command in some way.

Example: I teleport the player after a high fall and so when it reappears he obviously maintain his previous speed. Ho to change it?

What I tried is using speedmod and it can stop it also, but when re-enable, the speed returns the one before.

another solution could be using a trigger_vphys, but seems cheap.

Any idea?
Thanks!

I'm not really sure what you mean here. Are you looking to slow the player's falling speed? Because a player_speedmod that's on all the time will do that. If you want to reduce the player's max speed throughout the map, then by all means create omnipresent trigger_vphyses that reduce the player's max velocity.

Seeing the Logic?

Did you know that American English isn't even my first language? It's actually [spoiler]British English[/spoiler]
Released maps of note:
[spoiler]Versatile Diversity
L-Circuts[/spoiler]

yes, a player_speedmod does that until active, but once you disable it, the speed of the player returns the same as before.
example: player is falling at 3000 "speed", I activate speedmod 0 to completely stop the player in mid-air, I deactivate speedmod (value=1), the player return to fall at speed = 3000.

I can use a vphys but I wanted toknow if there's a more refined and practical solution before.

!player RunScriptCode self.SetVelocity(Vector(0,0,0)); will kill the player's velocity instantly, although if you don't use anything else they'll immediately start falling again.

Falsi sumus crusto!

Aaah, killing the player's speed in mid-air is what you want. If you don't want to mess about with scripts, then create a thin trigger_catapult where you want the player to stop. Set the Player Speed and Physics Object Speed to 1. Then, to prevent multiple stops, add two outputs to the trigger:

OnCatapulted [your trigger_catapult name] Disable
OnEndTouch [your trigger_catapult name] Enable

The nice part about this is that it also takes care of physics objects.

Seeing the Logic?

Did you know that American English isn't even my first language? It's actually [spoiler]British English[/spoiler]
Released maps of note:
[spoiler]Versatile Diversity
L-Circuts[/spoiler]

Don't set it to zero. I was actually experimenting with that, an it crashes the game as soon as the player touches the ground.

My stuff:
[spoiler]- BEE2 Addons | (BEE2)
- Hammer Addons
Maps:
- Crushed Gel
- Gel is Not Always Helpful[/spoiler]
TeamSpen210 wrote:
Don't set it to zero. I was actually experimenting with that, an it crashes the game as soon as the player touches the ground.

???

I repeated the experiment, I never encountered this problem. In any case, just set it to 1 then.

Seeing the Logic?

Did you know that American English isn't even my first language? It's actually [spoiler]British English[/spoiler]
Released maps of note:
[spoiler]Versatile Diversity
L-Circuts[/spoiler]

I went for a trigger_vphys (same as trigger_catapult). it's ok even if a dirty solution.
vscript is fine, but I don't know yet if the mod will run of portal2 or previous engine without script support.

thanks!