How to get the team index of the agent?

Hello!
I know this is a basic question but I still do not understand how to do this.

What I want to do is if the agent push the button change the Maximum health of the agent’s team.
Thank you in advance!

Hey, you can use fort_team_collection to do this, something like

TeamCollection := GetPlayspace().GetTeamCollection()
if(
    PlayerTeam := TeamCollection.GetTeam[Player],
    PlayerAllies := TeamCollection.GetAgents[PlayerTeam]
):
    for(Ally : PlayerAllies):
        # DO STUFF

Be careful, the fort_team_collection.GetAgents[] method returns agents (creatures/guards…) not players, so you might need to cast them to players if you only want to change the players health.

Thank you for your reply LAMA-san!
Is there any way to get the index of the team?
I can get the type :team but I dont know how to get the team1 or team2.
Thank you again

1 Like

Hey, so I don’t know an easy way to do it, but you could do try that :

TeamCollection := GetPlayspace().GetTeamCollection()
if(
    PlayerTeam := TeamCollection.GetTeam[Player],
    VerseTeamIndex := TeamCollection.GetTeams().Find[PlayerTeam],
    CreativeTeamIndex := VerseTeamIndex + 1 # Array indexes start from 0, creative team indexes start from 1
):
    # DO STUFF

CreativeTeamIndex is type int right?
Can I do like this image?
Im so beginner…

Your indent is wrong :smiling_face_with_tear:


Oh Sorry but when I fix like this its become more troubles…

Yes I know, it’s pretty easy to solve but I’ll let you find how, good luck :slight_smile:

I could fix by my self thank you very much!! :smile:

1 Like

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