I am trying to create a weapon system. So I have a main blueprint class BP_BaseWeapon and two child blueprint : BP_Weapon_Laser and BP_Weapon_Rifle. In my character blueprint, when the input is triggered, I fire the custom event “Fire” (from Bp_Weapon_Laser and BP_Weapon_Rifle). Indeed, in my character blueprint, I have two variables of the two weapon BP class (Laser and Rifle).
When I play, the event in the character is fired, but the code in the two BP Laser and Rifle is not executed.
Are either BP_Weapon_Laser and BP_Weapon_Rifle spawned in the level? They will actually need to be instanced (spawned) in the level and you’ll have to call the custom event on the spawned versions of those blueprints in order to see your event fire off. If you are only using a blueprint variable of that weapon type without an instance present in the level, your function will fail to fire like you’re seeing now.
I don’t really understand what I have to do. When I spawn a BP_Weapon_Laser in my level, it doesn’t work. Do I need to link the variable in my Character BP to the spawned blueprint ? I have tried to do that but I don’t know how !
If you have downloaded the Content Examples from the Marketplace, you can check out the Blueprint_Communication map in that project. There are some good examples of how to have blueprints talk to each other and how you can point one blueprint to another. Try it out using those examples as guidance and if you have any additional questions, we’ll be glad to help out!
I solved the problem by, first, spawning the two BP in my level, and next, by putting them into the variables in my character blueprint. I did this with the Get All Actor of Class node.
hello i have the same problem and my blueprint is in the level
when i fire from my charachter BP the weapon receive nothing and dont fire the event.
can you post some screen shots pls
You must have a variable in the character BP which is the weapon class you spawn. To get it you have to use the get all class of node and you put the BP, which is in the level, in the variable of the character BP.
Then in the character you fire the event by using the function with the variable of the weapon.
The problem is that your events are never bound to an event dispatcher. In your weapon bp event begin play, make sure you bind them to an event dispatcher or they will never get called.
If you are meaning to use a BP Interface:
You need to make sure that your weapon BP actually implements the BP Interface.
What is LOOKS like you have done is that you have created a BP interface, but instead of implementing the interface on the weapon, you created unbound custom events. Also, you have fired twice in the first graph.