I want to add a blueprint mechanic where only if my player picks up the gas can I added to the game and is holding it, then he can fill up the generator actor I added to my game.
Right now, with or without holding the gas can, you can still fill up the generator, and I want to make it so where you have to be pick up the gas can first before you can fill up the generator.
Since you’re handling input in the receiving actor, there isn’t a naturally clean way.
To do it with your current setup, you can add a branch node after setting is held that checks whether the player is holding a gas can or not.
Checking whether the player is holding a canister differs depending on how you’ve implemented your interaction system.
Assuming you’ve done it in your player, you’ll need to get a reference to your player (GetPlayerController/GetPlayerPawn, wherever you have the reference) and cast it to your actual player class.
If you have a boolean for whether you’re holding a canister- that’s great- use it with a branch node. If you just have a reference to canister, use the IsValid node.
If your system allows for other interactables, you’ll have to cast it to a canister as well.
If you’re still confused, please post another video going over how the interaction system works.
The second blueprint link is the interaction BP i have for my character for the gas can I have.
I’ll make another video if necessary but with these, would you be able to help? I don’t exactly know where to put what I need to add without it screwing anything else up.
Could you maybe show screenshots of any possible edits?
Okay, before i plug the BP in i just want to make sure. How did you get what i circled in the picture i sent? I want to make sure i put that in as well, also, where in the BP did u put that in? Did you put that in the genrator BP?
You have a component called “ItemActor” which I assume is a Child Actor component. I named it ItemChildActor to make it a little clearer, but it’s exactly the same as your ItemActor. Simply drag off the “As XXXXXXX” after casting the player pawn to your player class, get the ItemActor, get the child actor class from that, and check if it’s the canister.
Yes- it’s in the generator bp. Right after setting IsHeld to true and right before entering your gate.
I highly recommend looking into version control software.
There are a lot of elitists that say go Git command line or go home, but GitHub Desktop or any other software is perfectly fine. It may feel daunting, but it’s actually really simple and will save you from ever having to worry about messing something up or random progress losses (ie crashes, random corruption, making a large change you ended up hating, etc).