Hello, community! I am creating a MP mission, but I want to use a script for saving my proffered loadout. For example, when I get killed, I need to spawn with the same gear. I did a little research last night and I found a script that works for me only. I haven't tested it with friends, but it doesn't work for bots. There it is:
in init.sqf
// Set Units current Loadout Fnc_Set_Loadout = { _unit = _this select 0; _unit setVariable ["Saved_Loadout",getUnitLoadout _unit]; }; // Get Units current Loadout Fnc_Get_Loadout = { _unit = _this select 0; _unit setUnitLoadout (_unit getVariable ["Saved_Loadout",[]]); };
in initPlayerLocal.sqf
player addEventhandler ["Killed", {_this spawn Fnc_Set_Loadout}]; player addEventHandler ["Respawn", {_this spawn Fnc_Get_Loadout}];
Would it work for other players when they use the playable units or not? If not, what could be done?
Thanks in advance and cheers!