# Where can I get the ‘agent’ to be used here?(switch\_device ver.)

**URL:** <https://forums.unrealengine.com/t/where-can-i-get-the-agent-to-be-used-here-switch-device-ver/1277212>\
**Category:** Verse\
**Tags:** unreal-editor-for-fortnite, fortnite-creative, question, fortnite\
**Created:** [August 30, 2023, 2:52am UTC](https://forums.unrealengine.com/t/where-can-i-get-the-agent-to-be-used-here-switch-device-ver/1277212 "2023-08-30T02:52:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![t.tutiya](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/t.tutiya/32/924637_2.png) [@t.tutiya](https://forums.unrealengine.com/u/t.tutiya)\
**Post date:** [August 30, 2023, 2:52am UTC](https://forums.unrealengine.com/t/where-can-i-get-the-agent-to-be-used-here-switch-device-ver/1277212/1 "2023-08-30T02:52:47Z")

</div>

If I want to toggle SwitchA when 10 seconds have elapsed from the start of the game, what should I specify as the Agent?

In this case, there is no instigator to toggle the switch

The following code seems redundant(Sorry, Not tested.).

```auto
TeamCollection := GetPlayspace().GetTeamCollection()
if:
    Teams := TeamCollection.GetTeams()
    Agents := TeamCollection.GetAgents[Teams[0]]
    Agent := Agents[0]
then:
    SwitchA.ToggleState(Agent) #SwitchA : switch_device

```

Thank you.

---

<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:** [August 30, 2023, 5:32am UTC](https://forums.unrealengine.com/t/where-can-i-get-the-agent-to-be-used-here-switch-device-ver/1277212/2 "2023-08-30T05:32:02Z")

</div>

I’d probably do this, just grabbing the first player in the game:

```auto
if:
    Player:player = GetPlayspace().GetPlayers()[0]
    PlayerAgent:agent = agent[Player]
then:
    SwitchDevice.ToggleState(PlayerAgent)

```

---

<div class="post-metadata">

**Author:** ![t.tutiya](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/t.tutiya/32/924637_2.png) [@t.tutiya](https://forums.unrealengine.com/u/t.tutiya)\
**Post date:** [August 30, 2023, 6:13am UTC](https://forums.unrealengine.com/t/where-can-i-get-the-agent-to-be-used-here-switch-device-ver/1277212/3 "2023-08-30T06:13:41Z")

</div>

That will work.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Ep8Script](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/ep8script/32/1170494_2.png) [@Ep8Script](https://forums.unrealengine.com/u/Ep8Script)\
**Post date:** [August 30, 2023, 7:33am UTC](https://forums.unrealengine.com/t/where-can-i-get-the-agent-to-be-used-here-switch-device-ver/1277212/4 "2023-08-30T07:33:35Z")

</div>

You don’t need to do `PlayerAgent:agent = agent[Player]` here btw - `player` inherits from `agent`, so it can be passed anywhere expecting an `agent`

---

<div class="post-metadata">

**Author:** ![t.tutiya](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/t.tutiya/32/924637_2.png) [@t.tutiya](https://forums.unrealengine.com/u/t.tutiya)\
**Post date:** [August 30, 2023, 2:03pm UTC](https://forums.unrealengine.com/t/where-can-i-get-the-agent-to-be-used-here-switch-device-ver/1277212/5 "2023-08-30T14:03:07Z")

</div>

Thank you!  
Here’s the final ver.(And tested.)

```auto
if:
    Agent := GetPlayspace().GetPlayers()[0]
then:
    SwitchDevice.ToggleState(Agent)

```

---

<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:** [September 29, 2023, 2:03pm UTC](https://forums.unrealengine.com/t/where-can-i-get-the-agent-to-be-used-here-switch-device-ver/1277212/6 "2023-09-29T14:03:24Z")

</div>

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