Jump to content
Sign in to follow this  
JerryK

Players respawning with standard loadout instead of my own customized loadout

Recommended Posts

So I've got a problem with my mission. Each player starts with a backpack filled with 10 claymores and 20 C4 pack, but upon death they respawn and start with their standard blufor rifleman loadout instead of the customized one that I made. Is there anyway to make them continually respawn with the customized loadout?

Share this post


Link to post
Share on other sites

You need to add it so when they die the script gets run again something like

player addeventhandler ["killed", { execVM "THISSCRIPT.SQF"; } ];

Share this post


Link to post
Share on other sites

I started trying to do such a thing... This is meant for Multiplayer and is not fully tested... But if you have smarts you'll fix it if it's broken... Still trying to figure out how to restore Vest items :\

player addMPEventHandler["MPKilled",
{
private["_unit"];
_unit = _this select 0; //Our dead unit
if(!local _unit) exitWith {};
var_sv_PrimItems = primaryWeaponItems _unit;
var_sv_SecItems = secondaryWeaponItems _unit;
var_sv_weapons = weapons _unit;
var_sv_magazines = magazines _unit;
var_sv_vest = vest _unit;
var_sv_uniform = uniform _unit;
var_sv_items = assignedItems _unit;
var_sv_backpack = backpack _unit;
var_sv_bpItems = backPackItems _unit;
}
];

player addMPEventHandler["MPRespawn",
{
private["_unit","_corpse"];
_unit = _this select 0;
_corpse = _this select 1;
if(!local _unit) exitWith {};

deleteVehicle _corpse; //Remove our previous dead body
removeAllAssignedItems player; //Remove all our items
removeAllWeapons player; //Remove all our weapons
removeVest player; //Remove our vest
removeUniform player; //Remove our uniform

_unit addUniform var_sv_uniform; //Add previously saved uniform on death
_unit addVest var_sv_vest; //Add previously saved vest on death
_unit addBackPack var_sv_backpack; //Add previously saved backpack on death
clearAllItemsFromBackpack _unit; //Remove content from new backpack
{(unitBackpack _unit) addItemCargoGlobal [_x,1];} foreach var_sv_bpItems; //Restore Backpack Items
{_unit addWeapon _x;} foreach var_sv_weapons; //Restore Previous weapons
{_unit addMagazine _x;} foreach var_sv_magazines; //Restore Magazines
{_unit addPrimaryWeaponItem _x;} foreach var_sv_PrimItems; //Restore previous Primary Attachments/Items
{_unit addSecondaryWeaponItem _x;} foreach var_sv_SecItems; //Restore previous Secondary Attachments/items
{_unit addItem _x; _unit assignItem _x;} foreach var_sv_items; //Restore all items lost...
}
];

Edited by Tonic-_-

Share this post


Link to post
Share on other sites

Sorry, but what do I with all that code?

Share this post


Link to post
Share on other sites
I started trying to do such a thing... This is meant for Multiplayer and is not fully tested... But if you have smarts you'll fix it if it's broken... Still trying to figure out how to restore Vest items :\

Doesn't seem to add back any things at all - just removes

Share this post


Link to post
Share on other sites
Doesn't seem to add back any things at all - just removes

Yeah, Apparently it is an issue with retrieving specific items on a dead body. I'll go back to the drawing board tomorrow.

Share this post


Link to post
Share on other sites

Keen for a solution myself. I have got a functional revive script but need the rearm script to complete the job as everyone spawns stock.

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
Sign in to follow this  

×