Jump to content

SirBassi

Update Variables | Player Name | Show on Billboard

Recommended Posts

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:

 

  Reveal hidden contents

 

Thanks a lot for Feedback and ideas how I could handle the "nameproblem" best.

 

Share this post


Link to post
Share on other sites

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.

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@_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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×