Reset bool from a separate input action

hi there,

I have a bool called “is Crouching” and i’m attempting to go from “Input Action C” (Crouch) to “Input Action Shift” (Prone) and Back to Crouch again by hitting C so same input action. (so Crouch to Prone to Crouch)

I have a bool called “is Crouching” which when i press C turns it to True.
However when i then hit Shift for prone to go from Crouch to Prone it stays at “true” for “is Crouching” - therefore im having trouble using the same key “C” to go back from Prone to Crouch because its stuck on “is Crouching”

Is there a way to change/reset “is Crouching” to false when I hit Input Action Shift in order to Prone?

Hey there @enam1984! Are you using the built in Boolean IsCrouching from the character movement class? If so, then no you can’t set it natively without overriding the character movement class as it only has an exposed getter. However, you could house your own booleans for crouching/prone. otherwise whenever the character is considered prone, they will be crouched. If you need to verify they are prone, a separate prone bool would work.

Hi there @SupportiveEntity thank you. I created my own bool called “is crouching”. however maybe the best option would be to create a separate bool for prone. would i then set “is crouching” to false when “is prone” is true?

It’s somewhat dependent on how your state logic is. I personally would have a single variable to show which state it’s in, in my case I would use an maybe Enum to describe the state, Standing, Running, Walking, Crouching, Prone etc. The character component already does have these, and a way to create custom movement modes as well, but unless you’re working in C++ you can’t really edit the base bools inside of it. For a small game, you could just have a prone boolean and be done with it, knowing for more complex games you may want to go with a more extendable option.

ye im using Enum for all my movement states but the problem seems to be that im limiting myself because in trying to handle the transition from stand to prone and crouch to prone and vice versa, in the same state box in the state machine. I might just divide out those.

I hope that makes sense.

I would. Because I’d want that specific bool I can check, and less chance of confusion.

So i used my enum states to declare for a bool if someone is crouching or running (standing up/or actually running).

Is the below BP, ok/good practice?

Thanks! @Astaraa @SupportiveEntity

Since you have the Enum already I’d do Blend Pose by (EnumName).

image

thanks yeah. I had used that before @SupportiveEntity but weirdly i was leaving it out of each state box in the state machine this time around.

I don’t really know why but i guess i could re-implement it.
thanks a lot!