Jump to content
csepi0101

HOW TO SHOW ID NUMBERS OF TEAM MEMBERS ON MAP

Recommended Posts

UPDATE:
Problem solved by "pierremgi"
Copy his code to initplayer.sqf in your mission folder.

MGI_fnc_nbr = compileFinal "
  private ['_vvn', '_str'];
  _str0 =' ';
  _veh = vehicle _this;
  for '_i' from 0 to count crew _veh - 1 do {
    _vvn = vehicleVarName (crew _veh select _i);
    (crew _veh select _i) setVehicleVarName '';
    _str = str (crew _veh select _i);
    (crew _veh select _i) setVehicleVarName _vvn;
    _str0 = _str0 +' '+(_str select [(_str find ':') + 1,2]);
    _str0
  };
";

waitUntil {sleep 1; !isNull (findDisplay 12 displayCtrl 51)};  // main map available

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
  _map = _this select 0;
  if (ctrlMapScale _map <0.03 && {difficultyOption "mapContentFriendly" == 1 or difficultyOption "mapContent" == 1}) then {
    {
      _map drawIcon [
        "#(rgb,1,1,1)color(1,1,1,1)",
        [[playerside,false] call BIS_fnc_sideColor,[0.9,0.7,0.6,1]] select (_x in groupSelectedUnits player),
        getPosVisual _x,
        0,0,0, _x call MGI_fnc_nbr, 0,0.04,"TahomaB","right"
      ];
    } forEach (units player select {_x == effectiveCommander vehicle _x});
  };
}];


MY ORIGINAL QUESTION:
Not name ,not icon,simple NUMBER.

I use the "C2" addon because of this function,but big cpu eater,need a very simple script instead of this.
thanks
 

Share this post


Link to post
Share on other sites

What number?

Share this post


Link to post
Share on other sites
16 hours ago, Harzach said:

What number?

like this,in this picture,simple numbers of teammates
https://www.dropbox.com/s/vco7ohn39363z1a/ArmA%203%20Screenshot%202019.07.04%20-%2018.51.50.40.png?dl=0

Share this post


Link to post
Share on other sites

This picture is one of my screenshot (Kobayashi Maru is my profile's name).

I did that for one of the feature of one of my module.

So, you can subscribe the light addon MGI Advanced Modules:

https://steamcommunity.com/sharedfiles/filedetails/?id=1682280809

then place the Terrain & map interactive module on map ,and tick the Units: nbr/trait on map.  There is no impact on resource. You can load the whole addon. All functions are working only if necessary, without useless codes and loops.

 

I can give you the code, without the trait icons):

 

In a scheduled environment,   initPlayerLocal.sqf does the trick


 

MGI_fnc_nbr = compileFinal "
  private ['_vvn', '_str'];
  _str0 =' ';
  _veh = vehicle _this;
  for '_i' from 0 to count crew _veh - 1 do {
    _vvn = vehicleVarName (crew _veh select _i);
    (crew _veh select _i) setVehicleVarName '';
    _str = str (crew _veh select _i);
    (crew _veh select _i) setVehicleVarName _vvn;
    _str0 = _str0 +' '+(_str select [(_str find ':') + 1,2]);
    _str0
  };
";

waitUntil {sleep 1; !isNull (findDisplay 12 displayCtrl 51)};  // main map available

findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
  _map = _this select 0;
  if (ctrlMapScale _map <0.03 && {difficultyOption "mapContentFriendly" == 1 or difficultyOption "mapContent" == 1}) then {
    {
      _map drawIcon [
        "#(rgb,1,1,1)color(1,1,1,1)",
        [[playerside,false] call BIS_fnc_sideColor,[0.9,0.7,0.6,1]] select (_x in groupSelectedUnits player),
        getPosVisual _x,
        0,0,0, _x call MGI_fnc_nbr, 0,0.04,"TahomaB","right"
      ];
    } forEach (units player select {_x == effectiveCommander vehicle _x});
  };
}];

 

