Respawn with gear

Respawn with gear

« posted: Sep 10, 2014, 07:19 PM »
Hi,

There is a way to be able to respawn, after death, with our gear/loadout ?
If "yes", how to do it ? ???

Thansk by advance.
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2544

Re: Respawn with gear

« Reply #1 posted: Sep 10, 2014, 09:40 PM »
You will have to do a couple changes to the scripts. Be aware that corpses will still contain the players' gear, so it can create duping abuse by suiciding over and over.

First, change this line: https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/blob/6c0a41a726e905f4507b9fb14297a0d233a530c2/persistence/players/s_setupPlayerDB.sqf#L55

To:
Code: [Select]
[(getPlayerUID _player) call PDB_playerFileName, "PlayerSave", "Position", []] call iniDB_write;
Then, change this line: https://github.com/A3Wasteland/ArmA3_Wasteland.Altis/blob/90585fb24b2d8bd9b8321b1212727049c45a3737/client/clientEvents/onRespawn.sqf#L42

To:
Code: [Select]
player call playerSetupStart;

// Reload inventory on respawn
if (["A3W_playerSaving"] call isConfigOn) then
{
playerData_alive = nil;
playerData_loaded = nil;
playerData_resetPos = nil;

call fn_requestPlayerData;

waitUntil {!isNil "playerData_loaded"};
};

if (isNil "playerData_alive") then
{
player call playerSetupGear;
};

player call playerSetupEnd;

Re: Respawn with gear

« Reply #2 posted: Sep 10, 2014, 11:18 PM »
TY AgentRev for the clear and fast answer !!  :)
  • Offline CREAMPIE
  • Armaholic
  • Veteran
  • ******
  • Posts: 1081
  • ^_^;;

Re: Respawn with gear

« Reply #3 posted: Sep 12, 2014, 08:40 AM »
You could also create an array in your playerSetupGear.sqf that creates a predefined gear setup ( kinda like donator style configs ) based on your UID ?

I have this on my server for donators and admins - can't remember where I found it ^^  Think it was the Team BIO server ( big up ! ) but works well :>

Code: [Select]
// @file Name: playerSetupGear.sqf
// @file Author: [GoT] JoSchaap, AgentRev

private ["_uid","_player", "_uniform", "_vest", "_headgear", "_goggles"];
_player = _this;

// Clothing is now defined in "client\functions\getDefaultClothing.sqf"

_uniform = [_player, "uniform"] call getDefaultClothing;
_vest = [_player, "vest"] call getDefaultClothing;
_headgear = [_player, "headgear"] call getDefaultClothing;
_goggles = [_player, "goggles"] call getDefaultClothing;

if (_uniform != "") then { _player addUniform _uniform };
if (_vest != "") then { _player addVest _vest };
if (_headgear != "") then { _player addHeadgear _headgear };
if (_goggles != "") then { _player addGoggles _goggles };

sleep 0.1;

// Add GPS
_player linkItem "ItemGPS";

// Remove radio
//_player unlinkItem "ItemRadio";

// Remove NVG
if (hmd _player != "") then { _player unlinkItem hmd _player };

// Add NVG
_player linkItem "NVGoggles";

