x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.. https://youtu.be/982O7Y0EO6c

Product Version: UE 4.21
Tags:
more ▼

asked Mar 25 '19 at 10:30 PM in Blueprint Scripting

avatar image

TronixGameDev
8 1 3

(comments are locked)
10|2000 characters needed characters left

2 answers: sort voted first

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).

alt text

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.

alt text

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! :)

openoutputlog.png (84.3 kB)
debugging1.png (111.1 kB)
more ▼

answered Mar 25 '19 at 11:38 PM

avatar image

Alekann01
441 4 5 6

avatar image TronixGameDev Mar 27 '19 at 01:31 AM

alt text 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

avatar image TronixGameDev Mar 27 '19 at 01:48 AM

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

potioncast.jpg (228.3 kB)
avatar image TronixGameDev Mar 27 '19 at 03:39 AM

alt text 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.

potionname.jpg (206.3 kB)
avatar image Alekann01 Mar 27 '19 at 05:14 PM

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

(comments are locked)
10|2000 characters needed characters left

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. alt text

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

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. alt text

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.

alt text

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

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

more ▼

answered Mar 27 '19 at 06:22 PM

avatar image

Alekann01
441 4 5 6

avatar image TronixGameDev Mar 30 '19 at 05:27 AM

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.

alt text alt text

potionfix.jpg (172.7 kB)
currentlevel.jpg (150.0 kB)
(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question