Catchdog64 11 Posted August 27, 2016 I am trying to write a script that will let a player keep his uniform but remove weapons, gear, magazines, and vests when they respawn. So far no luck, can somebody help? OnPlayerKilled.sqf player setVariable["Saved_Loadout",getUnitLoadout player];player removeAllWeapons;player removeBackpack;player removeAllHandgunItems;player removeMagazines;player removeVest; OnplayerRespawn.sqf player setUnitLoadout(player getVariable["Saved_Loadout",[]]);player enableFatigue false;player removeAllWeapons;player removeBackpack;player removeAllHandgunItems;player removeMagazines;player removeVest; Share this post Link to post Share on other sites
beno_83au 1369 Posted August 27, 2016 You can use these commands to get and add the uniform only, instead of the entire loadout: https://community.bistudio.com/wiki/uniform And https://community.bistudio.com/wiki/addUniform Or https://community.bistudio.com/wiki/forceAddUniform As for many of the rest of your commands, it's: command:unit Not unit:command You can check the wiki for specifics. Share this post Link to post Share on other sites
Catchdog64 11 Posted August 28, 2016 Yeah I realized I had the unit command structure backwards,, what I cannot figure out how to do is get the uniform and then add it upon respawn. Basically I want it so that if a player is killed, they'll respawn with whatever uniform that they might have picked up. I can get it to work with what the class starts with or with everything that they have picked up. Share this post Link to post Share on other sites
beno_83au 1369 Posted August 28, 2016 Have you tried it with the uniform commands instead of the unitLoadout commands? get/setUnitLoadout look like they might still be WIP. You could also try the "Killed" and "Respawn" event handlers to run loadout scripts. Share this post Link to post Share on other sites
Catchdog64 11 Posted August 28, 2016 I got it! You have to put this in the init of the unit this addEventHandler ["Respawn", { [_this select 0, [this, "last_loadout"]] call BIS_fnc_loadInventory;}]; Then onPlayerKilled player setVariable["Saved_Loadout",getUnitLoadout player]; onPlayerRespawn player setUnitLoadout(player getVariable["Saved_Loadout",[]]);removeAllWeapons player;removeVest player;removeBackpackGlobal player: 1 Share this post Link to post Share on other sites