Jump to content
marksinnerdemon

respawn with gear you have at same location multiplayer.

Recommended Posts

Hey, I have been trying and playing around with respawn.  If I have a multiplayer game and I set down a few playable characters.  I would like to respawn with preset custom gear, but the player to respawn near where they died, not back at a spawn point.  If that makes sense.  I have tried various ways but it seems every respawn reverts the player to the original loadout and not the custom one built in Eden.  I hope this makes sense, and I am sure it is really easy, but treat me like I don't know a thing if you don't mind.

Share this post


Link to post
Share on other sites

in initPlayerLocal.sqf  (I can't imagine you didn't have created for your MP mission)

 

[player, [missionNamespace, format ["start_inv_%1", name player]]] call BIS_fnc_saveInventory;

 

in your respawn EH, where ever you write it. Let's say in init.sqf like this:

 

addMissionEventHandler ["EntityRespawned", {
  _unit = _this select 0;
  _corpse = _this select 1;
  if (local _unit) then {
  [_unit, [missionNamespace, format ["start_inv_%1", name _unit]]] call BIS_fnc_loadInventory;

  removeAllWeapons _corpse;

  removeBackpackGlobal _corpse;
  removeVest _corpse;
  removeAllAssignedItems _corpse;
  removeAllItems _corpse;
  removeGoggles _corpse;
  removeHeadgear _corpse;
  removeAllActions _corpse;
  {deleteVehicle _x} forEach nearestObjects [(getPosATL _corpse),["WeaponHolderSimulated","groundWeaponHolder"],5];
};
}];

  • Like 1

Share this post


Link to post
Share on other sites

Thanks for the info and yes I am stupid... [player, missionNamespace     Do I leave that as is or do I make that for each plaer and change missionnamespace to XXXX.mapname?

Thanks for the response and I just don't get scripting at all so that's probably why it isn't making sense for me.

Share this post


Link to post
Share on other sites
Just apply what it's written.
thanks I'll try it when I get home is there any issue with player vs playable? I thought that might be the issue.

Sent from my SM-G950U using Tapatalk

Share this post


Link to post
Share on other sites

player works ALWAYS fine in initPlayerLocal.sqf

 

playableUnits is an array, fine for working on your playable slots (in init.sqf for example), but... with a BAD behavior when disabling AIs in lobby (MP). If AIs are disabled, playableUnits = allPlayers. That means you can't reach the unit (it doesn't exist, neither any variable name) before a player JIP on it.

So, each time you want to run something for players, if you can avoid the playableUnits, foe command, write it in initPlayerLocal.sqf with player. Simple as that.

  • Thanks 1

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

×