Connect Colored Tile to Score Manager?

I’m new to programming so my logic may be flawed, but Is it possible to connect the colored tile device to the score manager device, in such a way that whenever it swaps colors, it gives a point to that team and takes it away from the other?

Or even better, can I just call the score from a colored tile like you can the score manager? that would probably solve all my issues.

My current train of thought was this with the score manager: https://i.imgur.com/1GZHSXA.png

And my script is as follows:

# See https://dev.epicgames.com/documentation/en-us/uefn/create-your-own-device-in-verse for how to create a verse device.

# A Verse-authored creative device that can be placed in a level
ScoreManager := class(creative_device):


    @editable
    ColorTiles : []color_changing_tiles_device = array{}
    @editable
    ScoreMan : score_manager_device = score_manager_device{}
    var Teams : []team = array{}

    # Runs when the device is started in a running game
    OnBegin<override>()<suspends>:void=
        # TODO: Replace this with your code
        set Teams = GetPlayspace().GetTeamCollection().GetTeams()
        spawn:
            CheckTeamScore()

    CheckTeamScore()<suspends>:void=
        loop:
            Players:=GetPlayspace().GetPlayers()
            var Team1CurrentScore: int = 0
            var Team2CurrentScore: int = 0
            var Team3CurrentScore: int = 0
            var Team4CurrentScore: int = 0

            var Team1TotalScore: int = 0
            var Team2TotalScore: int = 0
            var Team3TotalScore: int = 0
            var Team4TotalScore: int = 0
            for(Player : Players):
                if(PlayerTeam := GetPlayspace().GetTeamCollection().GetTeam[Player]):
                    if (Agent : agent = agent[Player]):
                        if (PlayerTeam = Teams[0]):
                            set Team1CurrentScore = ScoreMan.GetCurrentScore(Agent)
                            set Team1TotalScore += Team1CurrentScore

                        else if (PlayerTeam = Teams[1]):
                            set Team2CurrentScore = ScoreMan.GetCurrentScore(Agent)
                            set Team2TotalScore += Team2CurrentScore

                        else if (PlayerTeam = Teams[2]):
                            set Team3CurrentScore = ScoreMan.GetCurrentScore(Agent)
                            set Team3TotalScore += Team3CurrentScore

                        else if (PlayerTeam = Teams[3]):
                            set Team4CurrentScore = ScoreMan.GetCurrentScore(Agent)
                            set Team4TotalScore += Team4CurrentScore

            Print("Team 1 Current Score: {Team1CurrentScore} Total Score: {Team1TotalScore}")
            Print("Team 2 Current Score: {Team2CurrentScore} Total Score: {Team2TotalScore}")
            Print("Team 3 Current Score: {Team3CurrentScore} Total Score: {Team3TotalScore}")
            Print("Team 4 Current Score: {Team4CurrentScore} Total Score: {Team4TotalScore}")
            Sleep(5.0)

Currently the Score increments but the total score does not increment further it just stays at the same current score when I swap to a tile, but I don’t know how to decrement it the same way a “Steal score” on the colored tile device works. Is that possible?

Sorry if this is overload. This documentation is the opposite of newbie friendly and the information and guides are either all outdated or sparse and hard to find.

Hey Vellmax,
Just a thought, What if you used 2 tiles in the same spot as one, using hide and show to swap colours, the two tiles can be hooked up to seperate score managers assigned to different teams.

Oh, that’s a fantastic idea, I actually hadn’t thought to incorporate more than one score manager. I believe this may help me achieve what I want.

Thank you so much! I’ll keep this thread updated if/once I find a solution for any further researchers.

1 Like