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?