I want to be able to take a single integer variable and every time I release or press x to add 1 to the int variable. When it hits 2 I want to be able to go back down to 0 and be able to loop indefinitely. I’m using this to be able to go back and forth between walking, prone, crouch modes. If there are any ideas to make it easier include that as well.
Right after the add operation, you can call a Modulo (integer) node. Basically what it will do is take the first input, divide it by the second input, and output the remainder. So in this case, if you pass in your integer as the numerator and 3 (for 3 modes) as the denominator, it will keep printing 0,1, & 2.
This video should give you a pretty good idea about how to use it in blueprints:
My issue with modular numbers is I can’t find a way to add up to a number, then after it hits a certain number go back down to the first starting number.
Every time I press x it adds/subtract 1 until the max number is hit then goes back to starting number.
I made this but i don’t want to run this if there’s a more simple way.
An update to the custom movement. A custom enum was used to give outputs for each player “state” you would like to enter. I created two maps, one map includes WASD, and left shift and the other is a filler for the keys to be copied too and checked later. I added X-Key(Prone) and C-Key(Crouch) separate to make use of the flip flop to allow prone or crouch be toggled instead of held. Then just do basic add/remove from the empty map and use your base switch on Enum to give an output per action. My movement system will also include what I call Prone and Crouch Sprinting so you can move at a more, speedy past when in a crouch or prone position.Stormrage256 for the enum suggestion.