I have these blueprints and i want to attach the pick up ammo and health from. I’m using the shooter game example and there is the ammo and health BPs and i want to be able to attach it to my blueprints of my static meshes so when players walk next to it they can pick it up. But when i tried to bring the blueprint for the Ammo into the Blueprint for my mesh it crashed the engine when i did that. so i was wondering if there was a way to do that?
Couldn’t you just replace the mesh in the Ammo or Health blueprint with your mesh?
What exactly are you trying to reach? You just want to attach a bp to another one (e.g a weapon to a character bp)?
e.g this is how I attach my weapon bp to my character (the static mesh is the root)
well what i’m trying to do is make it so a player can walk up to a mesh say “ammo crate” and when he gets within a certain area, which i believe a component is used for, that it will trigger and give the person ammo. I want to do this to several static meshes so there is one for rifle ammo, rocket ammo, and health.
Ah ok. Do it like that:
- create an actor bp - add a mesh + a sphere volume into the component tab - in the sphere properties click onto “add event” and then on component begin overlap
- go into your character or weapon bp and set up a variable for those states (e.g a float called "ammo)
- go into the event graph of your pickup and add a “get player pawn” node - drag the link out from it and add a cast to “mycharacter” node - now drag out the link from the cast node (the blue one) and type in the name of your variable that you have created before (as a set) - do whatever you like (e.g decrease the value, increase it,…) - now add a destroy or attach to actor node to either hide/destroy the mesh/effects/… or to attach it to the character
Here is an example from a health pickup:
can’t find cast to my character node and does the bool for Ammo need any values? Also im gonna leave the static mesh there so i don’t need to have attach or destroy correct? It’s just gonna be there for the player to walk next to and it will pick up. just simple as that. I already have a BP for the static mesh as it is animated as well to look like it is floating.
You need a float or integer for the ammo -> yes it needs a start value so that the player has e.g 100 bullets when the game starts. After that you just add more in your ammo bp.
Re-open and re-compile your character bp and try it again. When its still not working, create a “get player pawn” in your character bp and check if you can get the cast to “my character” (of course this name depends on the name from your character bp) there -> when you see it, just copy the “get player …” from the char bp into the other one
set -> with that we will set the current health value to something higher
- -> with that node we will take the current health value and add 30 to it (so when the currently health is 50, it will add 30 so that we will have 80 after the player has picked up the bp)
get -> we get it so that we now the current health value so that we can add the value from the +