DUWS-R-Team / DUWS-R

ArmA 3 Dynamic Universal War System - Rebirth
42 stars 18 forks source link

Implement enemy multiplier #74

Open rlex opened 9 years ago

rlex commented 9 years ago

Implement enemy multiplier which multiplies amount of enemies in each team created by create*.sqf scripts. Implemented in my version, so can be ported pretty easily.

rlex commented 9 years ago

Some background: after manual zone placing was implemented in DUWS-R and i ported it to my version, we started placing enemy zones in cities (Cherno+ from DayZ is especially good since it got BIG cities).

However, we found amount of enemies in cities unsatisfying, so i decided to give it a boost. As usual, chosable boost.

Thanks fo friendly JShock from BI forums, i got that loop for array multiplication:

_initGroup = ["O_Soldier_TL_F","O_Soldier_AR_F","O_Soldier_LAT_F","O_Soldier_GL_F"];
_multipliedGroup = [];
if (enemyunitMultiplier < 0) then {enemyunitMultiplier = 1};
for "_i" from 0 to (enemyunitMultiplier - 1) step 1 do
{
    _multipliedGroup = _multipliedGroup + _initGroup;
};
_group = [_position, EAST, _multipliedGroup,[],[],opfor_ai_skill] call BIS_fnc_spawnGroup;
_patrolRadius = round(_radius/2);
[_group, _position, _patrolradius] call bis_fnc_taskPatrol;

Where _initGroup = original DUWS units selection.

Then we create new combobox in startup gui with selection and declare publicvariable somewhere in startup.sqf.

rlex commented 9 years ago

Fixed loop without n*X team leaders

// usage: [position, radius] execvm "createoppatrol.sqf"
// radius: 50 for patrol inside and around base, 500 for medium lenght skirmish, 1300 for island

_position = _this select 0;
_radius   = _this select 1;

_initGroup = ["O_Soldier_AR_F","O_Soldier_GL_F"];
_multipliedGroup = [];
if (enemyunitMultiplier < 0) then {enemyunitMultiplier = 1};
for "_i" from 0 to (enemyunitMultiplier - 1) step 1 do
{
    _multipliedGroup = _multipliedGroup + _initGroup;
};
// add more units into squad with launchers and marksman rifles only once
// so we don't get swarmed by 5x snipers and 5x AT
_multipliedGroup = _multipliedGroup + ["O_soldierU_M_F","O_Soldier_LAT_F"];
// task leader should be added after multiplication so we dont' get X TLs
_multipliedGroup = _multipliedGroup + ["O_Soldier_TL_F"];
_group = [_position, EAST, _multipliedGroup,[],[],opfor_ai_skill] call BIS_fnc_spawnGroup;
_patrolRadius = round(_radius/2);
[_group, _position, _patrolradius] call bis_fnc_taskPatrol;

// ADD QRF eventhandler
_EH = leader _group addEventHandler ["Fired", {[_this select 0] spawn QRF_test}];
_killcp = [] call cp_ehkilledeast;