Switch Device missing 'agent' as output for IfOnWhenCheckedEvent

Summary

The switch device is missing the agent as an output for some functions. I believe they should output a ?agent instead of void. Similar to how the trigger_device works for example:
image

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Devices

Steps to Reproduce

see Fortnite.digest.verse

Expected Result

I am able to use IfOnWhenCheckedEvent, and other similar functinos from the switch device in a case where I need to get the agent. For example. When a player steps on a trigger device, I check the state of the switch. If it is on, grant a weapon using the item granter device. This works when using event binding, but I don’t understand why verse does not support this.

See this code as a suggestion, this would output either a signal with or without instigator agent when the event fires.


image

Observed Result

I am unable to get an agent as output when I listen to these functions:

Only solution I have is to listen to the event using a trigger device, and then use the trigger device, since this device does have this functionality. This requires me 1 trigger for each switch_device I want to check. However, this workaround is not sustainable for me anymore

Platform(s)

PC

the ?agent on a trigger is because creatures ect can trigger it and it needs to check if its an actual agent(Player)

To check a state per player on a switch just do

if(Switch.GetCurrentState[Agent]):
#YourCode

This will return true if the switch is on for the agent

or you can do

if(not Switch.GetCurrentState[Agent]):

I may not fully understand what your trying to do but this is how i check all switches and they is never an issue

I think you can also do things like this to get agents

Agent := Switch.IfOnWhenCheckedEvent.Await()

Again unsure if you know this or if it helps

Im still learning stuff also

1 Like

Switches can be triggered by an agent OR a signal without instigator. So I believe it should output a MaybeAgent ?agent because the state check event may have come from an event without instigator
This workaround actually works for me though, thx. if(not Switch.GetCurrentState[Agent]):