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
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 ?
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.
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.
My enemyBP have a skeletal mesh of the enemy of course.
I find out like this
Now my next problem is:
How to destroy the the mesh of the weapon with the enemy death.
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.
I edited my BP_Enemy. On begin play a weapon choosed randomly spawn in the socket of the enemy mesh. In the same BP I simulate physics on the enemy mesh when enemy health is empty. But i dont know how to simulate physics on the randomly choose weapon.
yeah, mesh is inside the actor? can you show you gun actor? ( the BP / components )
I will add a custom event for the death later.
this way, If I choose randomly my weapon with Spawnactor, I can’t plug return value into simulate physics
but like I said there is 2 Weapons choosed randomly
in this case, I just can’t pull the pin.
Actor Object reference is not compatible with primitive component object reference
Inside the actor variable “Equipement” there is 2 BP in array elements
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?..
No I can’t understand how activate simulate physics on the randomly chosen weapon
Actor Object reference is not compatible with primitive component object reference
yeah yeah this name…
But its not working, I have multiple weapon actor BP