With the new respawn system we can define roles and loadouts in description.ext. It looks nice and fancy and works well.
However, I need to determine what role the player has chosen after they spawn in. Does the BIS respawn system do any kind of setvariable on the unit that respawns that contains the name of the role (or even the loadout) that was chosen? That would be very convenient.
How can I determine what role the player is after they spawn in? Do I need to make some kind of hacky script to check their gear and see if it matches some predefined constant to determine which role they chose or is there an easier way?
I think I found the solution to OP's question:
After you respawn, this will return a string of the display name of the last loadout selected in the selection screen:
_respawnCombo = uiNamespace getVariable (["BIS_RscRespawnControlsMap_ctrlComboLoadout", "BIS_RscRespawnControlsSpectate_ctrlComboLoadout"] select (uiNamespace getVariable ["BIS_RscRespawnControlsSpectate_shown", false]));
_respawnTemplateDisplayName = _respawnCombo lbText (lbCurSel _respawnCombo);
For example, if you had, and selected, the loadout:
class WEST1 {
displayName = "Light";
icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa";
role = "Test";
weapons[] = {
"arifle_MXC_F",
"Binocular"
};
magazines[] = {
"30Rnd_65x39_caseless_mag",
"30Rnd_65x39_caseless_mag",
"SmokeShell",
"SmokeShell"
};
items[] = {
"FirstAidKit"
};
linkedItems[] = {
"V_Chestrig_khk",
"H_Watchcap_blk",
"optic_Aco",
"acc_flashlight",
"ItemMap",
"ItemCompass",
"ItemWatch",
"ItemRadio"
};
uniformClass = "U_B_CombatUniform_mcam_tshirt";
backpack = "B_AssaultPack_mcamo";
};
_respawnTemplateDisplayName would return "Light"