Trigger device not triggering?

Hello,

This is my code:

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

auto_select_team_device := class(creative_device):

    @editable SaveTeam : trigger_device = trigger_device{}

    OnBegin<override>()<suspends>:void=
        return

    GetPlayers(): []player =
        return GetPlayspace().GetPlayers()

    Activate(AgentIn:?agent): void =
        TeamCollection := GetPlayspace().GetTeamCollection()
        Teams : []team = TeamCollection.GetTeams()
        Players := GetPlayers()
        for(P:Players):
            if (TeamCollection.IsOnTeam[P, Teams[2]]):
                if (TeamOneSize:=TeamCollection.GetAgents[Teams[0]], TeamTwoSize:=TeamCollection.GetAgents[Teams[1]], TeamOneSize.Length < TeamTwoSize.Length):
                    if (TeamCollection.AddToTeam[P, Teams[0]]):
                        Print("Player set to team 1")
                else:
                    if (TeamCollection.AddToTeam[P, Teams[1]]):
                        Print("Player set to team 2")
                        
        SaveTeam.Trigger()
        return

I have another device which calls the “Activate”:

pick_team_device := class(creative_device):

    @editable PickTeamTimer: timer_device = timer_device{}
    @editable AutoPickTeams: auto_select_team_device = auto_select_team_device{}

    OnBegin<override>()<suspends>:void=
        PickTeamTimer.SuccessEvent.Subscribe(AutoPickTeams.Activate)

All of it works, it assigns the team all fine but for some reason it doesn’t trigger the trigger…
I have checked to make sure that the trigger is linked to the device which it is and I have also tested if the trigger works and does what it’s intended to do when triggered and it does that too…
Just for some reason the code doesn’t trigger it even though - to my knowledge - this is set up fine?

Does anyone know if I’m missing something?

Fixed…?

I changed absolutely nothing… I gave up with it and when I went back to it, it was working? I restarted UEFN in that time so maybe it was just bugged and the reset fixed it…

1 Like

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