// Switch loadous on uid's or default to base loadout
_uid = getPlayerUID player;
if !( (["[Admin]",(name player)] call fn_findString) >= 0) then
{
switch (_uid) do {

//////////////////////////////////////////////////////////////////////////// Admin Loadouts Start

// CRE4MPIE's's Loadout
case "76561197960927169":
{
removeVest _player;
removeBackpack _player;
_player addBackpack "B_Kitbag_rgr";
_player addVest "V_PlateCarrierIAGL_dgtl";
_player forceAddUniform "U_O_GhillieSuit";
_player addWeapon "arifle_Katiba_GL_ACO_pointer_snds_F";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addWeapon "hgun_Pistol_heavy_01_snds_F";
_player addMagazine "11Rnd_45ACP_Mag";
_player addMagazine "11Rnd_45ACP_Mag";
_player addItem "Medikit";
_player addHeadgear "H_HelmetB_camo";
};


////////////////////////////////////////////////////////////////////////////Admin Loadouts End


///////////////////////////////////////////////////////////////Contributor Loadouts Start

//Bosboks's LOADOUT
case "76561198031977865" :
{
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addBackpack "B_Carryall_khk";
_player addVest "V_TacVestIR_blk";
_player forceAddUniform "U_O_GhillieSuit";
_player addWeapon "arifle_Katiba_GL_ACO_pointer_snds_F";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addWeapon "hgun_Pistol_heavy_01_snds_F";
_player addMagazine "11Rnd_45ACP_Mag";
_player addMagazine "11Rnd_45ACP_Mag";
_player addItem "Medikit";
_player addItem "HandGrenade";


};

//GunS's LOADOUT
case "76561198088956866" :
{
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addBackpack "B_Kitbag_rgr";
_player addVest "V_TacVestIR_blk";
_player forceAddUniform "U_O_GhillieSuit";
_player addWeapon "arifle_Katiba_GL_ACO_pointer_snds_F";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addWeapon "hgun_Pistol_heavy_01_snds_F";
_player addMagazine "11Rnd_45ACP_Mag";
_player addMagazine "11Rnd_45ACP_Mag";
_player addItem "optic_MRD";
_player addItem "Medikit";
_player addItem "HandGrenade";

};

//Sgt.Browns LOADOUT
case "76561198013300669" :
{
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addBackpack "B_Kitbag_rgr";
_player addVest "V_TacVestIR_blk";
_player forceAddUniform "U_O_GhillieSuit";
_player addWeapon "arifle_Katiba_GL_ACO_pointer_snds_F";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addWeapon "hgun_Pistol_heavy_01_snds_F";
_player addMagazine "11Rnd_45ACP_Mag";
_player addMagazine "11Rnd_45ACP_Mag";
_player addItem "Medikit";
_player addItem "HandGrenade";

};

//Zkater's LOADOUT
case "76561198078404225" :
{
removeAllWeapons _player;
removeVest _player;
removeBackpack _player;
_player addBackpack "B_Kitbag_rgr";
_player addVest "V_TacVestIR_blk";
_player forceAddUniform "U_O_GhillieSuit";
_player addWeapon "arifle_Katiba_GL_ACO_pointer_snds_F";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "30Rnd_65x39_caseless_green";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addMagazine "1Rnd_HE_Grenade_shell";
_player addWeapon "hgun_Pistol_heavy_01_snds_F";
_player addMagazine "11Rnd_45ACP_Mag";
_player addMagazine "11Rnd_45ACP_Mag";
_player addItem "Medikit";
_player addItem "HandGrenade";

};

///////////////////////////////////////////////////////////////Contributor Loadouts End


///////////////////////////////////////////////////////////////Regular Player Loadout Start
default
{
_player addBackpack "B_FieldPack_oucamo";
_player addMagazine "9Rnd_45ACP_Mag";
_player addWeapon "hgun_ACPC2_F";
_player addMagazine "9Rnd_45ACP_Mag";
_player addItem "FirstAidKit";
_player selectWeapon "hgun_ACPC2_F";

};
///////////////////////////////////////////////////////////////Regular Player Loadout End
};
} else {
// Player has admin tags on ... set up as admin
removeAllWeapons _player;
removeUniform _player;
removeVest _player;
removeBackpack _player;
removeHeadgear _player;
removeGoggles _player;

_player addVest "V_Press_F";
_player forceAddUniform "U_Marshal";
_player addGoggles "G_Tactical_Black";
_player addItem "NVGoggles";
_player addItem "Laserdesignator";

};


if (_player == player) then
{
thirstLevel = 100;
hungerLevel = 100;
};

- from the grassy knoll -

Re: Respawn with gear

« Reply #4 posted: Nov 10, 2015, 02:05 AM »
AgentRev could you update the code?
  • Offline AgentRev
  • Developer
  • Veteran
  • ******
  • Posts: 2544

Re: Respawn with gear

« Reply #5 posted: Nov 10, 2015, 03:35 AM »
I'm in the middle of an exam week in college. I don't have time for this.

Re: Respawn with gear

« Reply #6 posted: Nov 15, 2015, 02:48 PM »
Cool. Good luck on your exams. When you have some free time any help would be greatly appreciated.

Re: Respawn with gear

« Reply #7 posted: Dec 19, 2015, 12:56 PM »
Solved