Name Tags Script(LYGD_NameTags)
by Loyalguard
UPDATE: This project has been overcome by events and is no longer under development. It is fully functional however and can be used as is.
OverviewThe Name Tags Script provides an alternative method to recognize and identify a player's teammates from the default "friendly tags" used by ArmA with the goal to make recognizing teammates as realistic and easy as possible. The Name Tags Script works completely independently of the mode of difficulty (cadet or veteran) and related settings so they can be seen even when ArmA tags cannot.
Features-Pressing the space bar momentarily displays the name of the teammate you are facing (key is customizable).
-Names are only shown for teammates within 25m (value is customizable).
-Recognition range is reduced to 5m for teammates facing more than 90 degrees away from you.
-Only displays names for units on your side (West, East, Civilian).
-100% scripting with no addon dependencies.
-Fully single and multiplayer compatible.
-Demo mission included.
Limitations-Does not work in freelook. You will still only see names of teammates that your body is facing, not your head.
-You cannot recognize teammates while they are in a vehicle.
-Does not work well while player is in a vehicle as name tags are only displayed at certain angles/directions.
-Tags still appear for teammates that would normally be out of your field of vision (behind a wall, vehicle, other opaque object) but within visual range (25m).
Demo Video:
Name Tags Script v 0.1.5 (Beta) Demo Video at YouTube
Beta Change Logv 0.2-Added mission maker option to display an "Unknown" tag for friendly units that are in range but facing away from the player.
-Made adjustments to avoid possible unwanted infinite loops.
v 0.1.5-Initial Open Beta Release.
Mission Maker Instructions1. Copy the "LYGD_NameTags" sub-folder into your mission folder.
2. Insert the following lines into your init.sqf:
sleep 1;
(findDisplay 46) displaySetEventHandler ["KeyUp", "_nil = _this execVM""LYGD_NameTags\LYGD_NameTags.sqf"""];
3. Review the LYGD_NameTags.sqf file for mission maker customization options.
Player InstructionsIf a mission maker has included the Name Tags script in his/her mission, while facing a teammate, press the space bar. If the teammate is within visual range and does not have too much of their back to you a name tag for that unit will appear on the screen momentarily. To view it again or view another teammates name adjust your mouse as appropriate and press the space bar again.
Script ApplicationsWith ArmA's default friendly tags enabled you can "recognize" players well beyond visual recognition range. With them disabled you cannot recognize fellow players right in front of your face whereas in real life you most likely would be able to (facial features, gait, clothing, etc.) The goal of the Name Tags Script is to attempt to bridge this gap.
Specific Testing ObjectivesDuring this testing phase I am trying to accomplish the following:
1) Re-verify it is fully MP/SP compatible (It has been tested in a multi-client dedicated server and in SP mode by me).
2) Determine how useful the script is to mission makers.
3) Determine effectiveness of how the name tags are displayed (as cut texts).
4) Determine the ease of including the script into a mission.
5) Determine The ease of use for players in-game and possible better ways to activate.
6) Find any means of optimizing code or script execution.
7) Consider the practicality of converting this script into an addon for more universal use across missions (not my primary objective or area of interest but worthy of consideration).
How It WorksFor a detailed description of the mechanics of the script please read on:
An event hander to monitor key presses is created in the init.sqf. When a key is pressed it launches the LYGD_NameTags.sqf.
When the LYGD_NameTags.sqf launches it checks to see if the key pressed was the space bar. If not, the script exits. Otherwise, a for-do block is begun that conducts a series of short successive nearestObjects searches. Each "search" only looks for objects within a one meter radius centered along the vector of where the player is facing. Each loop begins a new search 2m further away from the player than the previous search. For a visualization of this process see Unit Searches.jpg file included in the download.
If a "man" class object is not detected, then the for-do loop continues, otherwise a series of additional conditions are applied to see if a name tag should be displayed. If the "man" is not on the same side as the player, the loop is exited and the search range reset to 1m without displaying a name tag. If the "man" is facing at more than a 90 degree angle away from the player and is more than 5m away then the loop is exited and the search range reset to 1m without displaying a name tag (for more on the 25m and 5m ranges used by the script see "Visual Range" in "Special Notes and Considerations" below. Finally, if the "man" is not actually the player (sometimes the player can actually be detected when the search loop first begins) then a name tag showing the name of the player is displayed momentarily as a cut text in the center of the player's field of vision (i.e. on the teammate).
Once the loop is complete the script exits and the event handler awaits the next keypress.
AcknowledgmentsThe creator would like to thank the following individuals for their direct or indirect help in making this script possible:
-Spooner from OFPEC.com who provided insight into various scripting methods and concepts required for this script. Spooner's SPON_Recognise script was a major inspiration for the Name Tags Script.
-Mandoble from OFPEC whose mando_drawing scripts gave me insights on how to utilize the event handler and vector commands that are the foundation of the Name Tags Script.
-LeeHunt at OFPEC for his feedback and suggestions
-Dslyecxi from Shack Tactical whose insight on the different applications for name tags in ArmA was helpful in developing this script.
-TacticalGamer.com for their continual support of my editing projects and for beta testing.