Ivanhereisvodka 1 Posted June 5, 2020 Hi, I'm currently making a mission that is a deathmatch, in this mission I have in my onPlayerRespawn.sqf the following; player setunitloadout selectRandom ["rhsusf_usmc_marpat_d_grenadier", "rhsusf_army_ucp_arb_marksman", "rhsgref_nat_machinegunner", "CUP_I_UN_CDF_Soldier_SL_DST", "rhs_vdv_des_rifleman_asval"]; This works fine for players, they respawn with a random class from the list, but I have been unable to find a way to apply this to AI, I'm sorry if I missed something in the forum but I have looked for quite a while and found nothing. Thanks for any help. Share this post Link to post Share on other sites
Maff 251 Posted June 5, 2020 (edited) I see you have a CUP classname which relies on CBA. This should run "random setUnitLoadout" on units already present in the mission AND created during the mission. I have not tested this, but I have used CBA_fnc_addClassEventHandler before to customise units in a mission. The only issue I can think of is if you have civilians or other units that you don't want to be given random loadouts in your mission. That can be worked out though. // init.sqf [ "CAManBase", "init", { (_this select 0) setunitloadout selectRandom ["rhsusf_usmc_marpat_d_grenadier", "rhsusf_army_ucp_arb_marksman", "rhsgref_nat_machinegunner", "CUP_I_UN_CDF_Soldier_SL_DST", "rhs_vdv_des_rifleman_asval"]; }, true, [], true ] call CBA_fnc_addClassEventHandler; Edited June 5, 2020 by Maff _this error? 1 Share this post Link to post Share on other sites
Ivanhereisvodka 1 Posted June 7, 2020 Thank you, this works perfectly. 1 Share this post Link to post Share on other sites