Stamina injection item

matheussartori

New member
Hi guys. I'm building a Stamina Injection item.

I have created a Stamina attribute in the Character Attribute Manager, and I have created a Ability to replace the Speed Change, so I can control the stamina, and it's working fine.

I wanted to create a stamina injection that either locks the stamina at 100 for a few seconds or exceeds that value, allowing the player to spend stamina over time (but the character's attribute maximum is 100). The easiest development approach is fine for me between these two.

For now, what I've done is create the item and have it only increase stamina to the maximum. I would like to share how it was done as well, in case there's a more correct way to do it. If possible, could you let me know which path I should follow?

1) I have added an usable action script so I can change the character attributes:

1702903811344.png

2) I created the destroy on use Usable Action, so when the player uses the item, the item is removed from the Inventory. Looks like this:

C#:
using Opsive.UltimateCharacterController.Items.Actions.Modules;

public class DestroyOnUse : UsableActionModule, IModuleUseItem
{
  public virtual void UseItem()
  {
    Inventory.RemoveItemIdentifier(CharacterItem.ItemIdentifier, CharacterItem.SlotID, int.MaxValue, false);
  }
}

If you have any tips on how to create the item or any suggestions for improvement, I would greatly appreciate it.
 
Do you only want the stamina to be modified when you have the item equipped? My first thought would be to do what you are doing but within its own ability so it's not tied to a particular item. If you do want it to be tied to an item then what you did makes sense.
 
ified when you have the item equipped? My first thought would be to do what you are doing but within its own ability so it's not tied to a particular item. If you do want it to be tied to an item then what you did makes sense.
Thank you Justin!

About the stamina boost, do you have any recommendations? I'm trying to fix the stamina at 100 for somewhat like 5 seconds. At the moment I could just set the stamina to 100, but the stamina starts dropping.
 
I would set the attribute auto update value to none and then manage it yourself. This will give you the most flexibility.
 
Top