# Applying ACT\_ON\_RANGED\_HIT

**URL:** <https://discourse.cataclysmdda.org/t/applying-act-on-ranged-hit/10871>\
**Category:** The Toolbox\
**Created:** [November 15, 2015, 11:29pm UTC](https://discourse.cataclysmdda.org/t/applying-act-on-ranged-hit/10871 "2015-11-15T23:29:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Blaze](https://avatars.discourse-cdn.com/v4/letter/b/e274bd/32.png) [@Blaze](https://discourse.cataclysmdda.org/u/Blaze)\
**Post date:** [November 15, 2015, 11:29pm UTC](https://discourse.cataclysmdda.org/t/applying-act-on-ranged-hit/10871/1 "2015-11-15T23:29:14Z")

</div>

I can only seem to get this flag to work on tools when thrown, but assigning ammo\_data to the same item causes crashes. I’m guessing it’s not fully complete?

---

<div class="post-metadata">

**Author:** ![Random\_dragon](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Random\_dragon](https://discourse.cataclysmdda.org/u/Random_dragon)\
**Post date:** [November 16, 2015, 12:20am UTC](https://discourse.cataclysmdda.org/t/applying-act-on-ranged-hit/10871/2 "2015-11-16T00:20:48Z")

</div>

Far as I can tell, it only seems to function for thrown weapons, yeah.

---

<div class="post-metadata">

**Author:** ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)\
**Post date:** [November 16, 2015, 3:22pm UTC](https://discourse.cataclysmdda.org/t/applying-act-on-ranged-hit/10871/3 "2015-11-16T15:22:42Z")

</div>

Judging from ranged.cpp, it looks like it should work for items that drop themselves on hit - that is, have a RECOVERY\_x flag (but only when it doesn’t break).

It has been a while since I implemented it, so I may be wrong.

And even if it works, the function selection is quite restricted here.

---

<div class="post-metadata">

**Author:** ![Random\_dragon](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Random\_dragon](https://discourse.cataclysmdda.org/u/Random_dragon)\
**Post date:** [November 16, 2015, 4:14pm UTC](https://discourse.cataclysmdda.org/t/applying-act-on-ranged-hit/10871/4 "2015-11-16T16:14:57Z")

</div>

Seems to be a bit limited, yeah.

Also, here’s a dumb thought. Is there any way to make use of ACT\_ON\_RANGED\_ACT to put an item in the player’s inventory? To simulate your average Legend of Zelda boomerang, as an example.

---

<div class="post-metadata">

**Author:** ![Coolthulhu](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/coolthulhu/32/2446_2.png) [@Coolthulhu](https://discourse.cataclysmdda.org/u/Coolthulhu)\
**Post date:** [November 16, 2015, 6:07pm UTC](https://discourse.cataclysmdda.org/t/applying-act-on-ranged-hit/10871/5 "2015-11-16T18:07:30Z")

</div>

> [@Random\_dragon](#):
>
> Is there any way to make use of ACT\_ON\_RANGED\_ACT to put an item in the player’s inventory? To simulate your average Legend of Zelda boomerang, as an example.

Yes, it could work. Although it would be incredibly hacky and would not work for NPCs (it would always go back to player’s inventory).

---

<div class="post-metadata">

**Author:** ![Random\_dragon](https://avatars.discourse-cdn.com/v4/letter/r/4da419/32.png) [@Random\_dragon](https://discourse.cataclysmdda.org/u/Random_dragon)\
**Post date:** [November 16, 2015, 6:11pm UTC](https://discourse.cataclysmdda.org/t/applying-act-on-ranged-hit/10871/6 "2015-11-16T18:11:20Z")

</div>

> [@Coolthulhu](#):
>
> Yes, it could work. Although it would be incredibly hacky and would not work for NPCs (it would always go back to player’s inventory).

As I figured, since items that do the “consume drug” use action seem to still target the player even if you chuck an active item about to do so.

How do you do that then? ;w;
