Stamina Issue

SOSolacex

Member
Hey there. So I am trying to get a stamina attribute working, however it's having a couple of issues.
http://prntscr.com/sjt5gb This is how my current speed change ability looks like.

All fine and dandy there. It works completely and when the stamina reaches zero, the character stops running.
However, that's only when the auto update value type of the stamina attribute is set to none.

If you set it to increase (so your stamina can actually regen over time) during playtime, the stamina in fact will not increase. Unless you manually set value > 0 in editor mode during playtime.
But if the auto update value type is set to increase before hand, the stamina counter will often have issues dropping to 0 and even when it is 0, the character won't stop running.

Unfortunately I've tried multiple delays, intervals etc on the auto update value type in the attribute manager, but with no positive results.
 
Try something like this:

Remove Change Update Value from your Speed Change ability, but keep the Stamina attribute selected to ensure they can't start running at 0 Stamina. In the Stamina attribute manager, set its Auto Update Value Type to None. Under the States section for the Stamina attribute, add a new preset and assign it to the Run state. In this preset, set the Auto Update Value Type to Decrease, along with the Start Delay, Interval and Amount values as desired. You'll then need to add another preset to the Stamina attribute which sets the Auto Update Value Type to Increase. This preset will need to be assigned to some state which is active at all times except when the player is in the Run state. (You'll need to set up a character ability to activate this state at the correct moments, i.e. an ability that activates automatically with 0 delay, but becomes inactive when the Run state begins.) Then you can set this "not running" state to be blocked by the Run state in the Stamina attribute.
 
So I'll be an idiot here, because it gets a bit confusing to me as I am not really an expert with everything yet.

However, I currently have two states according to your advice.
One is the "Run" state linked to my stamina attribute which is activated by the speed change ability.
The run state decreases the stamina counter by 2 every 0.1s which works.

The second state called StaminaRegen would have the same values except it increases the stamina count by 1.

Now is it supposed to work if I link that state with a Generic ability with start/stop type automatic and give the staminaregen a "blocked by" "Run"? Or am I missing something.

(My current result is that the stamina doesn't increase/decrease at all anymore after introducing the generic ability)

Or do I need to code a new ability?
 
Sorry, my wall of text was probably a bit confusing.

I think you've got the general idea right, yes. My idea was that you don't alter the Stamina attribute from the Speed Change ability directly, but rather use two states: one which continually decreases Stamina, and the other which continually increases it. You should have the increasing state active at all times, except when you are running.

So just as you said, try creating a generic, automatic ability, which is active at all times except whilst running. Then set your StaminaRegen state to be blocked by the Run state.

You may need to fiddle around with the logic a bit here in terms of exactly when the states are active, but the general idea should work.
 
Try something like this:

Remove Change Update Value from your Speed Change ability, but keep the Stamina attribute selected to ensure they can't start running at 0 Stamina. In the Stamina attribute manager, set its Auto Update Value Type to None. Under the States section for the Stamina attribute, add a new preset and assign it to the Run state. In this preset, set the Auto Update Value Type to Decrease, along with the Start Delay, Interval and Amount values as desired. You'll then need to add another preset to the Stamina attribute which sets the Auto Update Value Type to Increase. This preset will need to be assigned to some state which is active at all times except when the player is in the Run state. (You'll need to set up a character ability to activate this state at the correct moments, i.e. an ability that activates automatically with 0 delay, but becomes inactive when the Run state begins.) Then you can set this "not running" state to be blocked by the Run state in the Stamina attribute.
Some of what your are saying here is not possible in the preset. In the presets you can only change it's update value type for a preset for the attribute manager only. So this will not work at all plus it's, for the most part, confusing with how it's explained to set. Bottom line is it won't work anyhow.
 
You'd only need the states on the Attribute Manager, i.e. a passive/idle state for increasing stamina and another for decreasing it whilst speed change is active. (The increasing state would be blocked by the decreasing one.)
 
Top