Announcement

Collapse
No announcement yet.

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

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

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

    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.
    Image of Nodes
    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.
    Click image for larger version  Name:	Screenshot-62.png Views:	0 Size:	429.7 KB ID:	1693824
    Attached Files
    Last edited by BlindExposure; 12-03-2019, 10:42 AM.

    #2
    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.

    Comment


      #3
      Another way would be to use data table, it would work with different kind of consumable(mana pot, health pot, etc)
      https://wiki.unrealengine.com/Using_...a_-_DataTables
      This link shows you how to do something like that with Excel, but you could do it all in game with a custom struct
      (https://docs.unrealengine.com/en-US/...cts/index.html)
      where you would have the name of the potion, how many points it refunds, etc.

      Comment

      Working...
      X