Home   Help Search Login Register  

Author Topic: Name Tags Script (OBSOLETE)  (Read 2805 times)

0 Members and 1 Guest are viewing this topic.

Offline Loyalguard

  • Former Staff
  • ****
Name Tags Script (OBSOLETE)
« on: 29 Dec 2007, 21:18:24 »
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.

Overview
The 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 VideoName Tags Script v 0.1.5 (Beta) Demo Video at YouTube

Beta Change Log

v 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 Instructions
1. Copy the "LYGD_NameTags" sub-folder into your mission folder.
 
2. Insert the following lines into your init.sqf:
 
Code: [Select]
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 Instructions
If 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 Applications
With 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 Objectives
During 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 Works
For 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.
 
Acknowledgments
The 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.
« Last Edit: 01 Feb 2008, 17:37:09 by Loyalguard »

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Name Tags Script (TESTING)
« Reply #1 on: 30 Dec 2007, 18:14:01 »
I'm sure this idea will help a lot in multiplayer (similar to the name tag recognition in Battlefield 2)-- of course now i have a few suggestions and ideas:

The names did come up several times, but not always with friendly forces and I know that its based on the angles and distances etc, but if identification "fails" can that come up as a result?

Also can the player recognize say "OPFOR" since he would not know the bad guy's name?  Or do you want to make it so that enemies are not recognized in any way? (i understand that too)

Offline Loyalguard

  • Former Staff
  • ****
Re: Name Tags Script (TESTING)
« Reply #2 on: 30 Dec 2007, 20:55:36 »
Lee-

Thanks for your comments!

Regarding "failed" searches, I initially had "UNK" appear on the screen when a unit was facing away from a player but took it out as I thought it might be too arcadish.  But, I can see where it is nice to get some visual indicator to at least let you know the script worked.  I will look at perhaps making it a mission maker option to enable an "unknown" tag to appear for friendly units that are out of range or facing away.

Regarding OPFOR, this is something I don't want to include since my script is only really meant to replace "friendly" tags and I don't want it to be an aid to detect if someone is friendly or not, only allow you to ID friendly players when tags are turned off.

Thanks for your suggestions!


Offline Loyalguard

  • Former Staff
  • ****
Re: Name Tags Script (TESTING)
« Reply #3 on: 31 Dec 2007, 14:45:34 »
UPDATED: Version 0.2 (Beta) Released.  See Changelog for details.  Link in first post updated.

v 0.2 Changelog
-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.

I have incorporated Lee's suggestion to allow the possibility to see an "Unknown" tag when a friendly unit is in range but facing away from the player.  I also adjusted the exitWith commands to ensure that no unwanted infinite loops occur. (caused when there is a non-friendly or unrecognizable friendly unit in the player's LOS but player has not moved the mouse).

Offline LeeHunt

  • Former Staff
  • ****
  • John 21:25
Re: Name Tags Script (TESTING)
« Reply #4 on: 05 Jan 2008, 17:53:31 »
hi i tried v.2 and didn't see the "unknown" tag come up? 

Offline Loyalguard

  • Former Staff
  • ****
Re: Name Tags Script (TESTING)
« Reply #5 on: 06 Jan 2008, 00:10:09 »
Lee-

By default it is off.  I wanted to leave it up to the mission maker.  To turn it on open the mission folder and then the LYGD_NameTags folder.  Then open the LYGD_NameTags.sqf file and under "Customizable Options" change _displayUNK to true (default is false) Example:

Code: [Select]
_displayUNK = true;
Then "Unknown" should appear for all friendlies within 25m but with their back towards the player.

I hope that helps!