Stamina Decreasing While Stop Movement Animation Ability Active

KO_Games

Member
Hi,

I am using the stop movement animation ability to prevent the player when running into a wall from continuing to run in place. When the stop movement animation ability is active if the player tries running straight into a wall the player stops the run animation and does not move. This all works great; however, I noticed that even though the player is not moving the stamina value is still decreasing in the attribute manager. I tested this in the demo scene and confirmed the same scenario exists there.

How would I prevent the stamina value from decreasing when the stop movement animation ability is active? Does the stop movement animation ability need to tell the character controller that when that ability is active that isMoving should be false? Does the attribute manager need to do a check to see if the stop movement ability is active first before trying to decrease the stamina value?

Any help on this would be greatly appreciated!

Thanks!
 
You can use the state system. Set a state when the stop movement ability is active, and define a preset on the attribute manager that stamina is not changing while the state is active.
 
Hi @ChristianWiele ,

Thanks for the quick response. I can try that out. I haven't used the states or presets much up to this point in development. Does the preset allow you to tell the attribute manager not to update the stamina? Or do you just set the updating values to something like zero or something when that state is active?

Also, in my game, I'm thinking about making creating a trigger box that when the player passes through it it temporarily gives the player a speed boost and their stamina does not drain as well. What would be the best way to accomplish something like this?
 
You can set the Auto Update to "None" with the preset, so it won't update at all

There is a component called StateTrigger. You can add it to an GameObject with trigger collider. When the character enters, the StateTrigger sets a state that you can define on the component. You can define 2 presets for your state. One that ensures the stamina is not updated on the attribute manager, and one that modifies the motor parameters on the Ultimate Character Locomotion component, or the Speed Change Multiplier on the Speed Change ability.
 
Hi @ChristianWiele Thanks for the response! I tried out those suggestions with the state system, and I feel like I've gotten pretty close. However, I'm finding that the state system does not revert back to default values when changing states. For example, if I have a SpeedBoost preset that sets the auto update value to None. Then I have to create a SpeedChange preset as well that then changes the auto update back to Decrease (otherwise if the player keeps running after the speed boost is done then the player can run forever). This all works great...except that if I stop running then the stamina meter does not increase as the autoUpdate Value Type does not switch back to Increase.

I noticed that there is a default preset that is greyed out. I thought the way this default state worked was that it would save all the values in the inspector for that component and then if no states were active...it would set all the values to the default values...but the default state preset does not seem to work this way.

So what if I want the player stamina to increase any time they are not running? Like if they are walking or standing still? I'm sure I could create an idle preset...but there isn't a way to create a general walking or moving preset is there?
 
It looks like I might have been able to fix the issue. I had the speed change ability updating the stamina attribute. Instead, I just created a preset on the attribute Manager for speed change and when that was active I set the correct update values. I then unchecked the bool for the auto update on the speed change ability. This seemed to make the attribute manager go to the default values when the speed change was no longer active.
 
Top