Jump to content
slrruthless

Respawn with Custom loadout

Recommended Posts

With VAS you can save, load, and respawn with your custom loadout.

http://www.armaholic.com/page.php?id=19134

If you have a weapon pack you are using in your mission, what you can do is pick the weapons and such you want, then go to through VAS and save your loadut, just name what the loadout is, and hit save, when you die you will respawn with the last weapon you had, mags left ect,. if you want what you started with then just go to the ammo box and reload it, simple and fast, it will save loadouts from custom ammo boxes

Share this post


Link to post
Share on other sites

My clan tried with custom loadouts last night. Though i encountered a problem. Loggin in, getting the items was fine, but everytime someone logged in or out, all the other players´s gear would reset. So everything they had manually loaded up, would dissapear. Does anyone know why this happens?

Share this post


Link to post
Share on other sites

Hi! I've been having some issues with this exact same script.

I'm relatively new to scripting, and I've tried several approaches, but now I'm pretty much stuck. I get the units to spawn with custom gear, I've also made it so that JIP's also get the new gear, the problem is making them spawn with the same gear when they respawn.

In the missions init.sqf I've added the code

if(!isServer) then {waitUntil{!isNull player}};
waitUntil {!isNull player};
waitUntil {player == player};
_className = gettext (configFile >> "cfgVehicles" >> typeOf player >> "displayName");
switch (_className) do {

case "UAV Operator": {[player] execVM "scripts\UAV_Operator.sqf"};
case "Team Leader": {[player] execVM "scripts\Team_Leader.sqf"};
case "Rifleman": {[player] execVM "scripts\Rifleman.sqf"};
case "Combat Medic": {[player] execVM "scripts\Combat_Medic.sqf"};


};

In the Scripts/ folder, let's use the Team Leader as and example, there I've got the script

waitUntil {!isNull player};       //to prevent MP / JIP issues

_unit = _this select 0;

_unit unassignItem "NVGoggles"; 
_unit removeItem "NVGoggles"; 
_unit unassignItem "ItemGPS";
_unit removeItem "ItemGPS";
_unit unassignItem "muzzle_mas_snds_C";
_unit removeItem "muzzle_mas_snds_C";
_unit unassignItem "acc_flashlight";
_unit removeItem "acc_flashlight";
_unit unassignitem "rangefinder";
_unit removeWeapon "rangefinder";
_unit removeWeapon "arifle_mas_m16_gl_mh";; 
_unit removemagazine "Chemlight_green"; 
_unit removemagazine "Chemlight_blue"; 
_unit removemagazine "Chemlight_yellow"; 
_unit removemagazine "Chemlight_blue"; 
_unit removemagazine "SmokeShellGreen"; 
_unit removemagazine "SmokeShellRed"; 
_unit removemagazine "SmokeShellYellow"; 
_unit removemagazine "SmokeShellPurple"; 
_unit removemagazine "1Rnd_SmokeYellow_Grenade_shell"; 
_unit removemagazine "1Rnd_SmokePurple_Grenade_shell"; 
_unit removemagazine "1Rnd_SmokeGreen_Grenade_shell"; 
_unit removemagazine "1Rnd_SmokeBlue_Grenade_shell"; 
_unit removemagazine "1Rnd_SmokeOrange_Grenade_shell"; 
_unit removemagazine "UGL_FlareGreen_F"; 
_unit removemagazine "UGL_FlareRed_F"; 
_unit removemagazine "B_IR_Grenade"; 
_unit removemagazine "B_IR_Grenade";
_unit removemagazine "1Rnd_HE_Grenade_shell";
_unit removemagazine "1Rnd_HE_Grenade_shell";
_unit removemagazine "1Rnd_HE_Grenade_shell";
_unit removemagazine "1Rnd_HE_Grenade_shell";
_unit removemagazine "1Rnd_HE_Grenade_shell";
sleep 0,5;
_unit addweapon "arifle_mas_m16";
//_unit removePrimaryWeaponItem
if(true) exitWith{};

And in the units init in the editor I've written

this addeventhandler ["respawn","_this execVM 'scripts/Team_Leader.sqf'"];

This does not work. If anyone could point out some flaws in my code, that'll be most appreciated. Also, I would like to be able to add the eventhandler in the missions init.sqf, eliminating the third step and speeding up the process.

