Strange Error

Hello all! I am getting an odd error and I think I know what it means, but I’m not sure how to go about fixing it.

Blueprint Runtime Error: “Accessed None trying to read property K2Node_Event_BP_Player”. Node: Activate Dialogue Graph: EventGraph Function: Execute Ubergraph BP NPC Blueprint: BP_NPC

I think it is happening because the array that it’s trying to access is currently empty. Any help would be greatly appreciated.

I think it’s because the player reference you’re passing to the interface call isn’t initialized.

1 Like

Just now I think post similar question. I have same error, but not in array.



error3

Strange, function work and get value, but editor throw error.

I might be wrong, but if you try to get the name of null object, it will return empty string. Try printing is object valid.

1 Like

Really. Just need check variable ’ is valid '. If not valid, throw to node must be executed next. I resolve my problem. :upside_down_face:

I get what you mean and put in the IsValid node and still get the error. I suppose my issue is that I require the ActivateDialogue event to run regardless of whether it is valid or not.

Show us updated code and where this event is called.

Now, as expected, I have more than one error. The original error and this one:
Blueprint Runtime Error: “Accessed None”. Node: Branch Graph: EventGraph Function: Execute Ubergraph BP NPC Blueprint: BP_NPC

Your error has nothing to do with the array. Simply put, your BP_Player has no value when Event Interact runs. We would need to see more of your code to see where the actual issue is, since at the time it runs, that value is not properly set up.

Ah, so does that mean that I may have to do an initial “set” of the array at the BeginPlay? I am only fixated on the array as the issue because until I added the QuestLogInfo pin onto the ActivateDialogue, I did not have the error.

You’d need to make sure the BP_Player has a value, and then you can do separate checks for the ActiveQuests Array.

You only started getting the error because that’s when you started using the values from BP_Player (I’m guessing). If you pull out any function from BP_Player you’ll most likely get the same error.

Your validation useless in this context. You must lead code execute in safe direction if variable value is not valid. It can be any custom function.

I vaguely understand. So how would a assign a value to BP_Player in this context?

I have now solved the problem! It was found in the way my initial interaction script was set up on my BP_Player blueprint. Unfortunately, it was one of those issues that wasn’t a problem until much later.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.