Attribute System Questions

I have just added a second attribute for stamina, and was very much pleasantly surprised how easy it was to set it up to drain when firing a bow (item ability - use) or while running.

Both skills seem to be working well, except a few glitches, so I would ask for help with those:

With speed change, the designated value is subtracted from the attribute every time I hold the run button. So character loses a set amount even if you do not run, or if you run for a second. I would like it to get drained when the character is actually running, while the speed change is active. Is there a way to do this? With the speed change, this ability successfully stops working if the attribute value is not high enough.

For the bow, I the stamina is reduced when I first start aiming, instead of when the bow is released. There is nothing to differentiate under the attribute settings for Use item ability to trigger that on button down or button up. I would like to see that work when I release the button. With the bow use, the character can still shoot an arrow even when there is not enough of that attribute, but you just cannot aim or draw the arrow anymore. It just releases it immediately at the lowest pull strength.

Do you have any hints on how to fix any of these? Or could there be future additions to those skills to make them more richly functional? The attribute trait is definitely headed in the right direction, and I am just too excited to think what else can be done with these! Thank you so much.

Also, what does "Change Update Value" boolean exactly do?
 
With speed change, the designated value is subtracted from the attribute every time I hold the run button. So character loses a set amount even if you do not run, or if you run for a second. I would like it to get drained when the character is actually running, while the speed change is active. Is there a way to do this?
I'm not completely following - the stamina should only start draining when the ability starts, and end when it ends. This is done with m_AttributeModifier.EnableModifier(true) and m_AttributeModifier.EnableModifier(false)

For the bow, I the stamina is reduced when I first start aiming, instead of when the bow is released. There is nothing to differentiate under the attribute settings for Use item ability to trigger that on button down or button up. I would like to see that work when I release the button. With the bow use, the character can still shoot an arrow even when there is not enough of that attribute, but you just cannot aim or draw the arrow anymore. It just releases it immediately at the lowest pull strength.
This will require a future change - the use ability uses the base ability attribute so it isn't specific.
 
I'm not completely following - the stamina should only start draining when the ability starts, and end when it ends. This is done with m_AttributeModifier.EnableModifier(true) and m_AttributeModifier.EnableModifier(false)


This will require a future change - the use ability uses the base ability attribute so it isn't specific.

For the first part what I mean is that I would like to have the attribute be drained while the character is running while the speed change ability is on. Right now, it only turns on when the speed change ability is turned on.

For the bow use ability, do you mean that it will require a future UCC update for the bow use to work? I will try to use that ability with instant shot instead of charge and release, and see if that will make any difference.

Thank you.
 
Ok, so for the bow I realized that the problem might be stemming from the alternative Use action that I set for firing instead of the attribute system. I noticed I am getting the following message for the alternative fire even if I am not using the attribute system:

ArgumentException: An element with the same key already exists in the dictionary.
System.Collections.Generic.Dictionary`2[UnityEngine.Material,Opsive.UltimateCharacterController.ThirdPersonController.Camera.ObjectFader+OriginalMaterialValue].Add (UnityEngine.Material key, OriginalMaterialValue value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
Opsive.UltimateCharacterController.ThirdPersonController.Camera.ObjectFader.InitializeCharacterFadeRenderers (UnityEngine.Renderer[] renderers) (at Assets/Opsive/UltimateCharacterController/ThirdPersonController/Scripts/Camera/ObjectFader.cs:602)
Opsive.UltimateCharacterController.ThirdPersonController.Camera.ObjectFader.OnShowProjectile (UnityEngine.GameObject projectile, Boolean show) (at Assets/Opsive/UltimateCharacterController/ThirdPersonController/Scripts/Camera/ObjectFader.cs:625)
Opsive.UltimateCharacterController.Events.InvokableAction`2[UnityEngine.GameObject,System.Boolean].Invoke (UnityEngine.GameObject arg1, Boolean arg2) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/InvokableAction.cs:132)
Opsive.UltimateCharacterController.Events.EventHandler.ExecuteEvent[GameObject,Boolean] (System.Object obj, System.String eventName, UnityEngine.GameObject arg1, Boolean arg2) (at Assets/Opsive/UltimateCharacterController/Scripts/Events/EventHandler.cs:425)
Opsive.UltimateCharacterController.Items.Actions.ShootableWeapon.DetermineVisibleProjectile (Boolean forceDisable) (at Assets/Opsive/UltimateCharacterController/Scripts/Items/Actions/ShootableWeapon.cs:823)
Opsive.UltimateCharacterController.Game.ScheduledEvent`1[System.Boolean].Invoke () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/Scheduler.cs:126)
Opsive.UltimateCharacterController.Game.Scheduler.Invoke (Opsive.UltimateCharacterController.Game.ScheduledEventBase scheduledEvent, Int32 index) (at Assets/Opsive/UltimateCharacterController/Scripts/Game/Scheduler.cs:657)
Opsive.UltimateCharacterController.Game.Scheduler.FixedUpdate () (at Assets/Opsive/UltimateCharacterController/Scripts/Game/Scheduler.cs:329)
 
Set up a new attribute named "Energy". Make the use item ability spend -50 Energy per use. Try to shoot the bow in the demo scene (while it is hold and charge or while it is instant). The character continued to shoot even when the energy was depleted. For jump or speed change, the ability became unusable after the energy was depleted.
 
Thanks - I see what you're saying. The use ability isn't checking the attribute on every use so that's why it's continuing. This fix required a few changes so it'll be in the next update.
 
Top