Jump to content
Sign in to follow this  
weaponsfree

Simple/Light/Barebones Respawn with Kit Script

Recommended Posts

I know there are a lot of threads discussing this, but my focus here is a barebones and light respawn with kit (including optics and clothing) script.

From what I can see, nedley is trying to make just this, but is stuck on the optics: http://forums.bistudio.com/showthread.php?148547-Add-Remove-Optics-Working-on-Respawn&highlight=respawn

I'm looking for a simple and light respawn with the gear you had when killed, and having trouble finding something like what I was using in AO (see spoiler). What I've found to date seems to have a lot of extra features, doesn't save optics and clothing, needs to be modified to fit your specific kit, needs you to save the kit manually, has kit saves every 5 seconds, etc.

Sorry if this thread is starting to spam the topic in question, but hoping that it might catch the attention of someone who has something closer to what I'm looking for, or someone who can help nedley.

WaitUntil{not isNull player || isDedicated};

player addEventHandler ["Killed",{

player spawn {

_unit = _this;

private ['_magazines','_weapons','_backpack','_backpackweap','_backpackmags'];

if(isNil "savedloadout") then {

_weapons = weapons _unit;

_magazines = magazines _unit;

_backpack = typeOf unitBackpack _unit;

_backpackmags = getMagazineCargo unitBackpack _unit;

_backpackweap = getWeaponCargo unitBackpack _unit;

} else {

_weapons = savedloadout select 0;

_magazines = savedloadout select 1;

_backpack = savedloadout select 2;

_backpackmags = savedloadout select 3;

_backpackweap = savedloadout select 4;

};

WaitUntil{alive player};

removeAllWeapons player;

removeAllItems player;

removeBackpack player;

{player addMagazine _x} foreach _magazines;

{player addWeapon _x} foreach _weapons;

if (primaryWeapon player != "") then {

player selectWeapon (primaryWeapon player);

_muzzles = getArray(configFile>>"cfgWeapons" >> primaryWeapon player >> "muzzles"); // Fix for weapons with grenade launcher

player selectWeapon (_muzzles select 0);

};

if(_backpack != "") then {

player addBackpack _backpack; clearWeaponCargo (unitBackpack player); clearMagazineCargo (unitBackpack player);

for "_i" from 0 to (count (_backpackmags select 0) - 1) do {

(unitBackpack player) addMagazineCargo [(_backpackmags select 0) select _i,(_backpackmags select 1) select _i];

};

for "_i" from 0 to (count (_backpackweap select 0) - 1) do {

(unitBackpack player) addWeaponCargo [(_backpackweap select 0) select _i,(_backpackweap select 1) select _i];

};

};

};

}];

NOTE: My current solution to the problem is using Riouken's excellent Selectable Loadout script in conjunction with the vanilla respawn.

http://forums.bistudio.com/showthread.php?148371-RSLO-3-0-Riouken-s-Selectable-loadouts-Module

After death, I run the script, to reapply the desired kit.

Giallustio has a great revive and respawn script,

http://forums.bistudio.com/showthread.php?148085-BTC-Revive

but I'm having trouble getting just the barebones revive with kit aspect of it working by itself.

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  

×