Issues with lighting candles and torches. Seems like it should be easy.

So I’ve set up a little scene where I can pick up an unlit torch bring it to a lit candle and light the torch off it, then use the lit torch to light other unlit candles, it worked great. I had two separate blueprints, one for torch and one for candle. Just made children of each of those and filled my scene. All the logic is in the parents. I had a Collision sphere on each blueprint and would just use an OnComponentBeginOverlap to check if the other collision sphere was the colliding component.

Now the problem occurs when i tried to set up a lit torch being able to light another torch, or a candle being use to light another candle. I just cant figure out how to get the OnComponentBeginOverlap to determine if its another collision sphere of the same overlapping itself or what. Even if i can get it to return true it still wont light the candle.

It just seems like it should be something very simple im overlooking or overthinking, idk. But I know this should be something thats possible to do. Once I get this figured out I can just simplify to one candle parent blueprint and use the children for torches and different types of candles that will all share the same functionality of being able to light each other on fire.

Heres a video I had made for someone that may be of some use as to how I have it set up and the issue I’m having, Thanks! -Mayor

I would try to generalize this, by using an interface for all actors that can be lit or can light others. You can just make an interface function and do the “is lit” checks from there.

Hey, Thank you for the advice! I feel like I understand what you mean, but I dont see how that helps my main underlying issue. Which is I cannot get the torch to light another torch, I can make the torch light any item in the game, except another torch… I understand this whole blueprint could be much simpler/cleaner, and I plan to do that. Once I figure out how to light a torch with another torch (instance of the same actor blueprint) though.

Now if what you suggested would fix that then I apologize, I must not fully understand it. I just assume that an interface would help communicate between different blueprints, what I’m trying to do involves just one blueprint. Thank you though! I really do appreciate the input.

If anyone needs me to clarify anything please let me know. I cant believe this issue hasnt been solved yet. I feel like Im overlooking something very simple, but maybe not.

Alright, after working on some other projects and coming back to this, I’ve managed to figure it out.

What I needed to do was on the ComponentBeginOverlap, GetAllActorsOfClass for my torch BP and then check to see if the overlapping actor was one from the GetAllActorsOfClass AND if the overlapped component was overlapping. The key here was to save that array element in a Variable of the bp torch ref, then I could pull all of the normal BP Torch variables from that specific variable reference so when asking the question of isTorchLit, I can now ask specifically about the “Other” torch and not just the one im holding. Sorry if thats confusing -_-

Pics to clear it up :smiley:


Video in detail

Hi !

I’ve manage to go further in your tutorial but I’m stuck here :

Do you know why it could do such error ?

Thanks for your help !!
Cedric

edit : seems the foreachloop was bugged, deleting it and recreating it solved the issue. :slight_smile: