# Is there anyway to easily interact with all devices of a certain type?

**URL:** <https://forums.unrealengine.com/t/is-there-anyway-to-easily-interact-with-all-devices-of-a-certain-type/1330489>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [October 12, 2023, 3:04pm UTC](https://forums.unrealengine.com/t/is-there-anyway-to-easily-interact-with-all-devices-of-a-certain-type/1330489 "2023-10-12T15:04:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![user\_a3f03b2c769f4d05ae2eb4232649f1a37f387f03346a500ac7e4b5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@user\_a3f03b2c769f4d05ae2eb4232649f1a37f387f03346a500ac7e4b5](https://forums.unrealengine.com/u/user_a3f03b2c769f4d05ae2eb4232649f1a37f387f03346a500ac7e4b5)\
**Post date:** [October 12, 2023, 3:04pm UTC](https://forums.unrealengine.com/t/is-there-anyway-to-easily-interact-with-all-devices-of-a-certain-type/1330489/1 "2023-10-12T15:04:22Z")

</div>

Hello! I currently have a small script that makes it so anytime a specific log from a physics\_tree\_device is destroyed the player will get 100 Gold. Is there a way to make this apply to EVERY physics\_tree\_device in the level without having to make an array and pick every single one manually in UEFN? The code I currently have is as follows

log\_break\_granter := class(creative\_device):

```
@editable
GoldGranter : item_granter_device = item_granter_device{}

@editable
Trees : physics_tree_device = physics_tree_device{}

GrantGold(): void =
    AllPlayers := GetPlayspace().GetPlayers()
    for (Agent : AllPlayers, Player := player[Agent]):
        GoldGranter.GrantItem(Player)

OnBegin<override>()<suspends>:void=
    Trees.LogDestroyedEvent.Subscribe(GrantGold)

```

---

<div class="post-metadata">

**Author:** ![im\_a\_lama](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/im_a_lama/32/995063_2.png) [@im\_a\_lama](https://forums.unrealengine.com/u/im_a_lama)\
**Post date:** [October 12, 2023, 4:07pm UTC](https://forums.unrealengine.com/t/is-there-anyway-to-easily-interact-with-all-devices-of-a-certain-type/1330489/2 "2023-10-12T16:07:27Z")

</div>

You can use [Gameplay Tags](https://dev.epicgames.com/documentation/en-us/uefn/gameplay-tags-in-verse) to do this!

---

<div class="post-metadata">

**Author:** ![SeedohFN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/seedohfn/32/720959_2.png) [@SeedohFN](https://forums.unrealengine.com/u/SeedohFN)\
**Post date:** [October 12, 2023, 5:03pm UTC](https://forums.unrealengine.com/t/is-there-anyway-to-easily-interact-with-all-devices-of-a-certain-type/1330489/3 "2023-10-12T17:03:19Z")

</div>

You might need to make it an array, here is how you can assign the event to each tree in the array without doing it manually:

```auto
@editable
GoldGranter : item_granter_device = item_granter_device{}

@editable
Trees : []physics_tree_device = array{} # Make it an array

GrantGold(): void =
    AllPlayers := GetPlayspace().GetPlayers()
    for (Agent : AllPlayers, Player := player[Agent]):
        GoldGranter.GrantItem(Player)

OnBegin<override>()<suspends>:void=
    # This will go through each tree in the array and assign the event
    # So you don't have to do it manually
    for (Tree: Trees): 
        Tree.LogDestroyedEvent.Subscribe(GrantGold)

```

---

<div class="post-metadata">

**Author:** ![GraemeBB](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/graemebb/32/1106150_2.png) [@GraemeBB](https://forums.unrealengine.com/u/GraemeBB)\
**Post date:** [October 12, 2023, 5:14pm UTC](https://forums.unrealengine.com/t/is-there-anyway-to-easily-interact-with-all-devices-of-a-certain-type/1330489/4 "2023-10-12T17:14:09Z")

</div>

No matter what you have to identify each item in your scene. Fenzy’s way is the most ideal in your situation as you can tag one of them, then just duplicate that object and the tag will be there.

If you use an array in an editable, you have to do as you mentioned… Select every one of them.

---

<div class="post-metadata">

**Author:** ![user\_a3f03b2c769f4d05ae2eb4232649f1a37f387f03346a500ac7e4b5](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@user\_a3f03b2c769f4d05ae2eb4232649f1a37f387f03346a500ac7e4b5](https://forums.unrealengine.com/u/user_a3f03b2c769f4d05ae2eb4232649f1a37f387f03346a500ac7e4b5)\
**Post date:** [October 12, 2023, 5:15pm UTC](https://forums.unrealengine.com/t/is-there-anyway-to-easily-interact-with-all-devices-of-a-certain-type/1330489/5 "2023-10-12T17:15:06Z")

</div>

@SeedohFN @im_a_lama You both are awesome, thank you so much! Both responses were very insightful to me figuring out what I’m trying to do.

---

<div class="post-metadata">

**Author:** ![SeedohFN](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/seedohfn/32/720959_2.png) [@SeedohFN](https://forums.unrealengine.com/u/SeedohFN)\
**Post date:** [October 12, 2023, 5:16pm UTC](https://forums.unrealengine.com/t/is-there-anyway-to-easily-interact-with-all-devices-of-a-certain-type/1330489/6 "2023-10-12T17:16:30Z")

</div>

Ahhhh I see now why tags fit the most in that scenario. Never used tags anyways

---

<div class="post-metadata">

**Author:** ![system](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/1/3/713c9d3f58553f0de89543d76a8a3a2779dc9fa4.png) [@system](https://forums.unrealengine.com/u/system)\
**Post date:** [November 11, 2023, 5:17pm UTC](https://forums.unrealengine.com/t/is-there-anyway-to-easily-interact-with-all-devices-of-a-certain-type/1330489/7 "2023-11-11T17:17:00Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
