Usage of RandomVar

This commit is contained in:
He-Man 2019-08-12 00:13:44 +02:00
parent bb6c56c4aa
commit b103a2ef41
6 changed files with 25 additions and 13 deletions

View File

@ -0,0 +1 @@
[player,GetUnitLoadout Player,missionNamespace getVariable [_playerRandomVarKey, -1]] call (missionnamespace getvariable ["Epoch_SetUnitLoadout",{}]);

View File

@ -16,7 +16,10 @@
private ["_type","_loadabs"];
//[[[end]]]
params ["_newPlyr","_loadout"];
params ["_newPlyr","_loadout",["_key",-1000]];
_tmpkey = (missionNamespace getVariable _playerRandomVarKey);
if (isnil "_tmpkey") exitwith {};
if !(_key isEqualTo (missionNamespace getVariable _playerRandomVarKey)) exitwith {};
// _loadout params ["_primaryarr","_secondaryarr","_handgunarr","_uniformarr","_vestarr","_bpackarr","_HeadGear","_Glasses","_Rangefinderarr","_LinedItemsarr"];
_loadout = +_loadout;

View File

@ -112,7 +112,7 @@ _fnc_moveWeaponFromContainer = {
_loadout set [_dIdx,_temp];
//save changes
// player setUnitLoadout _loadout;
[player,_loadout] call Epoch_SetUnitLoadout;
[player,_loadout,missionNamespace getVariable [_playerRandomVarKey, -1]] call Epoch_SetUnitLoadout;
};
_fnc_MoveWeaponToContainer = {
@ -137,7 +137,7 @@ _fnc_MoveWeaponToContainer = {
_loadout set [_sIdx,[]];
// player setUnitLoadout _loadout;
[player,_loadout] call Epoch_SetUnitLoadout;
[player,_loadout,missionNamespace getVariable [_playerRandomVarKey, -1]] call Epoch_SetUnitLoadout;
};
_fnc_canMoveToContainer = {
@ -233,7 +233,7 @@ _fnc_MoveShellToContainer = {
};
(_loadout select 0) set [5,[]];
// player setUnitLoadout _loadout;
[player,_loadout] call Epoch_SetUnitLoadout;
[player,_loadout,missionNamespace getVariable [_playerRandomVarKey, -1]] call Epoch_SetUnitLoadout;
};
_fnc_moveShellFromContainer = {
@ -252,7 +252,7 @@ _fnc_moveShellFromContainer = {
};
(_loadout select 0) set [5,[_temp select 0,_temp select 2]];
// player setUnitLoadout _loadout;
[player,_loadout] call Epoch_SetUnitLoadout;
[player,_loadout,missionNamespace getVariable [_playerRandomVarKey, -1]] call Epoch_SetUnitLoadout;
};
};
@ -277,7 +277,7 @@ _fnc_dropEquipShells = {
_equipped call _fnc_dropItem;
(_loadout select 0) set [5,[]];
// player setUnitLoadout _loadout;
[player,_loadout] call Epoch_SetUnitLoadout;
[player,_loadout,missionNamespace getVariable [_playerRandomVarKey, -1]] call Epoch_SetUnitLoadout;
_return = 2;
};
if (_forceEquip && _return != 4) then {
@ -351,7 +351,7 @@ _fnc_dropEquipAccessories = {
if (player canAdd _equipped) then {
(_loadout select _slot) set [_accessory,""];
// player setUnitLoadout _loadout;
[player,_loadout] call Epoch_SetUnitLoadout;
[player,_loadout,missionNamespace getVariable [_playerRandomVarKey, -1]] call Epoch_SetUnitLoadout;
player addItem _equipped;
_return = 1;
} else {
@ -359,20 +359,20 @@ _fnc_dropEquipAccessories = {
_equipped call _fnc_dropItem;
(_loadout select _slot) set [_accessory,""];
// player setUnitLoadout _loadout;
[player,_loadout] call Epoch_SetUnitLoadout;
[player,_loadout,missionNamespace getVariable [_playerRandomVarKey, -1]] call Epoch_SetUnitLoadout;
_return = 2;
};
if ((((toLower _equipped) != (toLower _item)) || _forceEquip) && _return != 4) then {
(_loadout select _slot) set [_accessory,_item];
// player setUnitLoadout _loadout;
[player,_loadout] call Epoch_SetUnitLoadout;
[player,_loadout,missionNamespace getVariable [_playerRandomVarKey, -1]] call Epoch_SetUnitLoadout;
player addItem _equipped;
player removeItem _item;
};
} else {
(_loadout select _slot) set [_accessory,_item];
// player setUnitLoadout _loadout;
[player,_loadout] call Epoch_SetUnitLoadout;
[player,_loadout,missionNamespace getVariable [_playerRandomVarKey, -1]] call Epoch_SetUnitLoadout;
player removeItem _item;
_return = 1;
};

View File

@ -79,6 +79,7 @@ _customVarLimits = _customVarsInit apply {_x param [2,[]]};
if !(isNil "_varNameTmp") then {_varName = _varNameTmp};
missionNamespace setVariable [_varName, missionNamespace getVariable [format["EPOCH_player%1",_x], _varDefault]];
} forEach _customVarNames;
missionNamespace setVariable [call compile "_playerRandomVarKey", round (diag_tickTime + random 99999)];
// only changed within this loop
_playerAliveTime = missionNamespace getVariable [_playerAliveTimeKey, _playerAliveTimeDefault];

View File

@ -74,7 +74,7 @@ _respawnButton ctrlEnable false;
(isNull _display) || ((_startTime - diag_tickTime) <= 0)
};
if (!isNull _display) then {
[player,(getUnitLoadout player)] call (missionnamespace getvariable ["Epoch_SetUnitLoadout",{}]);
call (missionnamespace getvariable ["EPOCH_ReloadLoadout",{}]);
uisleep 1; // give one second to broadcast clothing change
missionnamespace setvariable ["EPOCH_forceUpdateNow",true];
};

View File

@ -216,11 +216,18 @@ class CfgClientFunctions
class maxArmorInit {};
class initUI {};
class refeshUI {};
class equip {};
class equip {
customHeader = 1;
};
class itemTypeSlot {};
class usedItemRepack {};
class CryptoButtons {};
class SetUnitLoadout {};
class SetUnitLoadout {
customHeader = 1;
};
class ReloadLoadout {
customHeader = 1;
};
};
class servicepoint
{