Accessed none trying to read property

I’m still trying to learn blueprint scripting. I’ve been getting this reading error while trying to get an AI’s health. All variables are replicated.

This is the error I’ve been getting after running the game.

244124-
[Here][1] is a video of the blueprint setup.

screen shot a blueprint of the set-up would be helpful to figuring out the actual problem.

Didn’t see that haha So you’re casting “stalker AI” which is an NPC to the “player character”. This would always fail and so you get no reference to the Stalker AI BP on begin construct in the widget and that is why you have an error when the function tries to use that reference it returns nothing because the cast fail. You can’t cast an NPC to a player character. You need a reference to the AI in the level somehow, through an overlap event, a hit event, a direct reference in the level BP that you can use to set the widget reference from etc.

I did some research over your answers and came out with this. I changed the binding of the progress bar and it seems to be working. Thanks for the help!

1 Like