Tactical_Idiot 10 Posted September 24, 2013 Hello all, I've read through various threads about this but I need help with something specific. I'm new to this, and need each separate unit (there are 6 of them) to respawn with their individual custom loadouts. Ive got marksmen, medics and riflemen each with different load outs and need them all to respawn with them intact every time. Can someone help me with this? Hopefully someone has an idiot guide or text I can just paste in the right place. Thank! Share this post Link to post Share on other sites
Pac Man 10 Posted September 24, 2013 (edited) Utilize an respawn or MPrespawn eventhandler to run the loadout script or function. AddEventhandler or addMPEventhandler respectively. You could create one script to handle all loadouts. You'll have to evaluate the name of the unit or the unit type & then give him the items you want them to have. Or you can store each loadout into a global variable & each EH will call it's own loadout. here's a rough example below, it may or may not work as there may be errors. But the concept is valid. init.sqf: []ExecVM "loadouts.sqf"; For example in the medics init box: This AddEventHandler ["Respawn", {call [color="#FF0000"]Medic_Stuff[/color]}]; loadouts.sqf: [color="#FF0000"]Medic_Stuff[/color] = { RemoveAllWeapons (_this Select 0); _muzzle = [(_this Select 0), "arifle_MX_Holo_pointer_F", 4, "30Rnd_65x39_caseless_mag"] call BIS_fnc_addWeapon; ... more stuff }; [color="#0000FF"]Rifleman_Stuff[/color] = { RemoveAllWeapons (_this Select 0); _muzzle = [(_this Select 0), "arifle_MX_Holo_pointer_F", 4, "30Rnd_65x39_caseless_mag"] call BIS_fnc_addWeapon; ... more stuff }; Edited September 24, 2013 by Pac Man Share this post Link to post Share on other sites
Tactical_Idiot 10 Posted September 24, 2013 Hello mate, thanks for your message in helping me with the respawn custom load out, I almost understand the concept but am not experienced enough to know where each thing goes or what to practically do. I know its a lot to ask but I'd appreciate some more help, perhaps a listed guide on what to do: 1. Open up this file and copy this text 2. create new wordpad file and put this in, then save as .ext 3. etc etc Share this post Link to post Share on other sites
kylania 568 Posted September 24, 2013 He basically told you all of that already. :) Your mission folder should be: C:\Users\WindowsUsername\Documents\Arma 3 - Other Profiles\ArmAUsername\missions\missionName.Altis You're going to need to make two files: init.sqf and loadouts.sqf Copy/paste the text from the first box in init.sqf and save it into your mission folder. Copy/paste the text from the third box in loadouts.sqf and save it into your mission folder. Make sure those are SQF files and not listed as Text Documents. If it says it's a Text Document and you see the Notepad icon instead of a blank icon it's actually named init.sqf.txt and won't work. See to fix that.In the editor paste the text from the second box into the init field of your unit. Change the red text "Medic_Stuff" to "Rifleman_Stuff" to change the loadout for that unit to Rifleman. Share this post Link to post Share on other sites
Tactical_Idiot 10 Posted September 24, 2013 the only thing I need clarification on is whether I can just past in my custom load out below the Medic_Stuff = { so it will look like this: Medic_Stuff = { removeallweapons this; removeallassigneditems this; removeuniform this; removevest this; removebackpack this; this addvest "V_TacVest_khk"; this addbackpack "B_AssaultPack_khk"; this addheadgear "H_HelmetSpecB"; this addGoggles "G_Shades_Black"; (unitBackpack this) additemCargo ["FirstAidKit",5]; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addmagazine "20Rnd_762x51_Mag"; this addweapon "srifle_EBR_ACO_F"; this addPrimaryWeaponItem "optic_Nightstalker"; this addmagazine "9Rnd_45ACP_Mag"; this addmagazine "9Rnd_45ACP_Mag"; this addmagazine "9Rnd_45ACP_Mag"; this addmagazine "9Rnd_45ACP_Mag"; this addmagazine "9Rnd_45ACP_Mag"; this addmagazine "9Rnd_45ACP_Mag"; this addweapon "hgun_ACPC2_snds_F"; this addmagazine "smokeshell"; this addmagazine "smokeshell"; this addmagazine "smokeshell"; this addmagazine "smokeshell"; this addmagazine "handgrenade"; this addmagazine "handgrenade"; this addmagazine "handgrenade"; this addmagazine "handgrenade"; this addmagazine "handgrenade"; this additem "nvgoggles"; this additem "ItemCompass"; this additem "itemgps"; this additem "itemmap"; this additem "itemradio"; this additem "itemwatch"; this assignitem "nvgoggles"; this assignitem "itemcompass"; this assignitem "itemgps"; this assignitem "itemmap"; this assignitem "itemradio"; this assignitem "itemwatch"; this addweapon "Binocular"; this addPrimaryWeaponItem "muzzle_snds_B"; this additem "optic_ACO_grn"; this adduniform "U_B_SpecopsUniform_sgg"; Share this post Link to post Share on other sites
kylania 568 Posted September 24, 2013 (edited) Ewww! No. :) One sec... removeAllWeapons this; removeAllAssigneditems this; removeAllContainers this; this addvest "V_TacVest_khk"; this addbackpack "B_AssaultPack_khk"; this addheadgear "H_HelmetSpecB"; this addGoggles "G_Shades_Black"; (unitBackpack this) additemCargo ["FirstAidKit",5]; _muzzle = [this, "srifle_EBR_ARCO_pointer_snds_F", 11] call BIS_fnc_addWeapon; this addPrimaryWeaponItem "optic_Nightstalker"; _muzzle = [this, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon; this addmagazines ["smokeshell", 4]; this addmagazines ["handgrenade", 5]; {this linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; this addweapon "Binocular"; this additem "optic_ACO_grn"; this adduniform "U_B_SpecopsUniform_sgg"; That's really more of a sniper than a medic, but ok. :) Don't really need to add the ACO back in though, since the Nightstalker has a CQB sight on top anyway. Edited September 24, 2013 by kylania Share this post Link to post Share on other sites
Tactical_Idiot 10 Posted September 24, 2013 wow ok so I use that template below the Medic_Stuff = { right? I know the bulk text looks bad but I put that into the unit init and it works every time... so for each different loadout, I change the red but keep the blue in tact. Lastly, do I leave the unit init blank except for This AddEventHandler ["Respawn", {call Medic_Stuff}]; ?? Im concerned the units wont start the game with the loadout, but when they die they will. Share this post Link to post Share on other sites
Pac Man 10 Posted September 24, 2013 Medic_sniper_crazy_kit ={ removeAllWeapons this; removeAllAssigneditems this; removeAllContainers this; this addvest "V_TacVest_khk"; this addbackpack "B_AssaultPack_khk"; this addheadgear "H_HelmetSpecB"; this addGoggles "G_Shades_Black"; (unitBackpack this) additemCargo ["FirstAidKit",5]; _muzzle = [this, "srifle_EBR_ARCO_pointer_snds_F", 11] call BIS_fnc_addWeapon; this addPrimaryWeaponItem "optic_Nightstalker"; _muzzle = [this, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon; this addmagazines ["smokeshell", 4]; this addmagazines ["handgrenade", 5]; {this linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; this addweapon "Binocular"; this additem "optic_ACO_grn"; this adduniform "U_B_SpecopsUniform_sgg"; }; Share this post Link to post Share on other sites
Tactical_Idiot 10 Posted September 24, 2013 ok this isn't working. This is exactly what I've done 1. Created loadouts.sqf (confirmed its sqf as it says that as file type and showed an unticked hide file extensions for known file types. Its definitely an SQF file. NOTE: the icon does have a notepad icon inside it but that's because I open it with Notepad. 2. Created init.sqf confirming the above. 3. In the init.sqf I've pasted in []ExecVM "loadouts.sqf"; and that's all that is in there. 4 In the loadouts.sqf file I've pasted this exactly Marksman_Stuff ={removeAllWeapons this; removeAllAssigneditems this; removeAllContainers this; this addvest "V_TacVest_khk"; this addbackpack "B_AssaultPack_khk"; this addheadgear "H_HelmetSpecB"; this addGoggles "G_Shades_Black"; (unitBackpack this) additemCargo ["FirstAidKit",5]; _muzzle = [this, "srifle_EBR_ARCO_pointer_snds_F", 11] call BIS_fnc_addWeapon; this addPrimaryWeaponItem "optic_Nightstalker"; _muzzle = [this, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon; this addmagazines ["smokeshell", 4]; this addmagazines ["handgrenade", 5]; {this linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; this addweapon "Binocular"; this additem "optic_ACO_grn"; this adduniform "U_B_SpecopsUniform_sgg"; }; AutoRifleman_Stuff ={ removeAllWeapons this; removeAllAssigneditems this; removeAllContainers this; this addvest "V_TacVest_khk"; this addbackpack "B_AssaultPack_khk"; this addheadgear "H_HelmetSpecB"; this addGoggles "G_Shades_Black"; (unitBackpack this) additemCargo ["FirstAidKit",5]; _muzzle = [this, "srifle_EBR_ARCO_pointer_snds_F", 11] call BIS_fnc_addWeapon; this addPrimaryWeaponItem "optic_Nightstalker"; _muzzle = [this, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon; this addmagazines ["smokeshell", 4]; this addmagazines ["handgrenade", 5]; {this linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; this addweapon "Binocular"; this additem "optic_ACO_grn"; this adduniform "U_B_SpecopsUniform_sgg"; }; Medic_Stuff ={ removeAllWeapons this; removeAllAssigneditems this; removeAllContainers this; this addvest "V_TacVest_khk"; this addbackpack "B_AssaultPack_khk"; this addheadgear "H_HelmetSpecB"; this addGoggles "G_Shades_Black"; (unitBackpack this) additemCargo ["FirstAidKit",5]; _muzzle = [this, "srifle_EBR_ARCO_pointer_snds_F", 11] call BIS_fnc_addWeapon; this addPrimaryWeaponItem "optic_Nightstalker"; _muzzle = [this, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon; this addmagazines ["smokeshell", 4]; this addmagazines ["handgrenade", 5]; {this linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; this addweapon "Binocular"; this additem "optic_ACO_grn"; this adduniform "U_B_SpecopsUniform_sgg"; }; Grenadier_Stuff ={ removeAllWeapons this; removeAllAssigneditems this; removeAllContainers this; this addvest "V_TacVest_khk"; this addbackpack "B_AssaultPack_khk"; this addheadgear "H_HelmetSpecB"; this addGoggles "G_Shades_Black"; (unitBackpack this) additemCargo ["FirstAidKit",5]; _muzzle = [this, "srifle_EBR_ARCO_pointer_snds_F", 11] call BIS_fnc_addWeapon; this addPrimaryWeaponItem "optic_Nightstalker"; _muzzle = [this, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon; this addmagazines ["smokeshell", 4]; this addmagazines ["handgrenade", 5]; {this linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; this addweapon "Binocular"; this additem "optic_ACO_grn"; this adduniform "U_B_SpecopsUniform_sgg"; }; 4. In a marksman unit init box (have 2 marksman so this is the easiest to test with) I put the below in the init box and nothing else at all. Note I am trying to get these guys working in an MP game so made sure the event is MP and so is the respawn. This addMPEventhandler ["MPRespawn", {call Marksman_Stuff}]; 5. Save and export to MP game. 6. Start LAN game so I can test it out. 7. Not only does the Marksman start with the default loadout (not what I want), but when I kill him he respawns with the same default loadout. Please help guys, this is causing me a headache as I have promised it working to my clan tonight. Share this post Link to post Share on other sites
kylania 568 Posted September 24, 2013 (edited) init.sqf: [] execVM "loadouts.sqf"; waitUntil {!isNil "functionsLoaded"}; _loadout1 = unit1 call Marksman_Stuff; _loadout2 = unit2 call Marksman_Stuff; _loadout3 = unit3 call Medic_Stuff; _loadout4 = unit4 call Grenadier_Stuff; _loadout5 = unit5 call Grenadier_Stuff; _loadout6 = unit6 call AutoRifleman_Stuff; init fields: this addMPEventhandler ["MPRespawn", {(_this select 0) call Marksman_Stuff}]; loadouts.sqf: Grenadier_Stuff ={ _unit = _this; removeAllWeapons _unit; removeAllAssigneditems _unit; removeAllContainers _unit; _unit addvest "V_TacVest_khk"; _unit addbackpack "B_AssaultPack_khk"; _unit addheadgear "H_HelmetSpecB"; _unit addGoggles "G_Shades_Black"; _unit adduniform "U_B_SpecopsUniform_sgg"; (unitBackpack _unit) additemCargo ["FirstAidKit",5]; _muzzle = [_unit, "arifle_MX_GL_Hamr_pointer_F", 9] call BIS_fnc_addWeapon; _unit addmagazines ["3Rnd_Smoke_Grenade_shell", 2]; _unit addmagazines ["3Rnd_HE_Grenade_shell", 4]; _muzzle = [_unit, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon; _unit addmagazines ["smokeshell", 4]; _unit addmagazines ["handgrenade", 5]; {_unit linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; _unit addweapon "Binocular"; _unit additem "optic_ACO_grn"; }; Marksman_Stuff ={ _unit = _this; removeAllWeapons _unit; removeAllAssigneditems _unit; removeAllContainers _unit; _unit addvest "V_TacVest_khk"; _unit addbackpack "B_AssaultPack_khk"; _unit addheadgear "H_HelmetSpecB"; _unit addGoggles "G_Shades_Black"; _unit adduniform "U_B_SpecopsUniform_sgg"; (unitBackpack _unit) additemCargo ["FirstAidKit",5]; _muzzle = [_unit, "srifle_EBR_ARCO_pointer_snds_F", 11] call BIS_fnc_addWeapon; _unit addPrimaryWeaponItem "optic_Nightstalker"; _muzzle = [_unit, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon; _unit addmagazines ["smokeshell", 4]; _unit addmagazines ["handgrenade", 5]; {_unit linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; _unit addweapon "Binocular"; _unit additem "optic_ACO_grn"; }; AutoRifleman_Stuff ={ _unit = _this; removeAllWeapons _unit; removeAllAssigneditems _unit; removeAllContainers _unit; _unit addvest "V_TacVest_khk"; _unit addbackpack "B_AssaultPack_khk"; _unit addheadgear "H_HelmetSpecB"; _unit addGoggles "G_Shades_Black"; _unit adduniform "U_B_SpecopsUniform_sgg"; (unitBackpack _unit) additemCargo ["FirstAidKit",5]; _muzzle = [_unit, "arifle_MX_SW_Hamr_pointer_F", 6] call BIS_fnc_addWeapon; _muzzle = [_unit, "hgun_ACPC2_snds_F", 6] call BIS_fnc_addWeapon; _unit addmagazines ["smokeshell", 4]; _unit addmagazines ["handgrenade", 5]; {_unit linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; _unit addweapon "Binocular"; _unit additem "optic_ACO_grn"; }; Medic_Stuff ={ _unit = _this; removeAllWeapons _unit; removeAllAssigneditems _unit; removeAllContainers _unit; _unit addvest "V_TacVest_khk"; _unit addbackpack "B_AssaultPack_khk"; _unit addheadgear "H_HelmetSpecB"; _unit addGoggles "G_Shades_Black"; _unit adduniform "U_B_SpecopsUniform_sgg"; (unitBackpack _unit) additemCargo ["MediKit", 1]; (unitBackpack _unit) additemCargo ["FirstAidKit", 10]; _muzzle = [_unit, "arifle_MXC_ACO_pointer_F", 9] call BIS_fnc_addWeapon; _muzzle = [_unit, "hgun_ACPC2_snds_F", 3] call BIS_fnc_addWeapon; _unit addmagazines ["smokeshell", 4]; _unit addmagazines ["handgrenade", 5]; {_unit linkItem _x} forEach ["NVGoggles", "ItemCompass", "ItemGPS", "ItemMap", "ItemRadio", "ItemWatch"]; _unit addweapon "Binocular"; _unit additem "optic_ACO_grn"; }; functionsLoaded = true; Edited September 24, 2013 by kylania Share this post Link to post Share on other sites
Tactical_Idiot 10 Posted September 24, 2013 Ok did exactly what you said and the marksman unit didn't spawn with custom loadout and when killed did not respawn with custom load out HOWEVER: when I changed the units name to unit 1, he DID spawn with his custom load out BUT didn't respawn with it. I think we are close mate, close but not there yet ;-) I think the unit name thing might be important Share this post Link to post Share on other sites
kylania 568 Posted September 24, 2013 Sorry, try this for the eventhandler: this addMPEventhandler ["MPRespawn", {(_this select 0) call Marksman_Stuff}]; Share this post Link to post Share on other sites
Tactical_Idiot 10 Posted September 24, 2013 Sorry, try this for the eventhandler: this addMPEventhandler ["MPRespawn", {(_this select 0) call Marksman_Stuff}]; OK! SO! the marksman now spawn and respawn with their correct custom loadout, however the medic, autorifleman and grendadier don't spawn or respawn with the right kit. We are VERY close I think mate. Share this post Link to post Share on other sites
kylania 568 Posted September 24, 2013 Try the code in post #10 again, made a few changes. Or try this demo mission. Share this post Link to post Share on other sites
Tactical_Idiot 10 Posted September 24, 2013 how do I use that file? Its only 9kb? Share this post Link to post Share on other sites
Valixx 11 Posted September 28, 2013 Hey kylania. Got a question. I'm using this one too. Could we change the code in a way, that i don't need to name every unit in the editor and in the init.sqf.. simply put this addMPEventhandler ["MPRespawn", {(_this select 0) call Marksman_Stuff}]; in the init field? Share this post Link to post Share on other sites