How to check if team 1 owns all flags in domination

Post Reply
dev4523
Posts: 11
Joined: Thu Apr 15, 2021 5:04 pm

How to check if team 1 owns all flags in domination

Post by dev4523 » Mon Jul 26, 2021 1:22 am

I want to make a gamemode similar to operations from Battlefield 1, to do that I need to check if the attacking team owns all the flags. How do I check which team owns all of the flags?

Thanks.

User avatar
themars2011
Site Admin
Posts: 87
Joined: Mon Dec 02, 2019 8:59 pm
Location: Germany
Contact:
themars2011’s avatar
Loading…

Re: How to check if team 1 owns all flags in domination

Post by themars2011 » Mon Jul 26, 2021 3:22 pm

In the game mode's runtime data, the flag info is stored:

Code: Select all

    public class DominationRuntimeData
    {
        /// <summary>
        /// Points scored by each team
        /// </summary>
        public int[] teamPoints;

        /// <summary>
        /// When did the last tick occur?
        /// </summary>
        public double lastTick;

        /// <summary>
        /// Flags currently used
        /// </summary>
        public DominationFlagData[] flags;
    }
The flags property contains the info on who owns it:

Code: Select all

    public class DominationFlagData
    {
        /// <summary>
        /// Who currently owns this flag?
        /// </summary>
        public int currentOwner;
        
Note that currentOwner is team + 1, so 0 is no one, 1 is first team, 2 is second team etc.

The info about it is stored in:

Code: Select all

DominationRuntimeData drd = main.currentGameModeRuntimeData as DominationRuntimeData;
Asset links posted by me may be affiliate links using the Unity Affiliate Program and yield a small amount of share at no additional cost for the buyer should a purchase be made.

dev4523
Posts: 11
Joined: Thu Apr 15, 2021 5:04 pm

Re: How to check if team 1 owns all flags in domination

Post by dev4523 » Fri Jul 30, 2021 7:24 pm

Thanks a Bunch!

Post Reply