Hey, I have created these first aid kits and when you pick them up they go into the players inventory, but I want to set a text widget so whenever you pick them up, it updates on screen how many the player has. I don’t want this to be a print string as I constantly want the number up. Thanks in advance
Can’t you have a counter inside your inventory system that you could query?
Then you should just need to bind the query to the widget.
Thanks for the reply, yes I do have a stacking system so if the item is stackable it counts up and shows is the inventory e.g. ‘apple (4)’ but I’m not sure how to connect this system up with a widget
Nevermind I’ve figured it out, the only problem is is that it starts at -1 and then counts up
What does “Make S_ItemDetails” do?
I followed this series by Epic to do a simple point counter.
It was the fourth or fifth one where you promote your player or what it was to a variable and the widget then poll’s that for the value.
You could also make a simple counter or something alongside your health packs to test and debug the issue more easily as there are fewer things to go wrong.
Have you tried using breakpoints on the nodes to step through the flow to see what is happening?
Possible problem is the converting of your item to string for display.
It’s the information for each pickup
Yeah I’ll just keep trying to debug to see why
To make a counter you would just want to set a variable and every time you pick up the health pack just add +1 to that variable, and every time you use a health pack just subtract -1 from the variable, and print the variable as a text to the widget.
I have a game where every time I pick up a coin it adds +1 coin to my players screen and if I use a coin it will take one away.
My coin BP: Every time I walk over the coin it will call upon Add Coin event then Destroy the coin from my game world.
My character BP: I made an AddCoin event and a Total Coins variable. So going back to my Coin BP when I walk over the coin it will fire this add coin event which says add +1 to my total coins variable.
Then the last part I made a widget, put in a Coin image and a text block beside the image. And had the text block read my total coins variable and it displays on the players screen how many coins he has.
Then this is the final result on the screen. Shows how many coins I picked up.
Hope this is what you was looking for and hope it helped.
This is what I’m looking for, I’ll try it later today, thank you
I had to make a few tweaks but it’s working great so thank you
no problem, glad you got it working.