Weapon timeline animation blueprint keybind

I have made a simple idea to test with before I make more weapons for this function. I have a simple cylinder scaled small enough to fit in hand and I want to be able to hit a keybind designated in the weapon blueprint. This is for a staff to extend to full length out of both ends upon pressing the key, and collapse closed on a 2nd press(repeatable). I can not for the life of me figure out a way to make it work the way I want it to. I can make it work if I put all the stuff inside the 3rdPerson BP but I want to be able to make other weapons too and possibly sell them. So I need them to not be in the 3rdPerson BP, much like all the gun assets out there and their reloading function I assume it is all contained within the weapons BP. I used a timeline to extend the mesh in and out and have gotten it to work with autoplay when the weapon is picked up it extends, but then every time I jump it opens and closes and ignores the keybind. I have looked and pictures and watched videos of many weapon BPs and nothing seems to work that I try. Please help. I will attach a pic of what works in the 3rdPerson BP but I do not want it like that(1), as well as what I have in Weapons BP that does not work right(2) and third I can get it to autoplay timeline on pickup but still no keybind control(3).

btw I used Actor Class BP if that is what it should be for weapon BP?

This is inside 3rd Person BP

This is inside the Weapon BP itself

This is inside the Weapon BP itself (this one toggles on off when jumping around)

I may be wrong, but the press G inside your weapons blueprint may be because they don’t have the actor set up to receive input. If memory serves, simple actors don’t receive input by default when you make them.

I think there is a checkbox that you can enable to make it receive input, OR you can set up the actor to receive the input manually inside the blueprint using the method described here:

Second, personally, I would have a variable in my player blueprint that has the current weapon I have equipped and when I press G, my player calls a method inside the current weapon that makes it do it`s thing, instead of setting up the input inside the weapon itself. It may save you some hassle in the future.

Imagine you cannot make the weapon grow when the player is climbing a ladder.
If you set the input in the weapon and you press G, the weapon would have to check if the player is climbing.
If you set the input in the player and the player tells the weapon to change, the player will check if he is climbing and execute/not execute the function. Makes things more organized IMO.

Then when you touch/equip the weapon you just set the current weapon in your player`s BP to the new one you just picked up.

Tell me if it works, cheers!

Oh wow thanks a ton that did the trick with the enable input in the weapon BP from the link, and I fixed the triggering when jumping with a Do N=1(opens on pickup but from then on open/close only by pressing G). Now what you mentioned second does sound more like what I want but that is another thing I have no clue how to do. Reason being that now if I have more than one weapon out to pick up it only wants to work on one weapon with them both having G as the key I set. It would be nice to have the G key only open/close the weapon I have equipped. Would you happen to have a handy tip for that part too or a link. If not no biggy you got me one huge step closer to what I wanted!!! I greatly appreciate the help!

Also I am very new to blueprints far as the more complex stuff with variables and calling other functions and stuff, learning as I go by trying to read or watch anything that might relate to what I am doing in any way lol.

Well, the second way I mentioned I would achieve by doing the following:

Create a blueprint class called I dunno, BaseWeapon, inside this class you will create all the methods that all your weapons will have in common. For example, I would set up a “OnActivate” and an “OnDeactivate” functions and leave them being empty, and set up a boolean “IsActive”.

Then I would create a Staff blueprint that inherits from BaseWeapon, then inside the staff blueprint I would override the OnActivate and make it expand the staff just like you are doing now and setting IsActive to true, and make the OnDeactivate to make the staff shrink an set the IsActive to false.

Then, in my player I would create a variable BaseWeapon that receives the weapon that I equiped/pickedup and in my player, when I press G, I would check if I have any weapon in my BaseWeapon variable, then I would check if it’s “IsActive” variable is true or not, if it’s true, I call OnDeactivate if not, I call OnActivate.

Then if I had a staff equipped, the OnActive inside the staff blueprint would make the weapon grow.

This is a neat system because then if you want for example to add a sword, you can create a Sword blueprint that derives from BaseWeapon and in the sword blueprint you can set up particle systems / sounds to play when you activate it.

You could also set up a Damage variable inside the BaseWeapon and set specific values inside each other weapons that you create. You can also set up overlap events on the BaseWeapon and then override them inside the child weapons.

Hope this helps m8.
Have a good one.

Awesome thank you very much! I will indeed try to set that up this evening, sounds like a fun challenge haha. I will let you know how it goes. Thanks again!

Oh btw just curious if it matters what class should that BaseWeapon BP should be, like actor, pawn, actor component etc?