- May 19, 2014
- 29
- 18
This is a really specific question, but I'm having trouble wrapping my head around it, so any advice or direction would be appreciated.
I'm trying to use VScript and entities to manually set a player into a "grounded" state, even if they're airborne. So the game would stop playing "air strafing" animations, and the player would keep full control of their horizontal movement.
(By default, players have reduced control while airborne and are set into specific animations. Scouts can't reset their double jumps, Soldier can theoretically Market Garden Crit forever until he touches the ground, and Sniper's can't use their Rifle's zoom while in a jumping state.)
I've been researching different methods which might be possible, but they're mostly overly engineered ones. Tf_cond doesn't have anything I can use for this, but I was reading the VSH Vscripts and saw that it's possible to call "Constants.FPlayer.FL_ONGROUND" to check if the player is grounded or not. Reading up on FPlayer and ILocomotion on the Valve Dev Wiki didn't really enlighten me on overriding those flags on a per case basis, since afaik I can't override them since they're constants.
The other options I was considering were to spawn an invisible entity parented to the player, which would appear below the players feet while they walked off of a ledge but is destroyed when the player jumped. I haven't tested it yet but I assume it would have similar physics quirks as phys objects like the Payload.
I could also just make really complicated clip brushes but those wouldn't be super effective in my use case.
I'm not a strong programmer, so if I missed any options which use Vscript I'd like to learn about them. But any ideas are welcome at this point. Ideally it could be something attached to a trigger which just needs players to be inside them, but I've had little success with that so far.
I'm trying to use VScript and entities to manually set a player into a "grounded" state, even if they're airborne. So the game would stop playing "air strafing" animations, and the player would keep full control of their horizontal movement.
(By default, players have reduced control while airborne and are set into specific animations. Scouts can't reset their double jumps, Soldier can theoretically Market Garden Crit forever until he touches the ground, and Sniper's can't use their Rifle's zoom while in a jumping state.)
I've been researching different methods which might be possible, but they're mostly overly engineered ones. Tf_cond doesn't have anything I can use for this, but I was reading the VSH Vscripts and saw that it's possible to call "Constants.FPlayer.FL_ONGROUND" to check if the player is grounded or not. Reading up on FPlayer and ILocomotion on the Valve Dev Wiki didn't really enlighten me on overriding those flags on a per case basis, since afaik I can't override them since they're constants.
The other options I was considering were to spawn an invisible entity parented to the player, which would appear below the players feet while they walked off of a ledge but is destroyed when the player jumped. I haven't tested it yet but I assume it would have similar physics quirks as phys objects like the Payload.
I could also just make really complicated clip brushes but those wouldn't be super effective in my use case.
I'm not a strong programmer, so if I missed any options which use Vscript I'd like to learn about them. But any ideas are welcome at this point. Ideally it could be something attached to a trigger which just needs players to be inside them, but I've had little success with that so far.