mirror of
https://github.com/IT07/a3_vemf_reloaded.git
synced 2024-08-30 16:52:11 +00:00
Hello
This commit is contained in:
parent
f07407814e
commit
0615ec225c
147
exile_vemf_reloaded/sqf/loadLoot.sqf
Normal file
147
exile_vemf_reloaded/sqf/loadLoot.sqf
Normal file
@ -0,0 +1,147 @@
|
||||
/*
|
||||
Author: IT07
|
||||
|
||||
Description:
|
||||
loads loot crate inventory
|
||||
|
||||
Params:
|
||||
_this: ARRAY
|
||||
_this select 0: OBJECT - the crate
|
||||
_this select 1: STRING - (optional) name of the location where crate is
|
||||
_this select 2: ARRAY - (optional) position of location where crate is
|
||||
|
||||
Returns:
|
||||
nothing
|
||||
*/
|
||||
|
||||
_crate = param [0, objNull, [objNull]];
|
||||
if not isNull _crate then
|
||||
{
|
||||
_crate setVariable ["isVEMFrCrate", 1, true];
|
||||
clearBackpackCargoGlobal _crate;
|
||||
clearItemCargoGlobal _crate;
|
||||
clearMagazineCargoGlobal _crate;
|
||||
clearWeaponCargoGlobal _crate;
|
||||
|
||||
_locName = param [1, "", [""]];
|
||||
_locPos = param [2, [], [[]]];
|
||||
_settings = [
|
||||
["crateLoot"],
|
||||
[
|
||||
"primarySlotsMax","primarySlotsMin","secondarySlotsMax","secondarySlotsMin","magSlotsMax","magSlotsMin","attSlotsMax","attSlotsMin","itemSlotsMax","itemSlotsMin",
|
||||
"vestSlotsMax","vestSlotsMin","headGearSlotsMax","headGearSlotsMin","bagSlotsMax","bagSlotsMin","primaryWeaponLoot","secondaryWeaponLoot","magLoot","attLoot",
|
||||
"itemLoot","vestLoot","backpackLoot","headGearLoot","blackListLoot"
|
||||
]
|
||||
] call VEMFr_fnc_getSetting;
|
||||
|
||||
_maxPrim = _settings select 0;
|
||||
_minPrim = _settings select 1;
|
||||
_maxSec = _settings select 2;
|
||||
_minSec = _settings select 3;
|
||||
_maxMagSlots = _settings select 4;
|
||||
_minMagSlots = _settings select 5;
|
||||
_maxAttSlots = _settings select 6;
|
||||
_minAttSlots = _settings select 7;
|
||||
_maxItemSlots = _settings select 8;
|
||||
_minItemSlots = _settings select 9;
|
||||
_maxVestSlots = _settings select 10;
|
||||
_minVestSlots = _settings select 11;
|
||||
_maxHeadGearSlots = _settings select 12;
|
||||
_minHeadGearSlots = _settings select 13;
|
||||
_maxBagSlots = _settings select 14;
|
||||
_minBagSlots = _settings select 15;
|
||||
_primaries = _settings select 16;
|
||||
_secondaries = _settings select 17;
|
||||
_magazines = _settings select 18;
|
||||
_attachments = _settings select 19;
|
||||
_items = _settings select 20;
|
||||
_vests = _settings select 21;
|
||||
_backpacks = _settings select 22;
|
||||
_headGear = _settings select 23;
|
||||
_blackList = _settings select 24;
|
||||
|
||||
// Add primary weapons
|
||||
for "_j" from 0 to (_maxPrim - _minPrim + floor random _minPrim) do
|
||||
{
|
||||
private ["_prim"];
|
||||
_prim = _primaries call BIS_fnc_selectRandom;
|
||||
if not((_prim select 0) in _blackList) then
|
||||
{
|
||||
_crate addWeaponCargoGlobal [_prim select 0, _prim select 1];
|
||||
};
|
||||
};
|
||||
// Secondary weapons
|
||||
for "_j" from 0 to (_maxSec - _minSec + floor random _minSec) do
|
||||
{
|
||||
private ["_sec"];
|
||||
_sec = _secondaries call BIS_fnc_selectRandom;
|
||||
if not((_sec select 0) in _blackList) then
|
||||
{
|
||||
_crate addWeaponCargoGlobal [_sec select 0, _sec select 1];
|
||||
};
|
||||
};
|
||||
// Magazines
|
||||
for "_j" from 0 to (_maxMagSlots - _minMagSlots + floor random _minMagSlots) do
|
||||
{
|
||||
private ["_mag"];
|
||||
_mag = _magazines call BIS_fnc_selectRandom;
|
||||
if not((_mag select 0) in _blackList) then
|
||||
{
|
||||
_crate addMagazineCargoGlobal [_mag select 0, _mag select 1];
|
||||
};
|
||||
};
|
||||
// Weapon attachments
|
||||
for "_j" from 0 to (_maxAttSlots - _minAttSlots + floor random _minAttSlots) do
|
||||
{
|
||||
private ["_att"];
|
||||
_att = _attachments call BIS_fnc_selectRandom;
|
||||
if not((_att select 0) in _blackList) then
|
||||
{
|
||||
_crate addItemCargoGlobal [_att select 0, _att select 1];
|
||||
};
|
||||
};
|
||||
// Items
|
||||
for "_j" from 0 to (_maxItemSlots - _minItemSlots + floor random _minItemSlots) do
|
||||
{
|
||||
private ["_item"];
|
||||
_item = _items call BIS_fnc_selectRandom;
|
||||
if not((_item select 0) in _blacklist) then
|
||||
{
|
||||
_crate addItemCargoGlobal [_item select 0, _item select 1];
|
||||
};
|
||||
};
|
||||
// Vests
|
||||
for "_j" from 0 to (_maxVestSlots - _minVestSlots + floor random _minVestSlots) do
|
||||
{
|
||||
private ["_vest"];
|
||||
_vest = _vests call BIS_fnc_selectRandom;
|
||||
if not((_vest select 0) in _blackList) then
|
||||
{
|
||||
_crate addItemCargoGlobal [_vest select 0, _vest select 1];
|
||||
};
|
||||
};
|
||||
// Helmets / caps / berets / bandanas
|
||||
for "_j" from 0 to (_maxHeadGearSlots - _minHeadGearSlots + floor random _minHeadGearSlots) do
|
||||
{
|
||||
private ["_headGearItem"];
|
||||
_headGearItem = _headGear call BIS_fnc_selectRandom;
|
||||
if not((_headGearItem select 0) in _blackList) then
|
||||
{
|
||||
_crate addItemCargoGlobal [_headGearItem select 0, _headGearItem select 1];
|
||||
};
|
||||
};
|
||||
// Backpacks
|
||||
for "_j" from 0 to (_maxBagSlots - _minBagSlots + floor random _minBagSlots) do
|
||||
{
|
||||
private ["_pack"];
|
||||
_pack = _backpacks call BIS_fnc_selectRandom;
|
||||
if not((_pack select 0) in _blackList) then
|
||||
{
|
||||
_crate addBackpackCargoGlobal [_pack select 0, _pack select 1];
|
||||
};
|
||||
};
|
||||
if (not(_locPos isEqualTo []) AND not(_locName isEqualTo "")) then
|
||||
{
|
||||
["loadLoot", 1, format["Loot loaded into crate located in %1 at %2", _locName, mapGridPosition _crate]] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
||||
};
|
25
exile_vemf_reloaded/sqf/signAI.sqf
Normal file
25
exile_vemf_reloaded/sqf/signAI.sqf
Normal file
@ -0,0 +1,25 @@
|
||||
/*
|
||||
Author: IT07
|
||||
|
||||
Description:
|
||||
marks given group(!) as VEMF AI which will then be used by REMOTEguard for monitor of groupOwner
|
||||
|
||||
Params:
|
||||
_this: ARRAY
|
||||
_this select 0: GROUP - group to sign as VEMF AI
|
||||
|
||||
Returns:
|
||||
nothing
|
||||
*/
|
||||
|
||||
_group = param [0, grpNull, [grpNull]];
|
||||
if not isNull _group then
|
||||
{
|
||||
(uiNamespace getVariable ["VEMFrAIgroups",[]]) pushBack _group;
|
||||
{
|
||||
_x setVariable ["VEMFrAIunit", 1, true];
|
||||
} forEach (units _group);
|
||||
} else
|
||||
{
|
||||
["signAI", 0, "_group isNull"] ExecVM "exile_vemf_reloaded\sqf\log.sqf";
|
||||
};
|
86
exile_vemf_reloaded/sqf/transferOwner.sqf
Normal file
86
exile_vemf_reloaded/sqf/transferOwner.sqf
Normal file
@ -0,0 +1,86 @@
|
||||
/*
|
||||
Author: IT07
|
||||
|
||||
Description:
|
||||
handles the transfer of ownership to another given unit/client/object.
|
||||
Will transfer complete group to the same (new) owner.
|
||||
|
||||
Params:
|
||||
_this select 0: GROUP - the group of which the ownership should be transfered
|
||||
|
||||
Returns:
|
||||
nothing
|
||||
*/
|
||||
|
||||
_toTransfer = param [0, grpNull, [grpNull]];
|
||||
if not isNull _toTransfer then
|
||||
{
|
||||
private ["_hcEnabled","_forceClients"];
|
||||
// Check if HC is enabled
|
||||
_hcEnabled = "headLessClientSupport" call VEMFr_fnc_getSetting;
|
||||
_forceClients = uiNamespace getVariable ["VEMFr_forceAItoClients", nil];
|
||||
if not(isNil "_forceClients") then
|
||||
{
|
||||
if _forceClients then
|
||||
{
|
||||
_hcEnabled = -1;
|
||||
};
|
||||
};
|
||||
private ["_to"];
|
||||
if (_hcEnabled isEqualTo 1) then
|
||||
{ // Gather the Headless Client(s)
|
||||
private ["_hcClients"];
|
||||
_hcClients = [];
|
||||
{
|
||||
if (typeOf _x isEqualTo "HeadlessClient_F") then // it is an HC
|
||||
{
|
||||
_hcClients pushBack [_x, owner _x];
|
||||
};
|
||||
} forEach allPlayers;
|
||||
if (count _hcClients > 0) then
|
||||
{
|
||||
_to = call VEMFr_fnc_headlessClient; // Select a random hc
|
||||
} else
|
||||
{
|
||||
uiNamespace setVariable ["VEMFr_forceAItoClients", true];
|
||||
};
|
||||
} else // If Headlessclient setting is not enabled
|
||||
{
|
||||
if ([1] call VEMFr_fnc_playerCount) then
|
||||
{
|
||||
private ["_closest"];
|
||||
_closest = [0,0,0];
|
||||
{
|
||||
if (isPlayer _x) then
|
||||
{
|
||||
private ["_leaderPos","_dist"];
|
||||
_leaderPos = position (leader _toTransfer);
|
||||
_dist = _leaderPos distance (position _x);
|
||||
if (_dist < (_leaderPos distance _closest)) then
|
||||
{ // Find the closest player
|
||||
private ["_closest"];
|
||||
_closest = position _x;
|
||||
_to = _x;
|
||||
};
|
||||
};
|
||||
} forEach allPlayers;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if not isNil "_to" then
|
||||
{
|
||||
_transfer = _toTransfer setGroupOwner (owner _to);
|
||||
_load = uiNamespace getVariable ["VEMFrHcLoad", nil];
|
||||
if not isNil "_load" then
|
||||
{
|
||||
_index = _load find _to;
|
||||
if (_index > -1) then
|
||||
{
|
||||
_load set [_index, ((_load select _index) select 1) + 1];
|
||||
} else
|
||||
{
|
||||
_load pushBack [_to, 1];
|
||||
};
|
||||
};
|
||||
};
|
Loading…
Reference in New Issue
Block a user