This code is persistent with respawn condition, but not with saved/resumed mission.

You need to reload this event handler when resuming the game. If you know how to make a function, the MEH "loaded" (preinit) works fine for SP save and resume.

In MP, the code is not supposed to run when resuming a mission (MEH "loaded" doesn't work).

 

 

 

  • Like 2

Share this post


Link to post
Share on other sites
24 minutes ago, pierremgi said:

This picture is one of my screenshot

 

I was looking for a way to return a unit's position number/ID and that thread was the first hit 😄

 

Share this post


Link to post
Share on other sites
On 5/8/2022 at 8:51 PM, pierremgi said:

This picture is one of my screenshot (Kobayashi Maru is my profile's name).

I did that for one of the feature of one of my module.

So, you can subscribe the light addon MGI Advanced Modules:

https://steamcommunity.com/sharedfiles/filedetails/?id=1682280809

then place the Terrain & map interactive module on map ,and tick the Units: nbr/trait on map.  There is no impact on resource. You can load the whole addon. All functions are working only if necessary, without useless codes and loops.

 

I can give you the code, without the trait icons):

 

In a scheduled environment,   initPlayerLocal.sqf does the trick

 

thanks for this solution

the name "Pierremgi" is very familiar,
Possible I'm using some of mod what you did

"The mgi advanced modules" are too many for me,
I have a good selection of  mods,only specifics ,what i need.

Single player nr6 on Lib44's original Baranow map, with asrAI, Project-Injury-Reaction, and about 8 other small mods, character movement, weapon holding, weapon movement, tracers, towing, AI character random speech,time acceleration, etc ...

Not want any complex big scripts,need the simplest possible solution

what it means,In a "scheduled environment",inside a looped script?

 

eg could I not assign an editable-text-marker to the soldiers on the map?

Share this post


Link to post
Share on other sites

The MGI advanced modules is light (less than 2 Mo). As said, you can use just a module (or a part of module) without impact on your performance. It's like any larger BI or DLC/modded function library (Warlords, Apex,...existing on your PC: You run only what you are using). Furthermore, functions are better than any script you'll add in your scenario.

 

Anyway, I gave you a replacement code you can add to initPlayerLocal.sqf which is an event script (so autorun as init.sqf). That's already a scheduled environment.

 

This code is the "simplest solution". (The module gives you more: icons for main traits of units like medic, engineer, explosive specialist, because you can customize these traits on units).

 About  the code, you can simplify the color things : your unique color instead of same color as side and specific color for selected units. There is also a condition for map scale (you need to zoom in for displaying the icons), because that can be ugly and counter-producible at large scale. I suggest you don't remove it, but you can test without:  ctrlMapScale _map <0.03 &&

Same for the rest of the condition about difficulty option, if you want a number even if there is no icon displayed on map for unit.

 

For editable text marker, it's up to you for creating marker, then moving it at the right place in real time, with the good text and the good scale. Perhaps someone else will spend time for this solution. Not me.

Share this post


Link to post
Share on other sites
16 hours ago, pierremgi said:

 

you are a real professional

you typed quickly first the perfect solution

I could have simply copied it but the "scheduled environment" was confusing


there are 1-2 real useful things in your mod

for example the taxi option, question what would the AI commander HAL say if I ordered one of his units to transport me from A to B  🙂

these are multiplayer props, but i only play in singleplayer, but i could play multiplayer, my net is fast my machine is fast,  but still, i'm a player of old times,i love the relaxed single player games,campaigns,HAL type games ,on a map and in an customized environment what I want

 

another theme:

if you are very bored, you could do a revolutionary innovation, which I think does not yet exist I earned a lot but nowhere

i think the characters should have an idle animation for now they are like statues

i don't know the game-engine gives you this option or not, they would have already done it I think if it had been possible,it would probably need to go deep into the tribe of main-code,
it would have been done by someone a long time ago if this is easy

Share this post


Link to post
Share on other sites
On 5/11/2022 at 9:58 PM, csepi0101 said:

 i could play multiplayer, my net is fast my machine is fast,  but still, i'm a player of old times,i love the relaxed single player games,campaigns,HAL type games ,on a map and in an customized environment what I want

 

The fact is you can launch in multiplayer LAN session for yourself and benefit of all mission parameters. That's what i suggest in my scenarii. For examples : arsenal crates, time acceleration, stamina/fatigue... revive/heal and more, all become easily optional (from parameters in lobby).

 

On 5/11/2022 at 9:58 PM, csepi0101 said:

if you are very bored, you could do a revolutionary innovation, which I think does not yet exist I earned a lot but nowhere

i think the characters should have an idle animation for now they are like statues

i don't know the game-engine gives you this option or not, they would have already done it I think if it had been possible,it would probably need to go deep into the tribe of main-code,
it would have been done by someone a long time ago if this is easy

 

Just use getAnimSpeedCoef  on the units you want.

 

Share this post


Link to post
Share on other sites
On 5/14/2022 at 5:50 PM, pierremgi said:

Just use usetAnimSpeedCoef  on the units you want.

 

 

you got it wrong,i not think about animation speed,but the characters don't have idle animations, eg they look at their watch, scratching, stand from one leg to other leg, they look into the distance, they look at the ground,a lot could be found to they look more human

 

another question,another theme:
how to add a random number between 5 and 15 to this cordinates:
{ (vehicle _x) setPos [6447,4788,0]; } forEach thisList;

 

thanks

Share this post


Link to post
Share on other sites
21 minutes ago, csepi0101 said:

 

you got it wrong,i not think about animation speed,but the characters don't have idle animations, eg they look at their watch, scratching, stand from one leg to other leg, they look into the distance, they look at the ground,a lot could be found to they look more human

 

You just need to wait a little time (20 or 30 sec, looking at them) There are already vanilla animations for units standing without destination.

  • Like 1

Share this post


Link to post
Share on other sites

In order to get a random number in a specified range you can do

// I declare the maximum and minimum values as parameters
// You may get them from somewhere else though
private _maxNum = 15; // Maximum value
private _minNum = 5; // Minimum value

// Get a random number between 0 and the value declared in the brackets
private _randNum = random [_maxNum - _minNum]; // Get a number between 0 (inclusive) and 15 - 5 = 10 (exclusive)
_randNum = _randNum + _minNum; // Add the minimum value (5 in this case) to the random number to move it into the desired range 0 - 10 -> 5 - 15

// _randNum now hold a random (floating point) value between 5 (inclusive) and 15 (exclusive)

So, you could just put the random value in a variable and use it in your expression. Alternatively you can call the code 3 times and save the values in three variables if you want to add a different random value to each dimension separately.

 

EDIT: I just realised you have posted the same question in a different thread, so disregard this answer...

  • Like 1

Share this post


Link to post
Share on other sites
2 hours ago, ZaellixA said:

In order to get a random number in a specified range you can do


// I declare the maximum and minimum values as parameters
// You may get them from somewhere else though
private _maxNum = 15; // Maximum value
private _minNum = 5; // Minimum value

// Get a random number between 0 and the value declared in the brackets
private _randNum = random [_maxNum - _minNum]; // Get a number between 0 (inclusive) and 15 - 5 = 10 (exclusive)
_randNum = _randNum + _minNum; // Add the minimum value (5 in this case) to the random number to move it into the desired range 0 - 10 -> 5 - 15

// _randNum now hold a random (floating point) value between 5 (inclusive) and 15 (exclusive)

So, you could just put the random value in a variable and use it in your expression. Alternatively you can call the code 3 times and save the values in three variables if you want to add a different random value to each dimension separately.

 

EDIT: I just realised you have posted the same question in a different thread, so disregard it...

Thanks
how good for the person when the syntax is coming from routine,he can make anything he can figure 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

×