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:
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:
If you have any tips on how to create the item or any suggestions for improvement, I would greatly appreciate it.
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:
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.