Announcement

Collapse
No announcement yet.

Squad Leader Marker

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • [INFO] Squad Leader Marker

    SquadUI is a script for nametags displayed overhead on demand and temporarily, as well as markers of players' positions on the map. It is designed to work best with TG server settings.

    Features:
    • Only updates if the map/GPS is opened.
    • Amount of information is scaled on GPS to allow easier reading.
    • Everything is run locally on the client.
    • Marks players' locations on the map with varying presence depending on their importance
    • Action Menu based nametag system with varying styles and presence depending on their importance.
    • Full support for assigned teams as nametags and map markers synchronize with the colors assigned to team members.


    Credits:
    • aeroson - His original dynamic players' marker script. I have extracted the structure.
    • Butler - Name-tag script for ideas and code.


    Usage:
    Location of squadUI.sqf file in mission folder:
    Code:
    functions\client
    Code:
    class cfgFunctions
    {
        #include "functions\cfgfunctions.hpp"  
    };
    Code:
    //cfgfunctions.hpp
    class TG
    {
        tag = "TG";
        class client
        {
            file = "functions\client";        
            class squadUI {};      
        };
    };
    Code:
    //initPlayerLocal.sqf
    [] call TG_fnc_squadUI;
    Known Bug:
    Not TVT compatible i.e., opposing sides can see each others' names also. This is due to the sides changing when BIS incapacitated state kicks in. In order to accomodate that side check is not implemented. When implemented there were instances of network lag causing some of the names to not show up.

    Download:
    DropBox
    Last edited by |TG| B; 10-21-2016, 05:32 AM.


  • #2
    Re: Squad Leader Marker

    Excellent! Thanks B.
    |TG-189th| Unkl
    [unit][conduct][volun][command]
    TG PrimerArmA Game Officer189th Infantry Brigade Former Irregular
    Submit a Ribbon Nomination!
    "this is on par with groups you have to join to get the quality of gameplay and i really enjoyed it" - random dude
    "Remember when the threat has spotted you, smoke first then bring the explosive rounds to bear. When the threat has not spotted you its bang first and smoke after to extract." - Wicks

    Comment


    • #3
      Re: Squad Leader Marker

      This looks like a great idea. It will work well when we have those large groups for a "radio" channel that everyone can use like a squad really should have but allow for the teams to be quite distinct. Especially with new public player guests.

      Um...Does this mean I'm about to download, upload and list 20 missions in a text file again? <crawls over to couch and pulls blanket over head>
      |TG-189th| Unkl
      [unit][conduct][volun][command]
      TG PrimerArmA Game Officer189th Infantry Brigade Former Irregular
      Submit a Ribbon Nomination!
      "this is on par with groups you have to join to get the quality of gameplay and i really enjoyed it" - random dude
      "Remember when the threat has spotted you, smoke first then bring the explosive rounds to bear. When the threat has not spotted you its bang first and smoke after to extract." - Wicks

      Comment


      • #4
        Re: Squad Leader Marker

        you could keep assigned team colors & players in nested arrays and just call something to change a value if they change instead of constantly assigning, just a thought as i havent picked through your code
        Yink | Vanilla Pilot | Killer of Stirling | CS GOD | Projects Team

        Comment


        • #5
          Re: Squad Leader Marker

          B, in the new version where you can assign colours...how can we assign colours to each unit at the mission start. I have a squad I want all in the same group and I want colours auto assigned from the mission.
          |TG-189th| Unkl
          [unit][conduct][volun][command]
          TG PrimerArmA Game Officer189th Infantry Brigade Former Irregular
          Submit a Ribbon Nomination!
          "this is on par with groups you have to join to get the quality of gameplay and i really enjoyed it" - random dude
          "Remember when the threat has spotted you, smoke first then bring the explosive rounds to bear. When the threat has not spotted you its bang first and smoke after to extract." - Wicks

          Comment


          • #6
            Re: Squad Leader Marker

            Yeah, I want to allow a leader to change, to reassign colours, so I guess I'll just leave it as is. Thanks B.
            |TG-189th| Unkl
            [unit][conduct][volun][command]
            TG PrimerArmA Game Officer189th Infantry Brigade Former Irregular
            Submit a Ribbon Nomination!
            "this is on par with groups you have to join to get the quality of gameplay and i really enjoyed it" - random dude
            "Remember when the threat has spotted you, smoke first then bring the explosive rounds to bear. When the threat has not spotted you its bang first and smoke after to extract." - Wicks

            Comment


            • #7
              Re: Squad Leader Marker

              You must spread some Reputation around before giving it to |TG| B again.

              I haven't seen in action yet, but really looking forward to it. Specially, the we "No longer we have to describe the DEL key on Numpad". Easier for those new players!


              TGU Instructor Irregulars TG Pathfinder

              Former TGU Dean Former ARMA Admin Former Irregulars Officer

              "Do not seek death. Death will find you. But seek the road which makes death a fulfillment." - Dag Hammarskjold

              Comment


              • #8
                So we have been plagued by the colors not staying colored in a squad (Definetely my fault for making a stupid mistake and not looking back until now). After the series Op_Bread came out which uses the old nametag and map marker system I noticed that colors worked as they used to on those missions. So I did some rolling back and there we go. Thanks to CaptainShawn123 for archiving the older version. Replace your squadUI.sqf to update. Colors can once again work reliably. Color away.

                Code:
                /*version: 2017_04_12*/
                if (isDedicated) exitWith {};
                
                #define  HUD_ASSIGNEDTEAM "ST_STHud_assignedTeam"
                
                ST_STHud_AssignedTeamWatcher = {
                    // Nothing to do in SP
                    if (!isMultiplayer) exitWith {};
                
                    // Before we start the main loop, check to see if any units have had their
                    // team assigned e.g. via unit init and push that into our system.
                    if (leader(player) == player) then
                    {
                        {
                            private "_unit";
                            _unit = _x;
                
                            // Update the shared data if it doesn't match the data from the engine
                            if (assignedTeam(_unit) != (_unit call ST_STHud_assignedTeam)) then
                            {
                                _unit setVariable [HUD_ASSIGNEDTEAM, assignedTeam(_unit), true];
                            };
                        } forEach(units(player));
                    };
                
                    while {true} do
                    {
                        // Wait until player is group leader
                        waitUntil {sleep 2; leader(player) == player};
                
                        // Ensure the engine is using the latest values from the shared version
                        // This preserves team assignments when the group's leader changes
                        {
                            private "_unit";
                            _unit = _x;
                
                            _unit assignTeam (_unit call ST_STHud_assignedTeam);
                        } forEach(units(player));
                
                        // While the unit remains the group leader, ensure all other team
                        // members are using the values set locally.
                        while {leader(player) == player} do
                        {
                            {
                                private "_unit";
                                _unit = _x;
                
                                // Update the shared data if it doesn't match the data from the engine
                                if (assignedTeam(_unit) != (_unit call ST_STHud_assignedTeam)) then
                                {
                                    _unit setVariable [HUD_ASSIGNEDTEAM, assignedTeam(_unit), true];
                                };
                            } forEach(units(player));
                            sleep 5;
                        };
                    };
                };
                
                // unit call ST_STHud_assignedTeam -> "MAIN" etc.
                ST_STHud_assignedTeam = {
                    private "_unit";
                    _unit = _this;
                
                    // Nothing to do in SP
                    if (!isMultiplayer) exitWith {assignedTeam(_unit)};
                
                    // Assume MAIN if not defined, which avoids any complex behaviour
                    _assigned_team = _unit getVariable [HUD_ASSIGNEDTEAM, "MAIN"];
                
                    // Early exit if not using teams
                    if (_assigned_team == "MAIN") exitWith {"MAIN"};
                
                    // Special behaviour when checking the unit colour of the player
                    if (_unit == player) then
                    {
                        // If we've changed groups since last check, discard our existing team
                        private "_last_group";
                        _last_group = player getVariable ["ST_STHud_lastGroup", grpNull];
                        if (group(player) != _last_group) then
                        {
                            _last_group = group(player);
                            player setVariable ["ST_STHud_lastGroup", _last_group, false];
                
                            // TODO: Should we broadcast this or just let the clients figure
                            // this out independently?
                            _unit setVariable [HUD_ASSIGNEDTEAM, "MAIN", true];
                            _assigned_team = "MAIN";
                        };
                    };
                    _assigned_team;
                };
                
                FN_TG_SQUAD_UI_MAPMARKERS =
                {    
                    private ["_marker","_markerNumber", "_markerName", "_getNextMarker","_vehicle", "_str", "_txt"];
                    _getNextMarker = //Helping function to create or update position of the marker.
                    {
                        private ["_marker"];
                
                        _markerNumber = _markerNumber + 1;
                        _marker = format["um%1",_markerNumber];
                
                        if(getMarkerType _marker == "") then {createMarkerLocal [_marker, _this];}
                        else                                         {_marker setMarkerPosLocal _this;};
                
                        _marker;
                    };
                
                    while {true} do //The Main loop
                    {
                        waitUntil {sleep 1;    (visibleMap or visibleGPS);}; //wait until map or gps is open
                        _markerNumber = 0;
                
                        _occupiedVics = [];    
                        {
                            _vehicle = vehicle _x;            
                
                            if(_vehicle != _x) then    //if the _x is in a vehicle create a listed names in there.
                            {            
                                if (!(_vehicle in _occupiedVics)) then {_occupiedVics pushBack _vehicle;};
                            }
                            else
                            {
                                _pos = getPosATL _vehicle;
                                _txt = name _x;
                                _marker = _pos call _getNextMarker;                
                                _colorName = "ColorBrown";
                                _markerType = "mil_dot";
                                _markerSize = 0.4;
                
                                if ( _x in (units group player)) then
                                {
                                    _markerType = "mil_dot";
                
                                    if (_x == leader player) then
                                    {                        
                                        _markerType = "mil_circle";
                                        _markerSize = 0.5;
                                    };                
                
                                    switch (_x call ST_STHud_assignedTeam) do
                                    {
                                        case "MAIN":     {_colorName = "Default";};
                                        case "RED":     {_colorName = "ColorRed";};
                                        case "GREEN": {_colorName = "ColorGreen";};
                                        case "BLUE":     {_colorName = "ColorBlue";};
                                        case "YELLOW":{_colorName = "ColorYellow";};
                                        default        {_colorName = "Default";};
                                    };
                                }
                                else
                                {
                                    if (_x == (leader group _x)) then
                                    {
                                        _markerType = "mil_box";
                                        _markerSize = 0.5;
                                        _txt = format["%1 [%2]", name(leader _x), groupID (group _x)];
                                    };                        
                                };
                
                                if(!visibleGPS || visibleMap) then{_marker setMarkerTextLocal _txt;} else {_marker setMarkerTextLocal "";};
                
                                _marker setMarkerColorLocal _colorName;
                                _marker setMarkerTypeLocal _markerType;
                                _marker setMarkerSizeLocal [_markerSize, _markerSize];
                            };            
                        } forEach playableUnits;
                
                        {
                            _aVic = _x;
                            _str = ""; _txt = "";        
                
                            {
                                if(_foreachindex == ((count (crew (vehicle _x))) - 1)) then
                                {
                                    _str = format["%1",name _x];    
                                }    
                                else
                                {
                                    _str = format["%1, ",name _x];
                                };                
                                _txt = _txt + _str;
                            }forEach crew (_aVic);
                
                            _pos = getPosATL _aVic;
                            _marker = _pos call _getNextMarker;
                            if(!visibleGPS || visibleMap) then{_marker setMarkerTextLocal _txt;} else {_marker setMarkerTextLocal "";};
                            _marker setMarkerColorLocal "ColorOrange";
                            _marker setMarkerSizeLocal [0.7, 0.7];
                            _marker setMarkerTypeLocal "n_inf";
                        }forEach _occupiedVics;    
                
                        _markerNumber = _markerNumber + 1;
                        _marker = format["um%1",_markerNumber];    
                
                        while {(getMarkerType _marker) != ""} do
                        {    
                            deleteMarkerLocal _marker;
                            _markerNumber = _markerNumber + 1;
                            _marker = format["um%1",_markerNumber];
                        };        
                    };
                };
                
                [] spawn ST_STHud_AssignedTeamWatcher;
                [] spawn FN_TG_SQUAD_UI_MAPMARKERS;

                Comment

                Connect

                Collapse

                TeamSpeak 3 Server

                Collapse

                Advertisement

                Collapse

                Twitter Feed

                Collapse

                Working...
                X