Alright, crash course in BP / C++ logic
Event: something that occurs at some point when called
Function: something that occurs at some point when called
Notify = Event
Casting = changing or differentiating what is in use.
in anim BP you have at the start (looks different but what you need is the Cast to
Normally you already have that Is Valid node with the TryGetPawnOwner node and the Cast set up. all i’m doing here is creating a variable - drag off from As character pin (which is differently named for you because of the different cast/class/bp name) and promote to variable (not local)
Rename it to Character.
From then on you can just drag the variable in place when you need it. - is on the animation side.
Then you have the notify - An event that’s crated and called automatically by the animation. For that, let’s look at example:
The notify is called, and it does “something”. Because I need that something to be done on the character end, I take the character variable created before, and I can drag off it and find the functions and variable available inside the character BP.
Ergo, dragging of the variable you created above you can find the Received Notify function you created.
Hook that up to the notify.
You don’t really need any pins on the function either, you are just passing from the Event notify to the Character function which takes care of the rest.
Example of a function:
In case, At night you do something - is level BP stuff but your case is very similar. and let’s look at an attach to socket.
I have set up as an input event, but if you remember above the function and the event are similar. so you can do similar things with them.
Attaching to sockets:
So, that whole mess is basically taking the mesh from the current socket, Belt Right, attaching it to the Hand, and returning it to the socket belt socket (Before the animation finished playing. is backwards, but works for game-play in tandem with a camera swap, and the fact that if you delay attaching on release you end up with the compass jumping from your hand to the belt in case you double click the compass button. )
For last part.
Mesh is the character’s mesh that has sockets and bones - remember is the character blueprint.
BP_Compass is the compass added as a component - to do that in my case I’m using a child actor and setting it to be the compass. then renming the child actor. But you don’t have to do that for your static mesh weapon, it can be just a static mesh (set to movable) as you probably already have.
Last notes and differentiation functions VS Events
Events can have timers/delays, functions cannot.
To create a custom event, right click int he character BP type custom
Add custom event will show up.
from the notify character variable you can call the custom event, it will look like a function. it’s all you really need (because you do need timers).
After you figure out all the base, all you have to do is attach the component as shown, change the weapon to visible, throw a delay that matches the approximate time of when the animation finishes, make the weapon invisible, detach it or return it to where it’s supposed to be (hint, attach to pelvis bone might work).
Hope that helps, best of luck.