Jump to content

Goggles/Headgear ETC Saving


TheVampire

Recommended Posts

I began working on a server the past few weeks again and realised the other day that Epoch doesn't save Headgear and Goggles from being overwritten by the profile settings of the player.
I understand when it is just cosmetic items, but my server has gasmasks that occupy the goggles slot. These gas masks are expensive and hard to find, so I need to correct this.

Players who have balaclavas in their profile are also losing their saved headgear.


Has anyone else already corrected this?

 

Link to comment
Share on other sites

This used to have to be changed in EPOCH_server_loadplayer.sqf: 

					if (_x in["Binocular", "Rangefinder","Laserdesignator","Laserdesignator_02","Laserdesignator_03","Laserdesignator_01_khk_F","Laserdesignator_02_ghex_F","CUP_LRTV","CUP_Laserdesignator","CUP_SOFLAM"]) then {
						_newPlyr addWeapon _x;
					} else {
						_newPlyr linkItem _x;
					};

where you would add in the items that you needed. Assumed that that was not needed since the new schema and the move to setUnitLoadout()?

I do have it still in my 1.1 code though... so? Around line 308

Link to comment
Share on other sites

Thanks for point to the script Grahame, but your code is currently outdated. That section is now in the Legacy area. Any new saves would be schema 1.0 and they skip that area.

	_newPlyr = _group createUnit[_class, _location, [], 0, "CAN_COLLIDE"];
        if !(isNull _newPlyr) then {
	            // disable AI on temp unit
            _newPlyr disableAI "ALL";
	            if (!_alreadyDead) then {
                // Medical
                _newPlyr setBleedingRemaining _bleedingRemaining;
                // _newPlyr setFatigue _fatigue;
                _newPlyr setOxygenRemaining _oxygenRemaining;
                _newPlyr setDamage _damage;
            } else {
                // player dead use default Data for appearance and loadout data
                _playerData = _defaultData;
            };
	            // disable further damage server side
            _newPlyr allowDamage false;
	            _newPlyr setDir _dir;
            _newPlyr setPosATL _location;
	            // set player loadout
            if (_schemaVersion >= 1.0) then {
                _playerData params ["","","_appearance","","","_loadout"];
                // get current weapon to send to param for selectWeapon
                _currentWeapon = _appearance param [4,""];
//                _newPlyr setUnitLoadout [_loadout, false];
	                // Workaround for Client / Server synchronizing issue in SetUnitLoadout
                [_newPlyr,_loadout] call Epoch_server_SetUnitLoadout;
	                diag_log format["DEBUG: loaded player %1 with new schema Version %2", _newPlyr, _schemaVersion];
	            } else {

Looking at the code, it doesn't seem to sanitize the player any. It likely should be wiping the character of any headgear and goggles that code with the default creation of the character. After creation of the character it is going to Epoch_server_SetUnitLoadout.

It uses SetUnitLoadout (Command) but I'd wager a guess that the command doesn't overwrite existing items.

EDIT: SetUnitLoadout Command in Editor does overwrite items, so that's not it.

Link to comment
Share on other sites

I have also noted this "bug".

I am pretty sure, setunitloadout works correct, but the cosmetic items (glasses) are overwritten when switching into the Unit.

But you could Test it by creating a unit, give him a loadout with these goggles and switch into it with selectplayer.

Link to comment
Share on other sites

You are talking about goggles or headgear? Headgear should work fine, but not goggles...

The Player connect as a "Ghost", then the Server create a new unit and set the loadout on this new unit. At least, the Server trigger it to the Client and the Client switch from the Ghost to the new Unit.

I think this "switching" will overwrite the default goggles and take it from the Player profile.

Here a small test:

http://plays.tv/video/5ada1915ce596f5f3e/selectplayer-goggles

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...