# Branch only works on false, please help

**URL:** <https://forums.unrealengine.com/t/branch-only-works-on-false-please-help/70334>\
**Category:** Blueprint\
**Tags:** unreal-engine\
**Created:** [July 31, 2016, 5:16pm UTC](https://forums.unrealengine.com/t/branch-only-works-on-false-please-help/70334 "2016-07-31T17:16:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_72b3f68c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_72b3f68c](https://forums.unrealengine.com/u/anonymous_user_72b3f68c)\
**Post date:** [July 31, 2016, 5:16pm UTC](https://forums.unrealengine.com/t/branch-only-works-on-false-please-help/70334/1 "2016-07-31T17:16:05Z")

</div>

Hi, everyone.

I’m pretty new at using Unreal so hopefully this isn’t a bad question. Anyway, I’ve been following this tutorial for a top down shooter: [- YouTube](https://youtu.be/ex4VULnLYeA?t=9m13s).  
My issue is that when I use his setup, shooting and touching the enemy does nothing. I followed his tutorial to the best of my ability - I tagged the bullet, and even tried casting a bit ([http://puu.sh/qkXHi/376d9e463c.png](http://puu.sh/qkXHi/376d9e463c.png)). When I set the branch to trigger when false, both shooting and touching the enemy prints the string, which I don’t want. I only want it when shooting. I’ve been going back through the video and scouring the internet, but I haven’t found anything. Thanks for helping.

Error message received when hitting enemies: Error Blueprint Runtime Error: Attempted to access Bullet1\_C\_7 via property K2Node\_Event\_Other, but Bullet1\_C\_7 is pending kill from function: ‘ExecuteUbergraph\_BasicEnemy’ from node: Branch in graph: EventGraph in object: BasicEnemy with description: Attempted to access Bullet1\_C\_7 via property K2Node\_Event\_Other, but Bullet1\_C\_7 is pending kill

---

<div class="post-metadata">

**Author:** ![Pinworm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pinworm](https://forums.unrealengine.com/u/Pinworm)\
**Post date:** [July 31, 2016, 7:39pm UTC](https://forums.unrealengine.com/t/branch-only-works-on-false-please-help/70334/2 "2016-07-31T19:39:10Z")

</div>

It looks like you’re deleting the bullet before you can cast to it and check it’s tag.

Most likely you have the BP for the bullet set to delete itself on hit. This is where you should do this functionality, not on your pawn.

Instead, on your Bullet, cast to other actor, and cast it to your pawn (or whatever you want to do damage too. You don’t even need to cast if you want to damage everything. Or, check if other actor has tag). Do Apply damage to other actor. Then delete self.

Then on your pawn, do Event Any Damage, subtract from health the damage dealt, set your health, check for death.

Then your errors should clear up and it should work.

Edit: I re-read your post and you say you only want your functionality to happen when you shoot - not on hit? if so, you shouldn’t attach this to “on hit”, you should attach it to wherever you’re doing the fire sequence.

Let me know if I’m misunderstanding and you still need help

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_72b3f68c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_72b3f68c](https://forums.unrealengine.com/u/anonymous_user_72b3f68c)\
**Post date:** [July 31, 2016, 8:25pm UTC](https://forums.unrealengine.com/t/branch-only-works-on-false-please-help/70334/3 "2016-07-31T20:25:14Z")

</div>

Thanks for the feedback! But, what I want is for the bullet to come in contact with the enemy, the bullet to be destroyed (which it is doing), and then for the enemy to recognize it was hit buy the bullet (using a tag, which the bullet has), and then print that it was hit (only by the tag. But that is not happening). The screenshot I showed was on the enemy BP.

---

<div class="post-metadata">

**Author:** ![Pinworm](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Pinworm](https://forums.unrealengine.com/u/Pinworm)\
**Post date:** [July 31, 2016, 8:50pm UTC](https://forums.unrealengine.com/t/branch-only-works-on-false-please-help/70334/4 "2016-07-31T20:50:20Z")

</div>

> [@XxSuperShadicxX;573720](#):
>
> Thanks for the feedback! But, what I want is for the bullet to come in contact with the enemy, the bullet to be destroyed (which it is doing), and then for the enemy to recognize it was hit buy the bullet (using a tag, which the bullet has), and then print that it was hit (only by the tag. But that is not happening). The screenshot I showed was on the enemy BP.

You can’t do it in that order. It can’t check the tags of the bullet once the bullet has been destroyed - that data has been deleted.

If you must do it on the character instead of on the bullet (and you should do it on the bullet, it’s much easier having it all organized in your projectile than putting it in every single enemy, but i digress) then you should call deleting from the character AFTER it’s done the damage sequence / printed the “I Was Hit!” string.

You can remove the “Destroy actor” From the bullet on hit, and just add it to the character after the I Was Hit string (drag off the cast to the bullet and do destroy actor)

But the proper way would be to have the functionality on the bullet itself.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_72b3f68c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_72b3f68c](https://forums.unrealengine.com/u/anonymous_user_72b3f68c)\
**Post date:** [July 31, 2016, 9:41pm UTC](https://forums.unrealengine.com/t/branch-only-works-on-false-please-help/70334/5 "2016-07-31T21:41:29Z")

</div>

> [@Pinworm;573732](#):
>
> You can’t do it in that order. It can’t check the tags of the bullet once the bullet has been destroyed - that data has been deleted.
> 
> If you must do it on the character instead of on the bullet (and you should do it on the bullet, it’s much easier having it all organized in your projectile than putting it in every single enemy, but i digress) then you should call deleting from the character AFTER it’s done the damage sequence / printed the “I Was Hit!” string.
> 
> You can remove the “Destroy actor” From the bullet on hit, and just add it to the character after the I Was Hit string (drag off the cast to the bullet and do destroy actor)
> 
> But the proper way would be to have the functionality on the bullet itself.

Okay, what you’re saying makes sense. I’ll play around with it some more - still learning my way around this stuff - but so far stuff is changing for the better. Thanks for the help!  
And, I have this on the BP for the enemy because I added inheritance for it, or whatsoever so I can make other enemies based on it.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_72b3f68c](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_72b3f68c](https://forums.unrealengine.com/u/anonymous_user_72b3f68c)\
**Post date:** [August 1, 2016, 12:15am UTC](https://forums.unrealengine.com/t/branch-only-works-on-false-please-help/70334/6 "2016-08-01T00:15:09Z")

</div>

Okay, I figured it out using what you said, but a little different. I put the _cast_ and _DestroyActor_ before the print, and it still worked.

 ![ee27a7e7a2.png](https://d3kjluh73b9h9o.cloudfront.net/original/3X/0/9/0932cfbe642b0107a288ac4727df81150b3dba5b.png)

I removed the _Actor Has Tag_ and the branch. At the top of the image you can see the other enemies i was able to make from the BasicEnemy blueprit. Thanks so much for helping!!
