Jump to content
Sign in to follow this  
Guest

Player names above head?

Recommended Posts

Guest

There was a script I came across ages ago that displayed players names above their head in multiplayer. I've been searching for it for the last half hour but can't find it:confused:

Does anyone know where I could get the script? Cheers

Share this post


Link to post
Share on other sites

It wont follow the unit that's the issue :( I have yet to get the solution :/

Share this post


Link to post
Share on other sites

This is what I use for character tags. Someone on the forum took it from the second PMC mission and edited it slightly, I can't remember who it was.

Tags.hpp

//--- Character introduction

_playerID = [1,0] select (player == player);

_names =

["<t color=#cccccc' size='0.8' valign='top' font='TahomaB'>SGT. Petrov</t><br /><t color='#DC143C' size='0.4' font='Zeppelin33Italic'> Squad Leader</t>",

"<t color='#cccccc' size='0.8' valign='top' font='TahomaB'> LT. Glebov</t><br /><t color='#DC143C' size='0.4' font='Zeppelin33Italic'>Patrol Commander</t>"];

{

_info = localize format ["",_playerID,vehiclevarname _x];

//_info = localize format ["STR_PMC_CP01_INFO_%1_%2",_playerID,vehiclevarname _x];

_x setvariable [

"BIS_info",

format ["<t align='left'>%1<br /><t size='0.5'>%2</t></t>",_names select _forEachIndex,_info]

];

}

foreach [u1, u2];

[] spawn {scopename "CP01: Character info";

sleep 0.1;

if (bis_contact) exitwith {};

disableserialization;

21 cutrsc ["rscDynamicText","plain"];

#define DISPLAY (uinamespace getvariable "BIS_dynamicText")

#define CONTROL (DISPLAY displayctrl 9999)

_w = 1;//0.5;

_h = 1;//0.3;

CONTROL ctrlsetposition [

0,

0,

_w,

_h

];

CONTROL ctrlsetfade 1;

CONTROL ctrlcommit 0;

while {!BIS_contact} do {

_target = cursortarget;

if (!isnull _target && !visiblemap) then {

_pos = [getposatl _target select 0,getposatl _target select 1,(getposatl _target select 2) + 1.5];

_pos2D = worldtoscreen _pos;

_text = _target getvariable "BIS_info";

if (count _pos2D > 0 && !isnil "_text") then {

CONTROL ctrlsetposition [

(_pos2D select 0)+0.1,

(_pos2D select 1),

_w,

_h

];

CONTROL ctrlsetstructuredtext parsetext _text;

CONTROL ctrlsetfade 0;

CONTROL ctrlcommit 0.01;

} else {

CONTROL ctrlsetfade 1;

CONTROL ctrlcommit 0.1;

};

} else {

CONTROL ctrlsetfade 1;

CONTROL ctrlcommit 0.1;

};

sleep 0.01;

};

21 cuttext ["","plain"];

Run from init.sqs with #include "Tags.hpp"; BIS_Contact needs to be set False in init.

This version isn't practical for large numbers of players like you need Kolmain, because every player and their text would need to be defined. You could probably edit it so it automatically displays the player's name, I'm not sure how though.

Share this post


Link to post
Share on other sites

If I wanted to execute multiple ones of these where do I edit the unit to attach it to?

Share this post


Link to post
Share on other sites

Where I highlighted [u1,u2] in red. But you will also need to manually define what text will appear, in the _names section. That's why it's not efficient for large numbers of units.

EDIT

Hold up, I got it:

//--- Character introduction

_playerID = [1,0] select (player == player);

{

_x setvariable [

"BIS_info",

format ["<t color='#cccccc' size='0.8' align='left' font='TahomaB'>%1</t><br />",name _x]

];

}

foreach switchableunits;

[] spawn {scopename "CP01: Character info";

sleep 0.1;

if (bis_contact) exitwith {};

disableserialization;

21 cutrsc ["rscDynamicText","plain"];

#define DISPLAY (uinamespace getvariable "BIS_dynamicText")

#define CONTROL (DISPLAY displayctrl 9999)

_w = 1;//0.5;

_h = 1;//0.3;

CONTROL ctrlsetposition [

0,

0,

_w,

_h

];

CONTROL ctrlsetfade 1;

CONTROL ctrlcommit 0;

while {!BIS_contact} do {

_target = cursortarget;

if (!isnull _target && !visiblemap) then {

_pos = [getposatl _target select 0,getposatl _target select 1,(getposatl _target select 2) + 1.5];

_pos2D = worldtoscreen _pos;

_text = _target getvariable "BIS_info";

if (count _pos2D > 0 && !isnil "_text") then {

CONTROL ctrlsetposition [

(_pos2D select 0)+0.1,

(_pos2D select 1),

_w,

_h

];

CONTROL ctrlsetstructuredtext parsetext _text;

CONTROL ctrlsetfade 0;

CONTROL ctrlcommit 0.01;

} else {

CONTROL ctrlsetfade 1;

CONTROL ctrlcommit 0.1;

};

} else {

CONTROL ctrlsetfade 1;

CONTROL ctrlcommit 0.1;

};

sleep 0.01;

};

21 cuttext ["","plain"];

};

Now displays the name of any switchable (playable in SP) unit. Change foreach switchableunits; to foreach playableunits; in MP.

Edited by 2nd Ranger

Share this post


Link to post
Share on other sites

So it displays the unit name? Based on identity? And JIP?

Edited by Kolmain

Share this post


Link to post
Share on other sites

It displays whatever the unit's name is, yes. Don't know about JIP. If you run it from init.sqs as I suggested then it should probably work.

Share this post


Link to post
Share on other sites
It displays whatever the unit's name is, yes. Don't know about JIP. If you run it from init.sqs as I suggested then it should probably work.

2nd Ranger

Thanks. I will test this on my server the JIP and report back.

Question.

how do you set the colours?

I see

format ["<t color='#cccccc' size='0.8' align='left' font='TahomaB'>%1</t><br />",name _x]

];

Is it buried in there some where?

Thanks.

Share this post


Link to post
Share on other sites

Yeah it's <t color='#cccccc'

HTML colours. #cccccc is the colour code. You can google an HTML colour chart to find the right code.

Share this post


Link to post
Share on other sites

I know all AAS (Advance And Secure) maps have green friendly tags that you can adjust from 10m to 1500m and are displayed in all direction. Not just when you are looking right at them. I have looked at their scripts and can not figure out how they did it. But the scripting is there and can be done if there is some one that good with scripting that can make a stand alone script to be added to any mission.

Sorry can't be more help. Hope someone looks into the script and figures it out.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×