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"

Inventory problem Error (Accessed None 'InventoryWidget'...)

Hello, basically I'm trying to add a inventory system to my game, but I'm not very good at scripting so I am trying to replicate this inventory system from this video;

https://www.youtube.com/watch?v=wReJIq_Fev0

Everything seemed to work, until I got to epizode 6, Errors are coming up when I try to open my Inventory. From what it says in the error, something is wrong with this blueprint (at least I'm guessing) I really need a fix for this, I would really appreciate someone's help. thanks.

alt text

alt text

alt text

Product Version: UE 4.10
Tags:
error.jpg (15.7 kB)
mycharacter.jpg (451.6 kB)
inventorywidget.jpg (333.9 kB)
more ▼

asked Jan 17 '16 at 01:28 AM in Blueprint Scripting

avatar image

Sebapler
3 3 7 7

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

1 answer: sort voted first

If your boolean variable CanMove is already false before your InventoryWidget is created and applied to InventoryWidget variable then your will get a null reference exception when attempting to access it as is described by the error.

I recommend you shift your CreateWidget logic to BeginPlay and then just AddToViewport when the inventory is accessed.

This way your not always creating a new Widget Object when opening the inventory and you avoid the case whereby your boolean variable is false and the Widget Object is never created.

more ▼

answered Jan 17 '16 at 08:05 AM

avatar image

DevilsD
887 57 15 52

avatar image Sebapler Jan 17 '16 at 01:52 PM

Sorry for my very poor understanding of scripting language, can you please explain what should I do in a bit less scripting language way :) or just show me what I should do.

avatar image DevilsD Jan 19 '16 at 10:21 PM

Here is a better implementation. Instead of shifting alot of Code around, just check that your Inventory exists first as you can see by the comments. If it doesnt exist, then create it. The logic after that is the same as you have above.

alt text

Let me know if you have further trouble.

capture.jpg (187.3 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