ArrivedHero Posted March 15, 2019 What exactly is the engine doing when the player chooses to crouch? I poured through ZScript in "shared" for anything and the closest I could find what I am looking for were a couple of internal functions that handling crouch movement but none of them really explained how the sprites change or the player's height. Also, is there a button for toggle crouch? I don't mean the option to toggle but like an actual "BT_TOGGLECROUCH". Because currently I'm working on a ZScript that will switch the player's camera from their own to a child tracer, and I can only get it to work by using the hold down method. Does the engine morph the player and retain all their items and stats or something when they crouch? 0 Quote Share this post Link to post
SaladBadger Posted March 15, 2019 (edited) No, there's no morph. I don't remember if this is recent or not, but the vast majority of the crouch code is scripted at this point. Gist of it I can determine: Tick(), as part of its usual thinking for the player, overrides the player Height property. crouchfactor is a measure of how "crouched" the player is at the moment. CrouchMove(int direction) is responsible for making you more or less crouched, and it is what regulates uncrouching when you're in a space that's too short to stand up. CheckCrouch(bool totallyfrozen) actually kicks off crouching, reading the input for it. The sprite changes, on the other hand, appear to be native and aren't set in the script. You'll have to find some way to simulate it I guess. Edited March 15, 2019 by SaladBadger 0 Quote Share this post Link to post
ArrivedHero Posted March 16, 2019 4 hours ago, SaladBadger said: No, there's no morph. I don't remember if this is recent or not, but the vast majority of the crouch code is scripted at this point. Gist of it I can determine: Tick(), as part of its usual thinking for the player, overrides the player Height property. crouchfactor is a measure of how "crouched" the player is at the moment. CrouchMove(int direction) is responsible for making you more or less crouched, and it is what regulates uncrouching when you're in a space that's too short to stand up. CheckCrouch(bool totallyfrozen) actually kicks off crouching, reading the input for it. The sprite changes, on the other hand, appear to be native and aren't set in the script. You'll have to find some way to simulate it I guess. I appreciate the help, but this does seem like something that I am going to have to simulate through a "crouch" state or morph, I will continue looking through this. Thank you. 0 Quote Share this post Link to post
ArrivedHero Posted March 16, 2019 Ok, figured it out, it is in CheckCrouch(). The if else statement that has the CrouchMove() function is where I want to place my code. Thanks again. 0 Quote Share this post Link to post
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.