Thanks in advance! (I had to post this in this thread as I am not allowed to create threads of my own yet.)

Share this post


Link to post
Share on other sites

For some reason, this is only working on my team leaders. Anyone in one of the team/squad leader slots starts and respawns with all of the right gear. But none of the other loadouts work.

This is the team leader init:

I tried replacing "this" with "_unit" in all of the other scripts (I noticed that the teamleader script was the only one I remembered to do that with) but with that NONE of them seem to work.

null = [this] execVM "loadout_teamleader.sqf";   this addeventhandler ["respawn","_this execVM 'loadout_teamleader.sqf'"];

And this is "loadout_teamleader.sqf":

waitUntil {!isNull player};       //to prevent MP / JIP issues

_unit = _this select 0;

removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
_unit forceAddUniform "U_B_CombatUniform_mcam_vest";
_unit addItemToUniform "AGM_EarBuds";
for "_i" from 1 to 4 do {_unit addItemToUniform "AGM_Bandage";};
_unit addItemToUniform "9Rnd_45ACP_Mag";
_unit addItemToUniform "Chemlight_green";
_unit addItemToUniform "Chemlight_red";
_unit addItemToUniform "B_IR_Grenade";
_unit addVest "V_PlateCarrier_Kerry";
_unit addItemToVest "9Rnd_45ACP_Mag";
for "_i" from 1 to 2 do {_unit addItemToVest "HandGrenade";};
_unit addItemToVest "SmokeShell";
_unit addItemToVest "SmokeShellRed";
_unit addItemToVest "SmokeShellGreen";
_unit addItemToVest "30Rnd_556x45_Stanag";
for "_i" from 1 to 3 do {_unit addItemToVest "1Rnd_HE_Grenade_shell";};
for "_i" from 1 to 2 do {_unit addItemToVest 

"1Rnd_SmokeRed_Grenade_shell";};
for "_i" from 1 to 2 do {_unit addItemToVest "UGL_FlareRed_F";};
for "_i" from 1 to 3 do {_unit addItemToVest 

"30Rnd_556x45_Stanag_Tracer_Red";};
_unit addBackpack "tf_rt1523g";
for "_i" from 1 to 6 do {_unit addItemToBackpack "AGM_Bandage";};
_unit addItemToBackpack "AGM_Morphine";
_unit addItemToBackpack "AGM_Epipen";
for "_i" from 1 to 2 do {_unit addItemToBackpack "SmokeShellGreen";};
for "_i" from 1 to 2 do {_unit addItemToBackpack "SmokeShellRed";};
for "_i" from 1 to 2 do {_unit addItemToBackpack "HandGrenade";};
for "_i" from 1 to 4 do {_unit addItemToBackpack 

"30Rnd_556x45_Stanag_Tracer_Red";};
for "_i" from 1 to 2 do {_unit addItemToBackpack "1Rnd_HE_Grenade_shell";};
for "_i" from 1 to 2 do {_unit addItemToBackpack 

"1Rnd_SmokeRed_Grenade_shell";};
_unit addHeadgear "H_Booniehat_khk_hs";
_unit addWeapon "RH_M16A4gl";
_unit addPrimaryWeaponItem "RH_peq15";
_unit addPrimaryWeaponItem "RH_eotech553";
_unit addWeapon "hgun_ACPC2_F";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "tf_anprc152";
_unit linkItem "ItemGPS";
_unit linkItem "Laserdesignator";

if(true) exitWith{};

// null = [this] execVM "loadout_medic.sqf";   this addeventhandler ["respawn","_this execVM 'loadout_medic.sqf'"];

Here's one of the other class' inits:

null = [this] execVM "loadout_medic.sqf";   this addeventhandler ["respawn","_this execVM 'loadout_medic.sqf'"];

and here's "loadout_medic.sqf":

waitUntil {!isNull player};       //to prevent MP / JIP issues

_unit = _this select 0;

removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;
this forceAddUniform "U_B_CombatUniform_mcam_vest";
this addItemToUniform "AGM_EarBuds";
for "_i" from 1 to 2 do {this addItemToUniform "AGM_Bandage";};
this addItemToUniform "AGM_Morphine";
this addItemToUniform "AGM_Epipen";
this addItemToUniform "Chemlight_green";
this addItemToUniform "Chemlight_red";
this addItemToUniform "B_IR_Grenade";
for "_i" from 1 to 3 do {this addItemToUniform "16Rnd_9x21_Mag";};
this addVest "V_TacVestIR_blk";
for "_i" from 1 to 3 do {this addItemToVest "AGM_Bandage";};
this addItemToVest "AGM_Morphine";
this addItemToVest "AGM_Epipen";
for "_i" from 1 to 3 do {this addItemToVest "30Rnd_556x45_Stanag";};
this addItemToVest "30Rnd_556x45_Stanag_Tracer_Red";
this addBackpack "B_TacticalPack_blk";
for "_i" from 1 to 20 do {this addItemToBackpack "AGM_Bandage";};
for "_i" from 1 to 6 do {this addItemToBackpack "AGM_Morphine";};
for "_i" from 1 to 4 do {this addItemToBackpack "AGM_Epipen";};
for "_i" from 1 to 3 do {this addItemToBackpack "AGM_Bloodbag";};
for "_i" from 1 to 2 do {this addItemToBackpack "AGM_EarBuds";};
for "_i" from 1 to 5 do {this addItemToBackpack "30Rnd_556x45_Stanag";};
for "_i" from 1 to 2 do {this addItemToBackpack "SmokeShell";};
for "_i" from 1 to 3 do {this addItemToBackpack "SmokeShellGreen";};
this addItemToBackpack "30Rnd_556x45_Stanag_Tracer_Red";
this addHeadgear "H_HelmetB_light_sand";
this addWeapon "RH_M4A1_ris";
this addPrimaryWeaponItem "RH_peq15";
this addPrimaryWeaponItem "RH_eotech553";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "ItemWatch";
this linkItem "tf_anprc152";
this linkItem "Binocular";

if(true) exitWith{};

// null = [this] execVM "loadout_medic.sqf";   this addeventhandler ["respawn","_this execVM 'loadout_medic.sqf'"];

At some point I got it working, sort of. But the loadouts aren't loaded quite right, there are a few things missing and there seems to be an odd effect of stacking louadouts or something. People were spawning with a ton of extra stuff, like they were inheriting the previous life's ammo or something.

Edited by MordeaniisChaos

Share this post


Link to post
Share on other sites

waitUntil {!isNull player}; //to prevent MP / JIP issues

_unit = _this select 0;

if(true) exitWith{};

Using this script it constantly repeats itself. Dedicated Server.

Any help?

Share this post


Link to post
Share on other sites
My clan tried with custom loadouts last night. Though i encountered a problem. Loggin in, getting the items was fine, but everytime someone logged in or out, all the other players´s gear would reset. So everything they had manually loaded up, would dissapear. Does anyone know why this happens?

I also NEED a solution to this! Any fix?!

Share this post


Link to post
Share on other sites

SO I am trying to get this custom loadout to work but when I respawn it still doesn't give me anything so I am going to place the in game code I use for my loadout. Any help fast would be appreciated. Just need sombody to fix it in a reply the way you should place it in your .sqf file!

removeallweapons this;

removevest this;

this addvest "V_TacVest_camo";

this addmagazine "handgrenade";

this addmagazine "handgrenade";

this addmagazine "handgrenade";

this addmagazine "handgrenade";

this addmagazine "handgrenade";

this addmagazine "handgrenade";

this addmagazine "smokeshell";

this addmagazine "smokeshell";

this addmagazine "smokeshell";

this assignitem "nvgoggles";

this assignitem "itemcompass";

this assignitem "itemgps";

this assignitem "itemmap";

this assignitem "itemradio";

this assignitem "itemwatch";

this addbackpack "B_Carryall_mcamo";

(unitBackpack this) additemCargo ["30Rnd_556x45_Stanag",11];

(unitBackpack this) additemCargo ["1Rnd_HE_Grenade_shell",4];

(unitBackpack this) additemCargo ["FirstAidKit",11];

this addweapon "arifle_Mk20_GL_F";

this addPrimaryWeaponItem "optic_Hamr";

this addPrimaryWeaponItem "acc_pointer_IR";

this addmagazine "16Rnd_9x21_Mag";

this addmagazine "16Rnd_9x21_Mag";

this addmagazine "16Rnd_9x21_Mag";

