How do i destroy my character and his sword with a trigger?
Hello, I have a character holding a sword and when he enters my trigger he should transform into another object/character. The problem is when my character enters the trigger he will transform but the sword stays in the scene. How can i fix this, the character and his sword should be gone at the same time.
First image show before and after entering the trigger. -- second image shows the blueprint on the trigger.
I hope that I have provided sufficient information to get some help or tips. (:
asked Jan 13 '18 at 02:15 AM in Blueprint Scripting
You can use GetAttachedActors and call Destroy Actor on each of them to destroy all actors that are attached to your character. However, there is one serious flaw here with your logic. The way you set up the overlap event, it will destroy your player pawn whenever anyone steps on it! Unless you've done it on purpose, this is considered a bad design because regardless of who steps on that overlap box, the event will fire and your player character will get destroyed! It can be any other actor such as AI stepping on that overlap box and your player will get destroyed wherever it is! Instead, a good approach would be to first check who has stepped into that box and only execute the logic if that is your player actor. You can do this check with a Cast node. Here's the blueprint setup that you would need:
You can then spawn your particle effect after the character itself gets destroyed.
Hope this helps :)
answered Jan 13 '18 at 03:02 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here