Fix scripts for spawning units/statics using Arma building posns
This commit is contained in:
parent
7622615213
commit
43ad4ea1a2
@ -40,13 +40,27 @@ if !(isNull _group) then
|
||||
{
|
||||
{
|
||||
// ["Land_Unfinished_Building_02_F",[-21.8763,-45.978,-0.00213432],0,true,true,0.67,3,[],4],
|
||||
_x params["_bldClassName","_bldRelPos","_bldDir","_s","_d","_p","_noStatics","_typesStatics","_noUnits"];
|
||||
if (_typesStatics isEqualTo []) then {_typesStatics = ["B_HMG_01_high_F"]};
|
||||
_x params["_bldClassName","_bldRelPos","_bldDir","_allowDamage","_enableSimulation","_probabilityOfGarrision","_noStatics","_typesStatics","_noUnits"];
|
||||
if (_typesStatics isEqualTo []) then {_typesStatics = blck_staticWeapons};
|
||||
_building = createVehicle[_bldClassName,[0,0,0],[],0,"CAN_COLLIDE"];
|
||||
_buildingsSpawned pushBack (netID _building);
|
||||
_building setPosATL (_bldRelPos vectorAdd _center);
|
||||
[_building, _bldDir] call blck_fnc_setDirUp;
|
||||
_staticsSpawned = [_building,_group,_noStatics,_typesStatics,_noUnits,_aiDifficultyLevel,_uniforms,_headGear,_vests,_backpacks,"none",_weaponList,_sideArms] call blck_fnc_spawnGarrisonInsideBuilding_relPos;
|
||||
_staticsSpawned = [
|
||||
_building,
|
||||
_group,
|
||||
_noStatics,
|
||||
_typesStatics,
|
||||
_noUnits,
|
||||
_aiDifficultyLevel,
|
||||
_uniforms,
|
||||
_headGear,
|
||||
_vests,
|
||||
_backpacks,
|
||||
"none",
|
||||
_weaponList,
|
||||
_sideArms
|
||||
] call blck_fnc_spawnGarrisonInsideBuilding_relPos;
|
||||
}forEach _garrisonedBuilding_relPosSystem;
|
||||
};
|
||||
_return = [_group,_buildingsSpawned,_staticsSpawned];
|
||||
|
@ -10,7 +10,37 @@
|
||||
*/
|
||||
#include "\q\addons\custom_server\Configs\blck_defines.hpp";
|
||||
|
||||
params["_building","_group",["_noStatics",0],["_typesStatics",blck_staticWeapons],["_noUnits",0],["_aiDifficultyLevel","Red"], ["_uniforms",[]],["_headGear",[]],["_vests",[]],["_backpacks",[]],["_launcher","none"],["_weaponList",[]],["_sideArms",[]]];
|
||||
/*
|
||||
_building,
|
||||
_group,
|
||||
_noStatics,
|
||||
_typesStatics,
|
||||
_noUnits,
|
||||
_aiDifficultyLevel,
|
||||
_uniforms,
|
||||
_headGear,
|
||||
_vests,
|
||||
_backpacks,
|
||||
"none",
|
||||
_weaponList,
|
||||
_sideArms
|
||||
*/
|
||||
params[
|
||||
"_building",
|
||||
"_group",
|
||||
["_noStatics",0],
|
||||
["_typesStatics",blck_staticWeapons],
|
||||
["_noUnits",0],
|
||||
["_aiDifficultyLevel","Red"],
|
||||
["_uniforms",[]],
|
||||
["_headGear",[]],
|
||||
["_vests",[]],
|
||||
["_backpacks",[]],
|
||||
["_launcher","none"],
|
||||
["_weaponList",[]],
|
||||
["_sideArms",[]]
|
||||
];
|
||||
|
||||
if (_weaponList isEqualTo []) then {_weaponList = [_aiDifficultyLevel] call blck_fnc_selectAILoadout};
|
||||
if (_sideArms isEqualTo []) then {_sideArms = [_aiDifficultyLevel] call blck_fnc_selectAISidearms};
|
||||
if (_uniforms isEqualTo []) then {_uniforms = [_aiDifficultyLevel] call blck_fnc_selectAIUniforms};
|
||||
@ -19,12 +49,11 @@ if (_vests isEqualTo []) then {_vests = [_aiDifficultyLevel] call blck_fnc_
|
||||
if (_backpacks isEqualTo []) then {_backpacks = [_aiDifficultyLevel] call blck_fnc_selectAIBackpacks};
|
||||
|
||||
private["_unit","_obj","_staticClassName","_usedBldPsn","_pos","_obj"];
|
||||
private _allBldPsn = [[_building] call BIS_fnc_buildingPositions] call BIS_fnc_arrayShuffle;
|
||||
private _allBldPsn = ([_building] call BIS_fnc_buildingPositions) call BIS_fnc_arrayShuffle;
|
||||
private _countBldPsn = count _allBldPsn;
|
||||
private _floor = floor(_countBldPsn/2);
|
||||
private _ceil = ceil(_countBldPsn/2);
|
||||
private _statics = if (_ceil > _noStatics) then {_noStatics} else {_ceil};
|
||||
private _units = if (_floor > _noUnits) then {_noUnits} else {_floor};
|
||||
private _statics = _noStatics min ceil(_countBldPsn/2);
|
||||
private _units = _countBldPsn - _statics;
|
||||
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _statics = %1 | _units = %2 | count _allBldPsn = %3 | _allBldPsn %4",_statics,_units,count _allBldPsn,_allBldPsn];
|
||||
private _staticsSpawned = [];
|
||||
private _locsUsed = [];
|
||||
uiSleep 1;
|
||||
@ -32,6 +61,7 @@ for "_i" from 1 to _statics do
|
||||
{
|
||||
if (_allBldPsn isEqualTo []) exitWith {};
|
||||
_pos = _allBldPsn deleteAt 0;
|
||||
diag_log format["_fnc_spawnGarrisonInsideBuilding_relPos: _pos = %1",_pos];
|
||||
_locsUsed pushBack _pos;
|
||||
_staticClassName = selectRandom _typesStatics;
|
||||
_obj = [_staticClassName, [0,0,0]] call blck_fnc_spawnVehicle;
|
||||
|
Loading…
Reference in New Issue
Block a user