Accessed None error from node [RESOLVED]

Hi everyone. After many days beating my head on the wall, I see no other solution than to ask competent people to help me with my problem. If anybody can explain to me what I’m doing wrong, I would be very grateful.
First of all, you need to understand it’s my first try with UE, I try to understand the fundamentals by myself, also the methods used are inevitably strange, and certainly not the simplest. But I do my best with what I can understand.

So this is my problem: After creating a draw/sheath sword system, when I test it and draw the sword, everything is fine… But when I want to sheath, my character can’t detach the sword from his hand and loop the same animation until I quit the game. After back ton UE, I get an “Accessed None error from node”, an error that directs me to this node precisely:

  • xbot = My player character

  • I use too many booleans maybe, but some of them are used to trig each steps of states machine in Animation BP

  • I’m VERY sorry for the mess, if needed I can reorganize for better reading

For better explaination, here is the draw/sheath system I use:

I think I understood that using Event Tick was a bad idea, so in case the problem came from there, here it is

To talk again about the node error, what I didn’t understand is when I reduce the delay just before it (from 0.5 to 0.35), the error disappears… To reappear again randomly after 3, 5, 10 or whatever the number of sheathing the sword

I hope someone can have the faith to read and understand my problemes and screenshots.
Thanks in advance,

just going by the error type and the node you indicated i would say that your issue lies in either the sword or xbot variable not being set. a access none error usually results from trying to get a variable that hasnt been set.

Something tells me that the issue might be with the EndOverlap. Try double checking the sword’s collision preset to make sure that End Overlap function isn’t invoked when not needed. Might happen that sometimes that End Overlap assigns null to your Sword when it mustn’t be null.

I’m not sure if the problem is really there, I’m just saying what my guts tell me =)

I’m not sure to understand what’s your suggest…
Here is my Sword BP:

And for the info here is the positionning of the box collision with the sword:

unless I did not understand what “collision presets” is?

You never check what the Sword is overlapping with. What I mean is you can run close to a wall, then you get away from it, the Sword overlapping ends and there you go, your Sword is Null.

Well, not the Sword, but the variable that you use for attaching.

Oooooh very interesting!! thanks you!
but, isn’t precisely the function of “cast_to_BP_redcharac” to verify that the event is triggered only in the presence of BP_Redcharac? (Redcharac is the BP where is the xbot skeletal mesh)

Yes, that clears things up, and yes, that’s right. But still, your collision box is quite large, you should watch for some unintended overlappings with Redcharac. You can connect that Sword variable to PrintString and print its value every tick, and you’ll see if at some point in turns to Null.

Very good idea, I go try that immediatly

So… Unfortunately, no “null” value in the Tick print of Sword value.
For better report I’ve recorded this:

Thanks for your answer

If my xbot or sword variables weren’t set, the error should be appear everytime, isn’t it? Or as I said it only appear randomly after some Sheath action, and every time if I set, just before the Attach to component node, the delay at > 0.35s

But those empty lines printed between the name of the sword. Those are nothing else than nulls - nothing. So at some point your variable get nulled and it breaks your sequence.

Oh I understand now. I expected to see written “null” instead of just nothing…
But why the value of the variable change to nothing before changing again to the correct value? What can I do for correcting this?

What exactly are you using the trigger box for? Just to pick up the Sword when the Character gets close to it? Why do you need the End Overlap event?
What if you set a bool Is Picked Up for the sword, set it to True when the Character picks it up, and to False when you drop it. And you only fire the Begin Overlap event if the Is Picked Up bool is False.

Anyway, I really don’t see why you would nullify your Sword variable for anything other then dropping a sword. Correct me if I’m wrong.

The trigger box is for allowing player to use the Action button for picking the sword, if he don’t press Action, he did’nt pick the sword. And if he press Action somewhere else than in the trigger box, nothing happens. Today I’ve one sword in game, but in the future I want to allow the player to drop his sword and pick another one.

But maybe I can nullify the value only when dropping is needed?
So you think the probleme come from here?

Yes, I think so. I think you should remove the End Overlap event completely and just set a custom function that will be invoked when the sword is dropped. This should eliminate the error that you receive, and then you’ll see how your animation will work.

Basically, you don’t even need the On Begin Overlap event if you use the action key to pick up the sword. On key press, you can simply check ONCE if the Craracter is overlapping the Sword’s Collision Box, and pick up the sword if it does.

It’s works! You are right, I just deleted the End Overlap node from my character BP, and no more error whatever the delay I put before the attach to component!

Thanks you very much for your time and your help, and thanks you for being pedagogue, I could understand what you asked me to do, and so progress in my knowledge.

I noted the suggestion that you make me concerning waiting for action press before check if my BP are in collision box. I think I understood the idea and I will apply it tonight because it seems to me a very good idea.

Thanks you again for your help!

You’re welcome, glad I could be of help.

Please take some time to write any kind of an answer and mark the question as resolved.

So @Tuerer brought me the answer, thanks to him:

you should remove the End Overlap event completely and just set a custom function that will be invoked when the sword is dropped. This should eliminate the error that you receive, and then you’ll see how your animation will work.

Thanks =)

There’s a tick to the left of the answer “Accept this answer as correct” :wink: