kalthramis 12 Posted November 26, 2014 Heya, I'm trying to figure out how to get the name of a unit that activates a trigger. I've tried "this", "_this", and "thislist", from examples that worked in Arma 2 but don't seem to work in arma 3. These all only return "Any" rather than the unit's name. Can anyone help me? Share this post Link to post Share on other sites
jshock 512 Posted November 26, 2014 Assuming that you have only one unit that can activate this trigger: _unitName = name (thisList select 0); //OR _unitName = vehicleVarName (thisList select 0); https://community.bistudio.com/wiki/name https://community.bistudio.com/wiki/vehicleVarName https://community.bistudio.com/wiki/this#thisList Share this post Link to post Share on other sites
kalthramis 12 Posted November 26, 2014 Assuming that you have only one unit that can activate this trigger: _unitName = name (thisList select 0); //OR _unitName = vehicleVarName (thisList select 0); https://community.bistudio.com/wiki/name https://community.bistudio.com/wiki/vehicleVarName https://community.bistudio.com/wiki/this#thisList This is still only returning "Any" Share this post Link to post Share on other sites
jshock 512 Posted November 26, 2014 Could you provide a screenshot of how you have it all setup, and are you wanting the unit's name or the unit's variable name? Share this post Link to post Share on other sites
kalthramis 12 Posted November 26, 2014 Could you provide a screenshot of how you have it all setup, and are you wanting the unit's name or the unit's variable name? Variable name. I'm attempting to swap a loadout when the script is called. Titled "squadleader.sqf" _unitName = name (thisList select 0); hint format ["Loadout! %1", _unit]; comment "Squad Leader"; comment "Remove existing items"; removeAllWeapons _unit; removeAllItems _unit; removeAllAssignedItems _unit; removeUniform _unit; removeVest _unit; removeBackpack _unit; removeHeadgear _unit; comment "Add containers"; _unitName forceAddUniform "U_BG_Guerrilla_6_1"; comment "Etc, etc, etc"; Placed into init of a unit script = [] execVM "unitloadouts\squadleader.sqf"; Share this post Link to post Share on other sites
jshock 512 Posted November 26, 2014 //in trigger's onAct null = [thisList select 0] execVM "unitloadouts\squadleader.sqf"; _unit = (_this select 0);//you don't need the name, just the unit will do hint format ["Loadout! %1", _unit]; comment "Squad Leader"; comment "Remove existing items"; removeAllWeapons _unit; removeAllItems _unit; removeAllAssignedItems _unit; removeUniform _unit; removeVest _unit; removeBackpack _unit; removeHeadgear _unit; comment "Add containers"; _unit forceAddUniform "U_BG_Guerrilla_6_1"; comment "Etc, etc, etc"; 1 Share this post Link to post Share on other sites
kalthramis 12 Posted November 26, 2014 //in trigger's onAct null = [thisList select 0] execVM "unitloadouts\squadleader.sqf"; _unit = (_this select 0);//you don't need the name, just the unit will do hint format ["Loadout! %1", _unit]; comment "Squad Leader"; comment "Remove existing items"; removeAllWeapons _unit; removeAllItems _unit; removeAllAssignedItems _unit; removeUniform _unit; removeVest _unit; removeBackpack _unit; removeHeadgear _unit; comment "Add containers"; _unit forceAddUniform "U_BG_Guerrilla_6_1"; comment "Etc, etc, etc"; Yup, that works! Thanks. Spent 4 hours today trying to this damn thing to work; you're a life saver! Share this post Link to post Share on other sites