SirBassi 10 Posted May 8, 2023 Hello everyone, as a non-trained programmer but a motivated mission builder, I am contacting you again today with a small problem in which I am sure I am just missing a small thing. Background: I have a trait switcher in the mission where players can select a role as Medic, Engineer or Explosive Specialist. These roles are limited. I would like to set up a billboard next to the role switcher that shows which player currently has which role or which roles are actual unused. My problem: When I test in Selfhost MP, after a selected role, it gives me the role description that is stored on the slot instead of my player / profile name. In another Testplayer sot, it brings me the correct player / profile name of me but still with the current group, which is not needed and does not look good in terms of space / layout. Since my native language is German, a short explanation: String "unbesetzt" means "actually unused". Any dedicated requirements have not yet been checked, first of all everything should work. I hope that I haven't made any major mistakes from the performance side, even if there is certainly a more elegant way, but I'm glad to have created a working basis for now. Following script is actually called in init.sqf by execVm: Spoiler while {true} do { _allplayers = allPlayers - entities "HeadlessClient_F"; _medics = _allPlayers select {_x getUnitTrait "medic"}; _explospecialist = _allplayers select {_x getUnitTrait "explosiveSpecialist"}; _engineer = _allplayers select {_x getUnitTrait "engineer"}; _medic1 = _medics select 0; _medic1 = if ( isNil "_medic1" ) then {_medics pushBack "unbesetzt"} else { name (_medics select 0)}; _medic1 = _medics select 0; _medic2 = _medics select 1; _medic2 = if ( isNil "_medic2" ) then {_medics pushBack "unbesetzt"} else { name (_medics select 1)}; _medic2 = _medics select 1; _medic3 = _medics select 2; _medic3 = if ( isNil "_medic3" ) then {_medics pushBack "unbesetzt"} else { name (_medics select 2)}; _medic3 = _medics select 2; _medic4 = _medics select 3; _medic4 = if ( isNil "_medic4" ) then {_medics pushBack "unbesetzt"} else { name (_medics select 3)}; _medic4 = _medics select 3; _medic5 = _medics select 4; _medic5 = if ( isNil "_medic5" ) then {_medics pushBack "unbesetzt"} else { name (_medics select 4)}; _medic5 = _medics select 4; _medic6 = _medics select 5; _medic6 = if ( isNil "_medic6" ) then {_medics pushBack "unbesetzt"} else { name (_medics select 5)}; _medic6 = _medics select 5; _explosivespec1 = _explospecialist select 0; _explosivespec1 = if ( isNil "_explosivespec1" ) then {_explospecialist pushBack "unbesetzt"} else { name (_explospecialist select 0)}; _explosivespec1 = _explospecialist select 0; _explosivespec2 = _explospecialist select 1; _explosivespec2 = if ( isNil "_explosivespec2" ) then {_explospecialist pushBack "unbesetzt"} else { name (_explospecialist select 1)}; _explosivespec2 = _explospecialist select 1; _engineer1 = _engineer select 0; _engineer1 = if ( isNil "_engineer1" ) then {_engineer pushBack "unbesetzt"} else { name (_engineer select 0)}; _engineer1 = _engineer select 0; _engineer2 = _engineer select 1; _engineer2 = if ( isNil "_engineer2" ) then {_engineer pushBack "unbesetzt"} else { name (_engineer select 1)}; _engineer2 = _engineer select 1; _engineer3 = _engineer select 2; _engineer3 = if ( isNil "_engineer3" ) then {_engineer pushBack "unbesetzt"} else { name (_engineer select 2)}; _engineer3 = _engineer select 2; _engineer4 = _engineer select 3; _engineer4 = if ( isNil "_engineer4" ) then {_engineer pushBack "unbesetzt"} else { name (_engineer select 3)}; _engineer4 = _engineer select 3; _engineer5 = _engineer select 4; _engineer5 = if ( isNil "_engineer5" ) then {_engineer pushBack "unbesetzt"} else { name (_engineer select 4)}; _engineer5 = _engineer select 4; _engineer6 = _engineer select 5; _engineer6 = if ( isNil "_engineer6" ) then {_engineer pushBack "unbesetzt"} else { name (_engineer select 5)}; _engineer6 = _engineer select 5; call compile format ['monitor setObjectTexture [0,"#(rgb,512,512,3)text(1, 1,""EtelkaMonospacePro"", 0.045, ""#FFFFFF00"", ""#FFFFFFFF"",Sanitäter 1: %1\nSanitäter 2: %2\nSanitäter 3: %3\nSanitäter 4: %4\nSanitäter 5: %5\nSanitäter 6: %6\nSprengstoff Spezialist 1: %7\nSprengstoff Spezialist 2: %8\nPionier 1: %9\nPionier 2: %10\nPionier 3: %11\nPionier 4: %12\nPionier 5: %13\nPionier 6: %14"]', _medic1,_medic2,_medic3,_medic4,_medic5,_medic6,_explosivespec1,_explosivespec2,_engineer1,_engineer2,_engineer3,_engineer4,_engineer5,_engineer6]; sleep 5; }; Thanks a lot for Feedback and ideas how I could handle the "nameproblem" best. Share this post Link to post Share on other sites
_foley 192 Posted May 8, 2023 Neat concept 🙂 It seems that _medic1, medic2, etc. are still references to the objects instead of their names in string form. Try replacing the part from _medic1 = _medics select 0; to _medic6 = _medics select 5; with this: _medics resize 6; _medics = _medics apply { if (isNil "_x") then { "unbesetzt" } else { name _x } }; _medics params ["_medic1", "_medic2", "_medic3", "_medic4", "_medic5", "_medic6"]; If it works then you can do the same for the other roles. 1 1 Share this post Link to post Share on other sites
SirBassi 10 Posted May 8, 2023 @_foley Thanks a lot 😍 Works perfectly great and also adhoc on Dedicated. The resize - apply combination commands were the missing points I searched for, I guess. Thanks for bringing me back on track. 🙂 Share this post Link to post Share on other sites