jakkob4682 23 Posted September 21, 2020 (edited) _f_getTownPos = { _array = [] call F_getSpawnAreas; _towns = _array select 0; { _idx = 1; _town = _towns select _forEachIndex; _tPos = locationPosition _town; _size = size _town; _rad = (_size select 0) * 1.5; _str = format ["mrk%1%2",_tpos,_idx]; _mrk = createMarker [_str,_tpos]; _mrk setMarkerShape "Ellipse"; _mrk setMarkerColor "ColorRed"; _mrk setMarkerSize [_rad,_rad]; }forEach _towns; _towns }; _fnc_getGroupTypes = { /* Returns configName groups of given side-faction-type of given size. Ex: _infgroups = [_side,_faction,"Infantry",_minmaxsize] call _fnc_getGroupTypes; Select one from the array to spawn with BIS_Fnc_spawnGroup. Ex: _group = [[0,0,0], west, (configFile >> "CfgGroups" >> (str west) >> "BLU_F" >> "Infantry" >> (_infgroups select 0))] call BIS_Fnc_spawnGroup; */ params ["_side", "_faction", "_class", "_minmaxsize", "_sidestrg"]; private _minsize = _minmaxsize param [0, 2]; private _maxsize = _minmaxsize param [1, 8]; _sidestrg = if (_side isEqualTo resistance) then{"indep"}else{(str _side)}; private _array = []; { private _unitscount = count ("true" configClasses _x); if (_unitscount >= _minsize && _unitscount <= _maxsize) then{ _array pushback (configName _x); }; }forEach ("true" configClasses (configFile >> "CfgGroups" >> _sidestrg >> _faction >> _class)); _array }; _infGroups = [east,"LOP_AM_OPF","Infantry",[2,8]] call _fnc_getGroupTypes; _towns = [] call _f_getTownPos; _idx = 0; for "_i" from _idx to (count _towns -1) do { _town = _towns select _idx; _townLoc = locationPosition _town; _size = size _town; _rad = (_size select 0) * 1.5; _idx = _idx + 1; _grp = grpNull; for "_a" from 1 to (round(random 3)) do { _grp = [_townLoc,east,(ConfigFile>>"CfgGroups">>str east>>"LOP_AM_OPF">>"Infantry">>selectRandom _infGroups)] call BIS_Fnc_spawnGroup; }; [_grp,_townLoc,_rad,(_rad/25),"MOVE","AWARE","YELLOW","LIMITED","STAG COLUMN","",[3,5,9]] call CBA_fnc_taskPatrol; }; _f_InitStrongpoints = { _array = [] call F_getSpawnAreas; _strongpoints = _array select 0; _idx = 0; _sp = _strongpoints select _idx; _sPos = locationPosition _sp; _idx = _idx + 1; _camp = [_sPos,sideEmpty,(configfile >> "CfgGroups" >> "Empty" >> "Military" >> "FieldHQSmall" >> "FieldReconPost_OPF_F")] call BIS_Fnc_spawnGroup; _grp = grpNull; for "_i" from 1 to (round(random 2)) do { _grp = [_sPos,east,(ConfigFile>>"CfgGroups">>str east>>"LOP_AM_OPF">>"Infantry">>selectRandom _infGroups)] call BIS_Fnc_spawnGroup; }; [_grp,getPos(leader _grp),100,.3,.1] call CBA_fnc_taskDefend; }; [] call _f_InitStrongpoints; Trying to figure out a way to make this more dynamic and add cqb functionality. Thanks to RCA, Davidoss, MGI, Larrow for helping put this together and for helping me understand some scripting commands better Edited September 21, 2020 by jakkob4682 Credits Share this post Link to post Share on other sites
RCA3 581 Posted September 21, 2020 What do you want to make more dynamic? Share this post Link to post Share on other sites
jakkob4682 23 Posted September 22, 2020 Trying to figure out the math for creating sectors or districts in towns without having to place a marker or trigger in the editor so you get roving patrols that move from sector to sector that garrison for a random period of time. Share this post Link to post Share on other sites
jakkob4682 23 Posted September 22, 2020 I think I'm going to have restructure and rewrite a good chunk of this to get a decent structure that I want. Share this post Link to post Share on other sites
RCA3 581 Posted September 22, 2020 Yup, me < maths. Can't help you there. Only thing that comes to mind is BIS_fnc_getArea to give you the size of each location, but FYI location's areas are not very accurate. 1 hour ago, jakkob4682 said: I think I'm going to have restructure and rewrite a good chunk of this That's pretty common 😄. Share this post Link to post Share on other sites
jakkob4682 23 Posted September 22, 2020 This is kind of the base of the framework I'm trying to establish. Parse all towns and strategic areas on the map(including mountain peaks)>>parse each towns building density/count>>parse the amount of roads in each location>>divide each town into quadrants. Using the returned values from those functions create dynamic patrols that move from section to section randomly garrisoning a random number of buildings before moving to the next quadrant rinse and repeat. I have LAMBS but haven't really dug into the function library. 2 Share this post Link to post Share on other sites
RCA3 581 Posted September 22, 2020 Seems cool and LAMBS does have something apparently useful: taskCQB Close Combat Module lets AI Group identifies buildings, Clears them methodically, marks building safe, moves to next building and, repeat until no buildings left Share this post Link to post Share on other sites
jakkob4682 23 Posted September 22, 2020 Yeah just at a glance that's going to add a lot of depth to what I'm working on. Share this post Link to post Share on other sites