# Get Stamina From Object? Do I need to set up an inventory for this to work?

**URL:** <https://forums.unrealengine.com/t/get-stamina-from-object-do-i-need-to-set-up-an-inventory-for-this-to-work/134405>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [December 3, 2019, 2:36pm UTC](https://forums.unrealengine.com/t/get-stamina-from-object-do-i-need-to-set-up-an-inventory-for-this-to-work/134405 "2019-12-03T14:36:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![BlindExposure](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@BlindExposure](https://forums.unrealengine.com/u/BlindExposure)\
**Post date:** [December 3, 2019, 2:36pm UTC](https://forums.unrealengine.com/t/get-stamina-from-object-do-i-need-to-set-up-an-inventory-for-this-to-work/134405/1 "2019-12-03T14:36:45Z")

</div>

Hey All,

I’m in it for the long hall and i have some really serious issues arising that are preventing me from continuing on the development of the game. I’m trying to set up a can that has stamina in it, so when the player activates animation to drink can, the players stamina increases.  
this is what i have going on currently.

 ![Screenshot-60.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/8/d/8de8753f31480d2adbfd4e477619604be80d0588.png)  
What I don’t understand is why i need an object when it seems pretty obvious that im calling that blueprint through “cast to stamina drink, call stamina amount” lol. then apply said amount to current stamina.  
Any help would be greatly appreciated.  
 ![Screenshot-62.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/9/3/93a1f14677ae1dfc28d1fde808c6a0af499fde1a.png)

---

<div class="post-metadata">

**Author:** ![Jeel\_884](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/jeel_884/32/470791_2.png) [@Jeel\_884](https://forums.unrealengine.com/u/Jeel_884)\
**Post date:** [December 3, 2019, 4:23pm UTC](https://forums.unrealengine.com/t/get-stamina-from-object-do-i-need-to-set-up-an-inventory-for-this-to-work/134405/2 "2019-12-03T16:23:52Z")

</div>

You don’t need an inventory but you need to setup your references correctly.  
Fast and dirty could be Get all actors of class (StaminaDrink), output array with Get 0 then link it to your cast to StaminaDrink, but using get all actors this way is bad.

A cleaner way would be storing that with a variable type StaminaDrink inside your character or game instance, and set it when you pick up the item, so you don’t need to cast or anything.

---

<div class="post-metadata">

**Author:** ![isotakis](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@isotakis](https://forums.unrealengine.com/u/isotakis)\
**Post date:** [December 3, 2019, 6:07pm UTC](https://forums.unrealengine.com/t/get-stamina-from-object-do-i-need-to-set-up-an-inventory-for-this-to-work/134405/3 "2019-12-03T18:07:59Z")

</div>

Another way would be to use data table, it would work with different kind of consumable(mana pot, health pot, etc)

> **[A new, community-hosted Unreal Engine Wiki](https://forums.unrealengine.com/t/a-new-community-hosted-unreal-engine-wiki/141494)**
>
> After over a year in maintenance mode, the official Unreal Engine Wiki is now permanently offline. These resources now live on a new community-run Unreal Engine Community Wiki — ue4community.wiki! You will be able to find content from the official...

This link shows you how to do something like that with Excel, but you could do it all in game with a custom struct  
([Struct Variables in Blueprints | Unreal Engine Documentation](https://docs.unrealengine.com/en-US/Engine/Blueprints/UserGuide/Variables/Structs/index.html))  
where you would have the name of the potion, how many points it refunds, etc.