this addweapon "hgun_P07_F";

Share this post


Link to post
Share on other sites

Hey.

I have tried this and it works. But i remade my code and now it looks like this.

private ["_type","_unit"];

_type = _this select 0;

_unit = _this select 1;

//Remove all inventory

removeallweapons _unit;

removebackpack _unit;

switch (_type) do

{

case "Leader":

{

//Weapon & Attachment

_unit addMagazine "30Rnd_65x39_caseless_mag_Tracer";

_unit addWeapon "arifle_MX_GL_F";

_unit addPrimaryWeaponItem "muzzle_snds_H";

_unit addPrimaryWeaponItem "acc_pointer_IR";

_unit addPrimaryWeaponItem "optic_Arco";

_unit addWeapon "Laserdesignator";

//Headgear

_unit addHeadgear "H_MilCap_mcamo";

//Uniform

_unit AddUniform "U_B_CombatUniform_mcam";

_unit addItemToUniform "FirstAidKit";

for "_i" from 1 to 3 do {_unit addItemToUniform "SmokeShell";};

for "_i" from 1 to 2 do {_unit addItemToUniform "HandGrenade";};

//Vest, items & Ammunition

_unit AddVest "V_Chestrig_oli";

for "_i" from 1 to 2 do {_unit addItemToVest "Laserbatteries";};

for "_i" from 1 to 7 do {_unit addItemToVest "30Rnd_65x39_caseless_mag_Tracer";};

for "_i" from 1 to 4 do {_unit addItemToVest "3Rnd_HE_Grenade_shell";};

for "_i" from 1 to 1 do {_unit addItemToVest "3Rnd_UGL_FlareWhite_F";};

//Backpack & items

_unit addBackpack "";

//Equipment

_unit linkItem "ItemMap";

_unit linkItem "ItemCompass";

_unit linkItem "ItemWatch";

_unit linkItem "ItemRadio";

_unit linkItem "ItemGPS";

_unit linkItem "NVGoggles";

};

case "Sharpshooter":

{

//Weapon, Attachment & Ammunition

_unit addMagazine "20Rnd_762x51_Mag";

_unit addWeapon "srifle_DMR_03_tan_F";

_unit addPrimaryWeaponItem "muzzle_snds_B";

_unit addPrimaryWeaponItem "acc_pointer_IR";

_unit addPrimaryWeaponItem "optic_AMS_snd";

_unit addPrimaryWeaponItem "bipod_01_F_mtp";

_unit addWeapon "Rangefinder";

//Headgear

_unit addHeadgear "H_Cap_tan_specops_US";

//Uniform

_unit AddUniform "U_B_CombatUniform_mcam";

_unit addItemToUniform "FirstAidKit";

for "_i" from 1 to 3 do {_unit addItemToUniform "SmokeShell";};

for "_i" from 1 to 2 do {_unit addItemToUniform "HandGrenade";};

//Vest, items & Ammunition

_unit AddVest "V_Chestrig_oli";

for "_i" from 1 to 11 do {_unit addItemToVest "20Rnd_762x51_Mag";};

//Backpack & items

_unit addBackpack "B_AssaultPack_mcamo";

//Equipment

_unit linkItem "ItemMap";

_unit linkItem "ItemCompass";

_unit linkItem "ItemWatch";

_unit linkItem "ItemRadio";

_unit linkItem "ItemGPS";

_unit linkItem "NVGoggles";

};

};

The .sqf is for 2 units.

I want to make a respawn like "ENDGAME" (done that) but when a player respawn he loses his custom loadout and get the standard.

How do i fix this??? PLZ HELP!!!

Share this post


Link to post
Share on other sites

put this in your description.ext

.

.

.

respawn = "BASE";

respawnTemplatesEast[] = {"MenuPosition","Menuinventory"};

.

.

.

class CfgRespawnInventory

{

#include "loadout.sqf"

};

loudout.sqf:

