I can't get my shop to work with the inventory system. Can someone help me? Here's what I have so far..

Anyone here use the Titanic Games Inventory System as a base for their game?
I can’t get my shop to work with the inventory system. Can someone help me? Here’s what I have so far…

Hi NinjaTronixOG.

First off, thanks for the video, it was quite informative of your problem.
I suspect you are right, the issue may lie with your HPPotionRef. The first thing would be to check if the HPPotionRef is valid. Pull off the node and type “IsValid” and put prints on the valid / invalid pins to see which one.

You can also check your logs for “Accessed None” warnings, which will read something like “Accessed none trying to property “HPPotionRef”…” If you see this warning, then the problem is with the reference. (Screenshot to show how to access the output log).

If the reference is valid, then it might be the struct itself not containing the correct information. You can “break” the struct and print out the data of your variables.

If everything comes out as it should, then the issue will most likely lie in your “AddToInventory” or "RefreshInventory functions. Let me know how the testing goes.

Good luck! :slight_smile:

Is Valid node doesn’t seemed to work with an object Reference. I was hoping breaking the arrays and plugging the individual values to each other would fix it but it didn’t. The print string seems to indicate the item info values are coming up as empty

Is it possible to cast it?
If so what would I use as a wildcard?

I tried inputing a string directly into the name hoping to at least get the name to show up in the inventory, but even that didn’t work.

Hi NinjaTronixOG.

If your first screenshot, you are trying to place your “ItemInfo” struct into the IsValid node and not your HPPotionRef.

It is clear that your issue is HPPotionRef is invalid. I have a strong suspicion that you have created the HPPotionRef variable but you are never setting it. You will need to get a valid object reference to HPPotionRef at runtime.

Since you are trying to buy the item from a shop, I imagine that the potion will not have an object where it can obtain its information, so it might be an idea to store the information inside the shop widget instead of trying to access a world object.

I hope this makes sense.

NOTE: Please see my new answer which I posted

Hi NinjaTronixOG.

I am posting a new answer as I am suggesting a different approach.
Essentially, all you need from your HPPotionRef is the information from the struct.

To do this you don’t need to get a valid object from the world (which is what is failing in your application). I take it your information is present inside your HPPotion blueprint.

Change the type of your HPPotionRef to a class reference instead.

Compile the blueprint and then set the default value to reference your HPPoition class

Drag your HPPotion class reference into the event graph, pull off the purple pin and type “Get Class Defaults”. You should see all your custom variables including your Item Info structure.

Place that Item info inside your “AddToInventory” function.

Now when I press the button in my example, it will print out the default values I have set in the HPHealth blueprint (in my example it’s called BP_HealthPotion.

272586-shopinformation-pt5.png

Remember for this method to work, the struct information MUST be set in the editor and not during runtime like so:

Try this approach, and see if it helps you along.
Good luck!

So the iteminfo node and inputing the values directly worked, but your method with object Ref I was hoping would work for another problem I had with the continue button. Same problem with the node giving an empty value. It seems happen to me a lot where I need to get a value from a node and just coming up empty.