Skip to main content

Teams

Alliance flags

Alliance:Self = 0b0001
Alliance:Ally = 0b0010
Alliance:Enemy = 0b0100
Alliance:Neutral = 0b1000

Alliance flags represent the alliance status between two players. See Alliance for more information on what these flags mean.

Alliance:Friendly = 0b0011
Alliance:NotFriendly = 0b1100
Alliance:All = 0b1111
Alliance:None = 0b0000

These compound alliance flags make it convenient to filter for multiple alliance statuses. Alliance:Friendly is equivalent to Alliance:Self | Alliance:Ally, and Alliance:NotFriendly is equivalent to Alliance:Enemy | Alliance:Neutral. Alliance:All includes all forms of alliance and Alliance:None represents no alliances.

Alliance

Alliance(a, b) -> flags

Alliance can be used to determine the alliance status between two entities. It first looks up who owns the entity according to what its Owner property is set to, and then determines the alliance status of the two owners by looking at their Team properties.

It can return one of four flags:

  • Alliance:Self if the two entities have the same owner
  • Alliance:Neutral if at least one of the entities has no owner
  • Alliance:Ally if the owners have the same team
  • Alliance:Enemy if the owners are on different teams

If any parameter is nullish, returns Alliance:Neutral.

Owner

this.Owner -> player

Returns the owner of an entity. Returns undefined if the entity has no owner or this is nullish.

this.Owner = player

Sets the owner of an entity. The owner must be a player or team entity. Player entities are received from SpawnEachPlayer or from QueryPlayers. If you assign an entity that is not a player, it will be treated as a team entity, and anything which is owned by that same team entity will be considered to be on the same team. Any entity can be used as a team - you can simply Spawn one when needed.

Does nothing if this is nullish.

await this.Owner -> player

Waits until the owner of an entity changes, then returns its new value. If this is nullish, the owner can never change, so this function will wait forever.

delete this.Owner

Removes the owner of an entity. Does nothing if this is nullish.

PerformanceDialogIntent

PerformanceDialogIntent(show) -> intent

Returns an intent to change whether performance dialog is shown or hidden. Attach the intent to a button Button to trigger it.

  • show (Boolean): Whether to show or hide the performance dialog.

Team

owner.Team -> team

Gets the team Entity of the given owner player Entity.

If the player has not been assigned to a team, the player is considered to be on an individual team of one, and so this will return the original owner Entity.

If owner is not a player entity, looks up the Owner and returns its team. If owner is nullish, returns undefined.

owner.Team = team

Sets the team for a given owner player Entity. The team must be an Entity, and the entity cannot be a player Entity. The best thing to do is to Spawn a new entity to represent each team in your game.

Throws an error if owner is an Entity but is not a player Entity.

Does nothing is owner is nullish.

delete owner.Team

Removes the team assignment from the given owner player Entity. If the player is not assigned to a team, does nothing.

Throws an error if owner is an Entity but is not a player Entity. Does nothing if owner is nullish.

await owner.Team -> team

Waits until the team of the given owner player Entity changes, then returns its new value. If owner is nullish or not a player Entity, then the team can never change, so this function will wait forever.