Zaptoman 8 Posted June 15, 2017 So here's the problem. I have AI guys with a custom loadout at the beginning of a mission. Then they respawn, and they go back to their default loadout. I want them to respawn with the loadout they started with. I'm currently using the following script for players, which works fine. I just don't know how to make it work with the AI. if (hasInterface) then { [] spawn { waitUntil {alive player}; player setVariable ["loadout",getUnitLoadout player,false]; player addEventHandler ["Respawn", { player setUnitLoadout (player getVariable "loadout"); }]; }; }; Share this post Link to post Share on other sites
pierremgi 4853 Posted June 15, 2017 for Ais and players: if (hasInterface) then { [] spawn { waitUntil {alive player}; player setVariable ["loadout", getUnitLoadout player]; }; }; if (isServer) then { addMissionEventHandler ["entityKilled", { params ["_unit"]; if (isNil {_unit getVariable "loadout"} && !isPlayer _unit) then { _unit setVariable ["loadout", getUnitLoadout _unit] }; }]; addMissionEventHandler ["entityRespawned", { params ["_unit"]; _unit setUnitLoadout (_unit getVariable "loadout") }] }; You need both MEH because the respawned one doesn't grab the dropped weaponholder when the unit is killed, the MEH killed does. feel free to add some filter for side or else. 1 Share this post Link to post Share on other sites
Twiznak 57 Posted October 5, 2018 Thank you again, Pierre! Share this post Link to post Share on other sites