# Loop over devices by devicename

**URL:** <https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [November 4, 2024, 10:17pm UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083 "2024-11-04T22:17:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![onycro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/onycro/32/997333_2.png) [@onycro](https://forums.unrealengine.com/u/onycro)\
**Post date:** [November 4, 2024, 10:17pm UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/1 "2024-11-04T22:17:02Z")

</div>

Hello forum,

let’s say I have three Devices called Device1, Device2, Device3.  
I would like to have a trigger device that would be triggered by all three devices, but instead of writing this…

```auto
    @editable 
    Device1: creative_prop = creative_prop{}
    Device2: creative_prop = creative_prop{}
    Device3: creative_prop = creative_prop{}

    @editable 
    Trigger : trigger_device = trigger_device{}

    OnBegin<override>()<suspends>:void=
        Trigger.TriggeredEvent.Subscribe(MyFunc())

```

… is something like the following code possible … ?

```auto
    @editable 
    Device[1-3]: creative_prop = creative_prop{}

    @editable 
    Trigger : trigger_device = trigger_device{}

    OnBegin<override>()<suspends>:void=
        Device[1-3].TriggeredEvent.Subscribe(MyFunc())

```

And how do I reference them in Verse without the Device Manager? If I write Device1 in Verse, it is not recognizing the Device. Let’s say I place 200 devices into the map, do I really to go through the hassle of writing seperate lines for each of them?

What do I want to achieve? I want to create a collectible system. I have 200 pickups (=VFX Powerup Device). If someone walks above them, I want to change the class index of that instigator (player/actor). So I thought I would put a trigger device into the game and then subscribe to all VFX Powerup devices dynamically. Even if I remove or add a new VFX Powerup device the Verse code would not change.

---

<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:** [November 5, 2024, 8:21am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/2 "2024-11-05T08:21:15Z")

</div>

ChatGPT combining pythong and Verse is cute

---

<div class="post-metadata">

**Author:** ![onycro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/onycro/32/997333_2.png) [@onycro](https://forums.unrealengine.com/u/onycro)\
**Post date:** [November 8, 2024, 6:49am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/3 "2024-11-08T06:49:00Z")

</div>

Excuse me LAMA, but I really did not use ChatGPT, but yes, I know how it looks like. But still, do you have a helping answer to my question? Or is it just not possible?

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [November 8, 2024, 7:23am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/4 "2024-11-08T07:23:50Z")

</div>

> [@onycro](#):
>
> `Device[1-3]: creative_prop = creative_prop{}`

Turn it into `Devices : []trigger_device = array{}`

> [@onycro](#):
>
> `Device[1-3].TriggeredEvent.Subscribe(MyFunc())`

Turn it into

```auto
for(Device:Devices):
   Device.TriggeredEvent.Subscribe(MyFunc())

```

---

<div class="post-metadata">

**Author:** ![onycro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/onycro/32/997333_2.png) [@onycro](https://forums.unrealengine.com/u/onycro)\
**Post date:** [November 8, 2024, 7:39am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/5 "2024-11-08T07:39:01Z")

</div>

Thanks Mineblo for this quick answer. The solution will loop over all devices, but not those with specific indexnumbers (1-3).  
I have now found [gameplay tags](https://dev.epicgames.com/documentation/en-us/uefn/gameplay-tags-in-verse). Which will allow me to loop over my specified devices. Next step requires to return the name of the current device. I have now something like this:

```auto
myVFXDevice := class(tag){}

OnBegin<override>()<suspends>:void=
        Pickups := FindCreativeObjectsWithTag(myVFXDevice{})
        
        for (TaggedActor : Pickups, Pickup := powerup_device[TaggedActor]):
            Pickup.GetName()

```

The problem now here is, that such thing as GetName() does not exist. I would like to get the name of each device like “Device1”, because I need to sort my list.

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [November 8, 2024, 7:45am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/6 "2024-11-08T07:45:20Z")

</div>

> [@onycro](#):
>
> but not those with specific indexnumbers (1-3).

```auto
for(Device:array{Devices[1],Devices[2],Devices[3]}):
    Device.TriggeredEvent.Subscribe(MyFunc())

```

---

<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:** [November 8, 2024, 8:28am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/7 "2024-11-08T08:28:26Z")

</div>

Mb I assumed it was ChatGPT because of the undocumented syntax you tried to use

To know which class to switch your player too, you’d need to add additional tags to your collectibles, but if you want to switch to 200 different classes then you’re probably doing something wrong

---

<div class="post-metadata">

**Author:** ![onycro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/onycro/32/997333_2.png) [@onycro](https://forums.unrealengine.com/u/onycro)\
**Post date:** [November 8, 2024, 9:50am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/8 "2024-11-08T09:50:51Z")

</div>

So I can’t access (read/write) the “Selected Class” property of VFX Devices within verse right? I couldn’t find a get/set-function within the [documentation](https://dev.epicgames.com/documentation/en-us/uefn/verse-api/fortnitedotcom/devices/powerup_device?application_version=1.0). Is this even the correct documentation of VFX Powerup devices?

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [November 8, 2024, 9:57am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/9 "2024-11-08T09:57:34Z")

</div>

> [@onycro](#):
>
> Is this even the correct documentation of VFX Powerup devices?

> **[visual\_effect\_powerup\_device class | Unreal Editor for Fortnite Documentation...](https://dev.epicgames.com/documentation/en-us/uefn/verse-api/fortnitedotcom/devices/visual_effect_powerup_device)**
>
> Learn technical details about the visual\_effect\_powerup\_device class.

> **[Visual Effect Powerup Devices | Fortnite Creative Documentation | Epic...](https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-visual-effect-powerup-devices-in-fortnite-creative)**
>
> Use Visual Effect Powerups to create a visual effect when your players do something cool.

---

<div class="post-metadata">

**Author:** ![onycro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/onycro/32/997333_2.png) [@onycro](https://forums.unrealengine.com/u/onycro)\
**Post date:** [November 8, 2024, 10:06am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/10 "2024-11-08T10:06:34Z")

</div>

Thanks mineblo for the quick help!  
Those documents don’t mention a function to set the property “Selected class” to a VFX device. Within UEFN you can assign a specific class to to a VFX device, so that only players with a specific class can pickup/see the spawn of the VFX collectible. That’s what I need, but I want to access that variable from within Verse Code, because I want to do it dynamically.

Here is what I want to achieve in the end:  
I have a list of _n_ VFX Powerup devices. They all spawn some collectible coins for example. Now imagine I have two players on that map. They can collect those coins. But individually. So if one player is picking up a coin, the other one will still be able to pick up the first coin. But if player 1 is collecting coin 1, then coin 1 will invisible for player1 (that’s why I want to use the “Selected Class” property) and coin 2 will become visible then. Yes you can do that all manually without versecode, just within UEFN, but that works only for small numbers of coins. Imagine I have placed 200 coins. I don’t want to create 200 classes manually as well and assign event listeners manually and so on. I need dynamic creation.

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [November 8, 2024, 10:08am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/11 "2024-11-08T10:08:49Z")

</div>

I’d recommend to use the [https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-collectible-object-devices-in-fortnite-creative](https://dev.epicgames.com/documentation/en-us/fortnite-creative/using-collectible-object-devices-in-fortnite-creative)  
Which supports hiding collected coins per person

---

<div class="post-metadata">

**Author:** ![onycro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/onycro/32/997333_2.png) [@onycro](https://forums.unrealengine.com/u/onycro)\
**Post date:** [November 8, 2024, 10:13am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/12 "2024-11-08T10:13:08Z")

</div>

That’s a good idea for the hiding per person. But how do I hide coin1 for player1 after pickup without hiding it for player2?

You are helping so fast, that is really awesome. I am honestly gratefull!

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [November 8, 2024, 10:14am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/13 "2024-11-08T10:14:33Z")

</div>

![Screenshot_2024-11-08-12-14-06-069_com.android.chrome](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/f/3/2f3a41b5393427eb033b40c8cda206acf6102c3c.jpeg)  
Set this setting on the device to self

---

<div class="post-metadata">

**Author:** ![onycro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/onycro/32/997333_2.png) [@onycro](https://forums.unrealengine.com/u/onycro)\
**Post date:** [November 8, 2024, 10:20am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/14 "2024-11-08T10:20:25Z")

</div>

Ok, that’s a solution for all items that **have been** collected, but not for the items that will be collected, correct? (I know I didn’t mention this requirement before, I’m really sorry)  
I only want to show one coin per person, the coins that have been collected, as well as those that will be collected need to be hidden to a player, except the next coin (but per player!).  
Why do I want to do this? Because I want to create a “guide”-like coin. That will give the player a hint where to go next. If player has reach position 1 (coin 1), the next coin appears. But only the next one, because otherwise the whole map will be spammed full of coins.

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [November 8, 2024, 10:32am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/15 "2024-11-08T10:32:03Z")

</div>

I don’t know what solution to give, try messing around with respawn setting maybe

---

<div class="post-metadata">

**Author:** ![onycro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/onycro/32/997333_2.png) [@onycro](https://forums.unrealengine.com/u/onycro)\
**Post date:** [November 8, 2024, 10:35am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/16 "2024-11-08T10:35:01Z")

</div>

I think custom classes would be an option If It was somehow possible to assign a class to a device from within verse. Because then I would just assign a class to each coin and increase the players class by one, if the player is collecting a coin. This way automatically all coins are unvisible except of the one that is matching the class of the player.

Do you know how to read/write to “Allowed Class” of VFX Powerup device or Collectible device from with verse code?

I have created this 🔗 [Feature request: Verse access to more device attributes](https://forums.unrealengine.com/t/feature-request-verse-access-to-more-device-attributes/2111155)

---

<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:** [November 9, 2024, 9:40am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/17 "2024-11-09T09:40:24Z")

</div>

IMO the whole allowed class/team thing need to be reworked, it’s stupid how people use classes and teams for random things that shouldn’t require classes and teams 😃

Coming back on your issue, I think you’re better off doing your own collectible device based on switch\_devices (which you can show/hide on a per player basis)

Hope this helps

---

<div class="post-metadata">

**Author:** ![Mineblo](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/mineblo/32/1203575_2.png) [@Mineblo](https://forums.unrealengine.com/u/Mineblo)\
**Post date:** [November 9, 2024, 9:59am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/18 "2024-11-09T09:59:53Z")

</div>

Last time I tried to use a lot of switches for per client visiblity I realized that the device itself even with custom meshes has really low render distance

---

<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:** [November 9, 2024, 10:15am UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/19 "2024-11-09T10:15:26Z")

</div>

You can change the SM component of the switch to change that 👀

---

<div class="post-metadata">

**Author:** ![onycro](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/onycro/32/997333_2.png) [@onycro](https://forums.unrealengine.com/u/onycro)\
**Post date:** [November 14, 2024, 12:35pm UTC](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083/20 "2024-11-14T12:35:48Z")

</div>

So you mean I should inherit the class and create a own creative\_class based on the parent class? I am pretty new to this. I am afraid I don’t even know how to begin with that or where to search. If you know any proper tutorial it would really help a lot!

[Next page](https://forums.unrealengine.com/t/loop-over-devices-by-devicename/2105083.md?page=2)
