Let’s say I have a tool that I can pick up. Only when that tool is picked up am I allowed to hit the nail.
In that situation you have three different blueprints; the player, the tool and the nail. If you’re using an Interface to trigger events in both the tool and the nail blueprints, at least the nail needs to somehow know whether the tool is being used on it or not.
What is the industry standard for doing something like that?
Unfortunately there’s no industry standard. There’s probably dozens of solutions and all that work are somewhat legit. If you ask 5 people then you’d get 5 different answer about how to implement the hammer, the player and the nail.
See what Ulls posted, that’s a few murky examples but as much as you’ll ever get as an industry standard. So namely casting and event dispatchers. Unfortunately there’s no “globals” in UE4. Which means there’s no variable “HasHammerHitNail” that you can configure and access from every blueprint.
There’s some tricks if you really need some “Global” value - with limitations though.
The Level Blueprint can access everything and get references to (nearly) everything. The big drawback? It’s a one way street, so you can’t access the level blueprint from anywhere else.
A pretty nice trick for a “global” variable is the game mode. You can cast to the game mode from pretty much everywhere - so as long as you only have one game mode you can secretly use it as a stash for “global” variables and cast to it whenever needed.
In the end you’ll cast whenever possible as it’s pretty easy to do. You’ll make event dispatchers if you really need them.
And if you’re used to that you might get thoughts like “Does the hammer need to know that it has already hit the nail? Maybe not.”
In the end there are dozens - if not countless - possibilities to program your game. And the big secret? All that work are fine. Industry standard or not…
Many schools of thought on this situation, one that I like to follow myself is to create a Function or Interface that would allow the hammer to change the nail’s variables (or vice versa). Having the nail change its own variables, just taking in the information that it needs from the whatever is interacting with it, is a solid (in my opinion) way to go about changing something.
The nail is fed the information on what to change, how to change it, etc. Then the nail decides if it wants to allow the change or not.
-vs-
The hammer tells the nail what to change, how to change it etc. The nail has to change or fail trying.