How to write this script?


Hello everyone! I’ve attached an image of my script that isn’t working could you help me fix it? I realize the issue is with the Cast nodes, but I’m not sure how to cast to two objects simultaneously from BeginOverlap. Right now, if I first cast to the Character and then to Firewood, the script only works after the Firewood blueprint is overlapped. How can I properly check both objects at the same time? Thanks in advance for your help!

You’re not setting the “OBJECT” on the second cast. Not even sure why you even have that cast or either actually.

I’m going to assume that the class this code is in is the Firewood. When you overlap it with a character you want to pick it up if possible etc etc.

If that’s the case then cast to character, on success → branch check → etc.

The essence of the script is to check if the character has wood and reload the time that burns a fireplace, CAST on the character I need a script to work exactly when the player enters the script collision, and CAST on Blueprint Firewood is needed in order to get the Pick Up variable and later make it false

Then you need to pull off the Character cast As BP Third Person Character, get the variable for wood and run from there.

This means you have to store a variable in your character class referencing the Wood… Obj reference.

Thanks! Now it works