Problems after 30.20.1 (Get Player with most score - by team)

Hi, after last update of UEFN (30.20.1) I had a problem with the Verse, one of the scripts simply stopped working, the event to check which player’s team is no longer works, and all players on team 2 return index 0. The game (private version) works fine before this update, and test same build after the 30.20.1 don’t work anymore

2 Likes

Yep! That must be what it is!

After this update, my end round script doesn’t end the round anymore.

1 Like

I tried replicating this by using the .GetAgents .IsOnTeam .GetTeams() and .GetTeam[Agent] and they all seemed to give correct results is there a script where this happens on?

Here’s the script I used in the video

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

game_manager := class(creative_device):

    @editable Trigger : trigger_device = trigger_device{}
    @editable Trigger2 : trigger_device = trigger_device{}
    OnBegin<override>()<suspends>:void=
        Trigger.TriggeredEvent.Subscribe(CheckCurrentTeam)
        Trigger2.TriggeredEvent.Subscribe(Check10Teams)
        Print("THERE ARE {Teams:=GetPlayspace().GetTeamCollection().GetTeams().Length} Teams")



    Check10Teams(MaybeAgent:?agent):void=
        TeamCollection:=GetPlayspace().GetTeamCollection()
        Teams:=GetPlayspace().GetTeamCollection().GetTeams()
        for(Index:=0..9):
            if(TeamAgents:=TeamCollection.GetAgents[Teams[Index]]):
                Print("TEAM {Index+1} has {TeamAgents.Length} agents ")
                if(Agent:=MaybeAgent?,TeamCollection.IsOnTeam[Agent,Teams[Index]]):
                    Print("^ YOU ARE IN THIS TEAM ^")

        

    CheckCurrentTeam(MaybeAgent:?agent):void=
        TeamCollection:=GetPlayspace().GetTeamCollection()
        Teams:=GetPlayspace().GetTeamCollection().GetTeams()
        if(Agent:=MaybeAgent?):
            if(PlayersTeam:=TeamCollection.GetTeam[Agent],TeamIndex:=Teams.Find[PlayersTeam]):
                Print("Player Is on TEAM {TeamIndex+1}")


1 Like

This is my code, before the update i use team 1 and 2, now i need use team 0 and 1, here, i tryed to verify the player with most score inside score manager

    # Returns the player with the highest score in the indicated Team
    #
    GetPlayerWithMostScore(TargetTeam:int)<transacts>:?agent =
        AllPlayers := GetPlayspace().GetPlayers()
        var CurrentScoreToVerify:int = 0
        var CurrentMaxScore:int = -1
        var CurrentAgentWithBestScore : ?agent = false
        
        LocalTeams := GetPlayspace().GetTeamCollection()

        if(TargetTeam = 0):
            for (I_Agent : AllPlayers):
                set CurrentScoreToVerify = TeamOneScoreManager.GetCurrentScore(I_Agent)
                if(CurrentScoreToVerify > CurrentMaxScore):
                    set CurrentMaxScore = CurrentScoreToVerify
                    if:
                        AuxAgent := agent[I_Agent]
                    then:
                        set CurrentAgentWithBestScore = option{AuxAgent}

        else if(TargetTeam = 1):
            for (I_Agent : AllPlayers):
                set CurrentScoreToVerify = TeamTwoScoreManager.GetCurrentScore(I_Agent)
                if(CurrentScoreToVerify > CurrentMaxScore):
                    set CurrentMaxScore = CurrentScoreToVerify
                    if:
                        AuxAgent := agent[I_Agent]
                    then:
                        set CurrentAgentWithBestScore = option{AuxAgent}



        return CurrentAgentWithBestScore
1 Like

Im confused you aren’t using the actual team anywhere from my understanding? You seem to be running through all players regardless if the target team is 0 or 1 the only difference seeming to be a Score Manager? also LocalTeams is not used anywhere

The actual team is not in use on old code, my mistake does not delete them.
Now i remake the code, and works, i use you example to filter the team before check on score manager, Thanks

    GetPlayerWithMostScore(TargetTeam:int)<transacts>:?agent =
        AllPlayers := GetPlayspace().GetPlayers()
        var CurrentScoreToVerify:int = 0
        var CurrentMaxScore:int = -1
        var CurrentAgentWithBestScore : ?agent = false
        
        LocalTeamCollection := GetPlayspace().GetTeamCollection()
        LocalTeams := LocalTeamCollection.GetTeams()

        if:
            TeamAgents := LocalTeamCollection.GetAgents[LocalTeams[TargetTeam]]
        then:
            for(I_Agent : TeamAgents):
                if(TargetTeam = 0):
                    set CurrentScoreToVerify = TeamOneScoreManager.GetCurrentScore(I_Agent)
                if(TargetTeam = 1):
                    set CurrentScoreToVerify = TeamTwoScoreManager.GetCurrentScore(I_Agent)

                if(CurrentScoreToVerify > CurrentMaxScore):
                    set CurrentMaxScore = CurrentScoreToVerify
                    if:
                        AuxAgent := agent[I_Agent]
                    then:
                        set CurrentAgentWithBestScore = option{AuxAgent}

        return CurrentAgentWithBestScore
1 Like

Thanks for the response. You really worried me at the start that all my code using team collections would be busted with the latest update, relieved to learn thats not the case :+1: and glad you got your code working

1 Like

Also Dammmmm you are an OG

1 Like