class leader{

displayName = "Leader"; // name, visible in selection menu

icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; // Icon

uniformclass = "U_B_CombatUniform_mcam";

backpack = "";

weapons[] = {"arifle_MX_GL_F","Laserdesignator","Throw","Put"};

magazines[] = {"SmokeShell","SmokeShell","SmokeShell","HandGrenade","HandGrenade","Laserbatteries","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_mag_Tracer","30Rnd_65x39_caseless_mag_Tracer","3Rnd_HE_Grenade_shell","3Rnd_HE_Grenade_shell","3Rnd_HE_Grenade_shell","3Rnd_HE_Grenade_shell","3Rnd_UGL_FlareWhite_F"};

items[] = {"FirstAidKit"};

linkedItems[] = {"V_Chestrig_oli","H_Watchcap_cbr","G_Shades_Red","ItemMap","ItemCompass","tf_microdagr","ItemRadio","ItemGPS","NVGoggles"};

};

class Sharpshooter

{

displayName = "Sharpshooter"; // name, visible in selection menu

icon = "\A3\Ui_f\data\GUI\Cfg\Ranks\sergeant_gs.paa"; // Icon

uniformclass = "U_B_CombatUniform_mcam";

backpack = "tf_rt1523g_sage";

weapons[] = {"srifle_DMR_03_tan_F","Rangefinder","Throw","Put"};

magazines[] = {"SmokeShell","SmokeShell","SmokeShell","HandGrenade","HandGrenade","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag"};

items[] = {"FirstAidKit"};

linkedItems[] = {"V_Chestrig_oli","H_Bandanna_surfer_blk","G_Bandanna_shades","ItemMap","ItemCompass","tf_microdagr","tf_anprc152_1","ItemGPS","NVGoggles"};

}

Unit init:

[this,"sharpshooter"] call BIS_fnc_addRespawnInventory;

or this:

[this,"leader"] call BIS_fnc_addRespawnInventory;

Now you have the Endgame respawn with with JIP-compatible loadouts

also see this:

https://community.bistudio.com/wiki/Arma_3_Respawn#Respawn_Templates_2

//edit: had agm activated. Changed the medic stuff

Share this post


Link to post
Share on other sites

hey everyone, please help me!

 

i treid it often but i cant do it right....

 

i want that this soldier apears if i respawn:

 

it is copy and paste by the virtual arsenal in arma 3

 

comment "Exported from Arsenal by XXXX";

comment "Remove existing items";
removeAllWeapons this;
removeAllItems this;
removeAllAssignedItems this;
removeUniform this;
removeVest this;
removeBackpack this;
removeHeadgear this;
removeGoggles this;

comment "Add containers";
this forceAddUniform "U_I_G_Story_Protagonist_F";
for "_i" from 1 to 3 do {this addItemToUniform "17Rnd_mas_9x21_Mag";};
this addVest "V_Chestrig_blk";
for "_i" from 1 to 3 do {this addItemToVest "30Rnd_mas_545x39_T_mag";};
for "_i" from 1 to 9 do {this addItemToVest "30Rnd_mas_545x39_mag";};
for "_i" from 1 to 4 do {this addItemToVest "BWA3_DM51A1";};
this addItemToVest "B_IR_Grenade";
this addBackpack "B_mas_AssaultPack_black";
for "_i" from 1 to 4 do {this addItemToBackpack "FirstAidKit";};
this addItemToBackpack "Medikit";
this addItemToBackpack "SmokeShellBlue";
this addItemToBackpack "SmokeShellRed";
for "_i" from 1 to 6 do {this addItemToBackpack "SmokeShell";};
this addHeadgear "H_Watchcap_blk";
this addGoggles "G_mas_wpn_bala_gog_b";

comment "Add weapons";
this addWeapon "arifle_mas_ak12_sf";
this addPrimaryWeaponItem "optic_Aco_smg";
this addWeapon "hgun_mas_grach_F";
this addHandgunItem "muzzle_mas_snds_LM";
this addHandgunItem "acc_mas_pointer_gun_IR";
this addWeapon "Rangefinder";

comment "Add items";
this linkItem "ItemMap";
this linkItem "ItemCompass";
this linkItem "ItemWatch";
this linkItem "ItemRadio";
this linkItem "BWA3_ItemNaviPad";
this linkItem "NVGoggles_mas_h";

comment "Set identity";
this setFace "WhiteHead_14";
this setSpeaker "Male12ENG";

[this,"BWA3_insignia_03_hauptgefreiter"] call bis_fnc_setUnitInsignia;
 

 

i would be very happy if anyone can help me!

 

also i need the right description.ext and other files, thanks a lot for help

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×