| Home Page | Recent Changes | Preferences

Team Number

In the Unreal series of games, teams in team games (CTF, DOM etc) are all assigned a number. This number corresponds to their color, and is used inside of some gametypes to do things like:

The team indexes are as follows:

Number Color
0 Red
1 Blue
2 Green
3 Yellow/Gold
255 No Team

Note that:

  • in UT2003, there's only support for two teams, red and blue, so 2, 3 and 255 won't mean anything.
  • We're not sure what the indexes were in Unreal 1.
  • A setting of "no team" can mean "no team" or "all teams" depending on the context. A pawn with "no team" is everyone's enemy. A playerstart with "no team" is availible to "all teams." (including other things with "no team."
  • In team games, players with "no team" will be autoassigned to a team.

Comments

SuperApe: My question is, why would the engine ignore the Team setting on PlayerStarts during Team Deathmatch games? How can I force it?

Foxpaw: I'm going to assume you are referring to UT2003 - the spawning on team playerstarts is implemented in TeamGame, in the UnrealGame package, however the usage of that implementation is optional. That is to say, the code is there, but is only used if bSpawnInTeamArea is set to true. It is set to true in the defaultproperties of CTFGame, xDoubleDom, and xBombingRun, but not in xTeamGame. (which is Team Deathmatch)

Try punching in "set xTeamGame bSpawnInTeamArea true" at the console when playing team deathmatch on a map with team assigned playerstarts and see if it works. (Ideally also refactor that into this page if it does :D)

SuperApe: (touching fingertips like Mr. Burns) "Excellent." Yes, thank you. That works great. :D Now, I think I have to get that command implemented on launch of xTeamGame on my map. This is one of those cases that make me think of making the GameTypeTrigger (ScriptedTrigger) I mention on my SuperApe page. Is there a simpler way?

Foxpaw: Well, that was just a method of testing to see for sure that that would work. The bSpawnInTeamArea is a variable in TeamGame and it's subclasses. However, it is set to false by default. If you are making a gametype, just have it set true in the defaultproperties. If you are making a map to use with existing team deathmatch, you could make a custom actor to put on your map that would basically just be the following:

class TeamDeathmathModifier extends actor placeable;

simulated function PostBeginPlay()
{
  if ( Level != None && Level.Game != None && Level.Game.IsA( 'TeamGame' ) )
    TeamGame( Level.Game ).bSpawnInTeamArea = true;

  Super.PostBeginPlay();
  Destroy();
}

defaultproperties
{
}

This way, when the map is loaded in game, the actor finds out if you're playing a team game, and if you are, it sets the bSpawnInTeamArea to true. Then it destroys itself.

SuperApe: Well done. It's just what I wanted; thank you. Now that I've made this custom actor and seen your code, I feel like there's a lot more to learn with this. I'm thinking of moving this discussion to the SuperApe page under the GameTypeTrigger heading. Thanks, Foxpaw. :)

(Oh btw, I noticed the *initial* spawn of players/bots it still quite random in TeamDeathmatch with the custom Actor setting SpawnInTeamArea to true. I haven't decided I hate it yet. It's kinda like being caught behind enemy lines. ;) But, my suspicion is that the Actor isn't "acting" early enough; that is to say, I think the game has already ticked once.)

SuperApe: This discussion/page could use a cleanup. I'd be happy if it was condensed to this. Use your own discretion. :)

Comments

By default an UT2k3 Team Deathmatch game will ignore the Team Number setting on PlayerStarts. To enable the TeamGame→bSpawnInTeamArea setting a custom actor could be used.

//=============================================================================
// TeamSpawn.
//=============================================================================
class TeamSpawn extends Actor
    placeable;

var() bool bForceTeamSpawn ;   // Whether to check PlayerStart->TeamNumber 
                               // during Team Deathmatch games.

var() bool bAllowCaughtBehindLines ;  // Will allow random initial spawn.

simulated function PreBeginPlay()
{
  if ( !bAllowCaughtBehindLines && bForceTeamSpawn )
  {
    if ( Level != None && Level.Game != None )
    { 
      if ( Level.Game.IsA( 'TeamGame' ) )
        TeamGame( Level.Game ).bSpawnInTeamArea = true;
    }
  Super.PreBeginPlay();
  Destroy();
  }
}

simulated function PostBeginPlay()
{
  if ( bAllowCaughtBehindLines || !bForceTeamSpawn )
  {
    if ( Level != None && Level.Game != None )
    { 
      if ( Level.Game.IsA( 'TeamGame' ) && bForceTeamSpawn )
        TeamGame( Level.Game ).bSpawnInTeamArea = true;
    }
  Super.PostBeginPlay();
  Destroy();
  }
}

Foxpaw: I'm not sure where this would best be refactored into - probrably something spawning-related, or as part of the description for the bSpawnInTeamArea property on TeamGame.

SuperApe: Sounds fine to me. But maybe can we reference that from this page. I came here originally to find this answer; I just figured others would too. :)

The Unreal Engine Documentation Site

Wiki Community

Topic Categories

Image Uploads

Random Page

Recent Changes

Offline Wiki

Unreal Engine

Console Commands

Terminology

Mapping Topics

Mapping Lessons

UnrealEd Interface

Questions&Answers

Scripting Topics

Scripting Lessons

Making Mods

Class Tree

Questions&Answers

Modeling Topics

Questions&Answers

Log In