It is currently Fri Dec 14, 2018 3:23 pm

All times are UTC




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Mon Nov 26, 2018 5:19 pm 
Offline

Joined: Wed Feb 15, 2012 2:03 pm
Posts: 1083
Location: Derby, United Kingdom
Please use this thread for suggestions/improvements to our nametags script. If you make any changes please post them so we can all benefit.

Thanks to BIS for the foundation function!

Code as of 26/11/18
Code:
params ["_alphaDistance","_freelookAlpha"];
private "_distance";

_height = 2;
{
    if (freelook) then {_distance = _freelookAlpha} else {_distance = _alphaDistance};
    _dist = (player distance _x) / _distance;
    _color = [1,1,1,1];
    private "_color2";

    if (_x in units (group player)) then {
      _color2 = [0.408,0.827,0.165,1];
    } else {
      _color2 = [0.29,0.522,0.886,1];
    };

    private "_position";
    switch (stance _x) do {
      case "STAND" : {_position = _x modelToWorldVisual [0,0,1.9]};
      case "CROUCH" : {_position = _x modelToWorldVisual [0,0.3,1.3]};
      case "PRONE" : {_position = _x modelToWorldVisual [0,0.7,0.6]};
      default {_position = _x modelToWorldVisual [0,0,2]};
    };

    _color set [3, 1 - _dist];
    _color2 set [3, 1 - _dist];

    drawIcon3D
    [
    "",
    _color,
    _position,
    2,
    -1.40,
    0,
    name _x,
    1,
    0.05,
    "PuristaBold",
    "Center"
    ];

    drawIcon3D
    [
    "",
    _color2,
    _position,
    2,
    0.20,
    0,
    //,
    if (roleDescription _x == "") then {
      format ["%1 - %2",getText (configfile >> "CfgVehicles" >> typeOf (vehicle _x) >> "displayName"), groupID (group _x)];
    } else {
      format ["%1 - %2",roleDescription _x, groupID (group _x)],
    },
    2,
    0.03,
    "PuristaSemiBold",
    "Center"
    ];
} forEach ((playableUnits) select {alive _x && side group _x == side group player && (vehicle _x == _x || (effectiveCommander (vehicle _X))== _x)});


Mission attached.


Attachments:
tags.VR.zip [2.71 KiB]
Downloaded 1 time

_________________
|N7|
AVDENTES FORTVNA IVVAT
Top
 Profile  
 
PostPosted: Sun Dec 02, 2018 10:10 pm 
Offline
User avatar

Joined: Tue Feb 14, 2012 7:10 pm
Posts: 756
Location: NI
can we try a smaller font

at distance to 5m for it to appear

and also a toggle key for enable and disable

_________________
ImageImageImageImageImageImage
Image Image
.


Top
 Profile  
 
PostPosted: Fri Dec 07, 2018 7:10 pm 
Offline

Joined: Wed Feb 15, 2012 2:03 pm
Posts: 1083
Location: Derby, United Kingdom
Updated

Code:
params ["_alphaDistance"];
private "_distance";

_height = 2;
{
    if (freelook) then {
      _dist = (player distance _x) / _alphaDistance;
      _color = [1,1,1,1];
      private "_color2";

      if (_x in units (group player)) then {
        _color2 = [0.29,0.522,0.886,1]; //Blue
      } else {
        _color2 = [1,0.75,0,1]; //Orange
      };

      private "_position";
      switch (stance _x) do {
        case "STAND" : {_position = _x modelToWorldVisual [0,0,1.9]};
        case "CROUCH" : {_position = _x modelToWorldVisual [0,0.3,1.3]};
        case "PRONE" : {_position = _x modelToWorldVisual [0,0.7,0.6]};
        default {_position = _x modelToWorldVisual [0,0,2]};
      };

      _color set [3, 1 - _dist];
      _color2 set [3, 1 - _dist];

      drawIcon3D
      [
      "",
      _color,
      _position,
      2,
      -1.40,
      0,
      name _x,
      2,
      0.04,
      "PuristaBold",
      "Center"
      ];

      drawIcon3D
      [
      "",
      _color2,
      _position,
      2,
      0.05,
      0,
      //,
      if (roleDescription _x == "") then {
        format ["%1 - %2",getText (configfile >> "CfgVehicles" >> typeOf (vehicle _x) >> "displayName"), groupID (group _x)];
      } else {
        format ["%1 - %2",roleDescription _x, groupID (group _x)],
      },
      2,
      0.025,
      "PuristaSemiBold",
      "Center"
      ];
    };
} forEach ((playableUnits) select {alive _x && side group _x == side group player && (vehicle _x == _x || (effectiveCommander (vehicle _X))== _x)});

_________________
|N7|
AVDENTES FORTVNA IVVAT


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group