# 【UEFN Question】How to execute TriggerEvent for trigger device array?

**URL:** <https://forums.unrealengine.com/t/uefn-question-how-to-execute-triggerevent-for-trigger-device-array/1321793>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [October 4, 2023, 2:57am UTC](https://forums.unrealengine.com/t/uefn-question-how-to-execute-triggerevent-for-trigger-device-array/1321793 "2023-10-04T02:57:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![RyuFuru12121](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RyuFuru12121](https://forums.unrealengine.com/u/RyuFuru12121)\
**Post date:** [October 4, 2023, 2:58am UTC](https://forums.unrealengine.com/t/uefn-question-how-to-execute-triggerevent-for-trigger-device-array/1321793/1 "2023-10-04T02:58:00Z")

</div>

I am currently creating a kind of card game and have a question about how to use TriggeredEvents function of a trigger\_device array.

I am trying to place multiple trigger devices (card static mesh assigned) on the level and handle them in a trigger\_device type array as shown in the Verse code below.

The specifications of the game are

1, Read out each question

2, If each trigger device (= card mesh) is shot during the reading, judge wheter this card is correct one or not.

I would like to implement this process in Verse code.

However, when the judge prosess is implemented in a For statement (a loop that reads out all questions), I cannot use TriggerEvent function in it because the trigger devices are set in the trigger\_device array. (TriggerEvent is not member of the array)

The point is that I would like to execute the judge process in For statement when each of the trigger devices on the level is shot, so how should I execute TriggerEvent? I would like to know if you know how to execute.

Thank you,

```auto
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
using { /UnrealEngine.com/Temporary/SpatialMath }
using { /Verse.org/Random }
using { /Verse.org/Verse }
using { /UnrealEngine.com/Temporary/UI }
using { /Fortnite.com/UI }
using { /Verse.org/Colors }

<Class name> := class(creative_device):
# Questions array read out
var Reading: []string = array{<Question Text>}
# Trigger Devices in the level
@editable
TriggerCard : []trigger_device = array{}

OnBegin<override>()<suspends>:void=
# Start Game
Sleep(3.0)
# Each Question is read out
      for(Index := 0..Reading.Length-1):
            if (Element := Reading[Indexi]):
            # Process: Question is displayed
            <Process...>
            # 【Question】When each trigger device is shot, TriggerEvent function is execurted - This "TriggerCard" causes Error because TrigerEvent is not member of trigger_device array
            TriggerCard.TriggeredEvent.Subscribe(OnTriggeredEvent)
OnTriggeredEvent<private>(Readings : string)<suspends> : void =
# Process: Judge whether the Card is correct one or not

```

---

<div class="post-metadata">

**Author:** ![bananna\_manuk](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@bananna\_manuk](https://forums.unrealengine.com/u/bananna_manuk)\
**Post date:** [October 4, 2023, 8:33pm UTC](https://forums.unrealengine.com/t/uefn-question-how-to-execute-triggerevent-for-trigger-device-array/1321793/2 "2023-10-04T20:33:38Z")

</div>

TriggerCard is just the name of the array you wold have to iterate through the array and set a Subscribe listener for each element of the array

```auto
for(Index := 0..TriggerCard.Length):
    TriggerCard[Index].TriggeredEvent.Subscribe(OnTriggeredEvent)

```

---

<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 3, 2023, 8:33pm UTC](https://forums.unrealengine.com/t/uefn-question-how-to-execute-triggerevent-for-trigger-device-array/1321793/3 "2023-11-03T20:33:42Z")

</div>

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