|
Post by sensei on Feb 3, 2019 13:59:04 GMT
Hi,
From fresh installation, using a keyboard:
- Currently when 'C' is pressed, the character crouches - When 'C' is pressed again, the character stands up
What I want is: - While 'C' is being pressed, the player crouches - If I let go of 'C', the player stands up.
How can I do this? Thanks!
|
|
|
Post by Invector on Feb 4, 2019 12:57:40 GMT
Open your vThirdPersonInput and replace the method CrouchInput for this:
protected virtual void CrouchInput() { if (crouchInput.GetButton()) { //cc.Crouch(); if (!cc.isCrouching &&cc.isGrounded && !cc.actions) { cc.isCrouching = true; cc.OnCrouch.Invoke(); } } else { if(cc.CanExitCrouch()) cc.isCrouching = false; } }
|
|
|
Post by madscientist on Feb 6, 2019 16:26:26 GMT
Amazing! I was looking for this too! Thanks
|
|
|
Post by aru1310 on Feb 10, 2019 13:23:31 GMT
Need help!
|
|
|
Post by tryharder on May 14, 2020 16:11:58 GMT
Hello,
I'm trying to do something similar with blocking currently if you press 'B' the player holds his fists up to block and when you let go they drop down, I want it so when you press 'B' the block is held up until you press 'B' again. So far no luck I've tried to make it work like the default couch because thats how I want it but it wont stay up so isblocking get set back to false I cant figure it out. Usually when I post on here I then immediately figure it out, so this is my last resort.
Thank you,
|
|
|
Post by tryharder on May 14, 2020 16:25:01 GMT
Everytime it works! I get stuck I walk away post on here go back to my code and think you idiot and fix it so if you want to do it here is what I did:-
vMeleeCombatInput
public virtual void BlockingInput() { if (cc.animator == null) return;
//isBlocking = blockInput.GetButton() && cc.currentStamina > 0 && !cc.customAction && !isAttacking; THIS IS THE ORIGINAL LINE COMMENTED OUT
if(blockInput.GetButtonDown() && cc.currentStamina > 0 && !cc.customAction && !isAttacking) //DONT FORGET TO CHANGE GetButton() to GetButtonDown() { myBlockingInput(); } }
public virtual void myBlockingInput() //MADE A NEW FUNCTION TO TOGGLE { if (isBlocking) { isBlocking = false; } else { isBlocking = true; } }
|
|