You can throw an eye to FPS Project of Epic who cover most of this case
Basically, how we handle this situation on most of game :
There is a boolean for every action the player WANT to.
Like
bWantToSprint
bWantToAim
bWantToFire
…
And boolean when the player is doing the action :
bAim
bSprint
bFire
…
Then, every frame we look what the player want to do, and if he can, we apply the action, or stop other action.
This way of doing allow you to do near everything you want, and allow priority.
Hi, I have set up a first-person character with a body and animations. next, I set up a sprint logic which works perfectly in isolation. then I set up an ADS system. even that works almost perfectly. I am using the animation starter pack and a weapon from the FPS assault pack
I want the player to start sprinting if I am holding ADS but press sprint (essentially come out of ADS mode) and if the player is sprinting and I press the ADS key then the player should stop sprinting and go into ADS mode. I thought a simple boolean should do the trick but it seems to not work. Right now when I Sprint the camera moves in but the player keeps sprinting.
attaching blueprint screenshots for both ADS and Sprinting. ADS+Sprinting BP
i did try putting bools but it doesn’t work. the problem happens when it still keeps taking input from the earlier action. i don’t want to it this way “if i am sprinting then shouldn’t be able to ADS and vice versa” but i want the character to stop doing what its doing for example if the player is sprinting and i press ADS then the player should stop sprinting and go into ADS.
i didnt understand how or where should i put the “want” bool. could you elaborate that or perhaps show it in an image ?
If the player press space, then turn bWantToSprint on true.
If the player stop, then turn bWantToSprint on false.
Then, you check if the player want to sprint AND if his allowed to sprint (not aiming, crouching…), go for it.
If you want to allow sprint to have priority overs some other action, you can on the press space bar also ask to stop aiming, crouching…
hey man, I appreciate you helping me out. I figured out the solution. I used the IsInputKeyDown node and that returns a bool. with that simply plugged the bool value to a branch that turns of the sprint function.