Hello, I want use the attachACtorToComponent function to equip a weapon on my enemy.
I’ve created a BP for the weapon like this. But i cant find the good event to plug in
It’s probably best to do this inside the enemy. The enemy can spawn it’s own weapon. You can make that different depending on random numbers or where you are in the game using the game instance, because that object is visible to all other objects ( although more fiddly if you are using multiplayer ).
Thanks for the answer. So, where I need to put the skeletal mesh of the AK47 ?
I dont understand how plug the ak47 mesh on parent in AttachActorToComponent in my EnemyBP. Do I need to create a variable inside EnemyBP ?
The skeletal mesh is in the enemy BP, right? You attach the gun to the mesh socket in your enemy BP.
You enemy must have a skeletal mesh?
You spawn the gun from within the enemy blueprint and connect it to the hand socket.
Good.
You can put a ‘destroy’ custom event in the enemy. Instead of destroying the enemy from outside, you call the ‘destroy’ event. That way, the enemy can tidy up before disappearing. It can remove the gun mesh as part of this.
If the gun is a BP, you can
You need to watch all the stuff you have on tick there. Tick, happens EVERY FRAME.
Do you really want to set all that stuff every frame?
Especially the destroy actor. The moment you place this enemy, they will disappear!
The destroy should only happen when a special custom event is called.
yeah, mesh is inside the actor? can you show you gun actor? ( the BP / components )
Right, so you pull the pin off the spawn and look for ak47, because it’s a mesh you’ll get the simulate physics node.
I’m not sure you need that node though, unless you’re going to be dropping or throwing the gun…
Did you get there?..
It’s not working this way .
How to choose the good BP to cast? I mean the actor BP of the weapon chosen.
I think I need to set simulate physics in the event graph of each WeaponBP, but how ?