Is it possible to slowly accelerate the player, like a car? Created 2 years ago2021-08-11 15:01:45 UTC by Duvo Duvo

Created 2 years ago2021-08-11 15:01:45 UTC by Duvo Duvo

Posted 2 years ago2021-08-11 15:01:45 UTC Post #345872
Hi everyone. I'm working on a mod for half-life that is focused on racing. I'd like the player to hold down forward to accelerate, and turn as a car would. however, I can't find out how to create or edit this behaviour. it seems like I can only choose from a number of pre-created values.

Is this sort of thing possible?
Posted 2 years ago2021-08-11 15:22:53 UTC Post #345873
You should look at the player movement code.
hldll -> Source Files -> pm_shared -> pm_shared.c or .cpp (if you're using halflife-updated, these are converted to C++)

Then, scroll down to the bottom until you find the PM_Move function. PM_Move calls PM_PlayerMove which contains all the pseudo-physics code for player movement, so you can modify all the "formulas" there, so to speak.

I think the functionality you're looking for is in PM_WalkMove, perhaps around this part:
User posted image
Admer456 Admer456If it ain't broken, don't fox it!
Posted 2 years ago2021-08-13 07:00:37 UTC Post #345876
Perfect, thank you
You must be logged in to post a response.