Jump to content

jakkob4682

Member
  • Content Count

    226
  • Joined

  • Last visited

  • Medals

Everything posted by jakkob4682

  1. Do I need to have them declared before I start a loop in order to use them after? I.e. _array = [];for from loop; _array = what was defined in loop?
  2. so by declaring it private at the start it becomes available throughtout the whole function with out having to define a million variables? i.e. i have 10 different variable in the function, and don't want to use objnull, array = [], and etc a million times, i just need to declare a variable private at the start? Also when to use _x and when to use _forEachIndex?
  3. _forEachIndex is something I've recently learned of thanks to MGI, i've just been using indexing in my other functions.
  4. should all the variables used in the function be declared private?
  5. so if i'm understanding right... after updating those two arrays, _return also needs to be updated instead of using _return = [_var1,_var2] or [_townArray,_miscArray] in my case?
  6. restructured it and still not getting anything for the return value
  7. never mind.... found it. never mind... still not working
  8. f_markLocations = { _array = ( allMissionObjects "Logic" select{ !( _x isKindOf "Module_F" ) } ) - [ BIS_functions_mainscope ]; _numLogics = count _array; { _return = []; private["_idx","_pos","_count","_location"]; _obj = _array select _forEachIndex; _pos = getPosASL _obj; { _locations = nearestLocations[_pos,["nameVillage","nameCity","nameCityCapital","CityCenter","Hill","Strongpoint"],3000]; _townArray = []; _miscArray = []; _idx = 0; for "_i" from 0 to (count _locations) do { _location = _locations select _i; _pos = locationPosition _location; _str = format ["location%1%2",_idx,_type]; _mrk = createMarker [_str,_pos]; _mrk setmarkerColor "ColorRed"; _mrk setMarkerSize [1,1]; _idx = _idx + 1; { if(type _x != "Hill" and type _x != "Strongpoint") then { _miscArray pushBack _x; _mrk setMarkerType "O_Recon"; } else { _townArray pushBack _x; _mrk setMarkerShape "Ellipse"; _mrk setMarkerSize [50,50]; }; }forEach _locations; }; //hintSilent format ["%1:%2",_count,_numLogics]; }forEach _locations; _return = [_townArray,_miscArray]; }forEach _array; _return }; is not returning anything for a count in either of the indexes for _return is why I'm asking
  9. _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
  10. Yeah just at a glance that's going to add a lot of depth to what I'm working on.
  11. 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.
  12. I think I'm going to have restructure and rewrite a good chunk of this to get a decent structure that I want.
  13. 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.
  14. I'm in the process of making a framework that is based off of location sizes, nearRoads, and count of buildings in a defined radius. So i.e. you get a patrol that patrol the roads in the town, a group that moves from one random building to another, and a group that moves from random building to random building searching. It's kinda a pain in the .... because i'm trying to divide the city into quadrants and trying to find the math for it.
  15. @pierremgi Does CBA have a dynamic building Garrison function that I'm not aware of? It is semi-dynamic... it parses buildings in a certain radius that have a buildingPosition based on the waypoint position i believe. Which is why I asked if the placement radius affected the behaviour of ai assigned to that waypoint. So it's a core function, meaning it provides the ability to make a dynamic garrison function
  16. Does the placement radius have any effect? I.e. if you enlarge it do they just pick a random building within the radius that has a buildingPos?
  17. 9:35:06 Class Table destroyed with lock count 3 9:35:06 Class T0 destroyed with lock count 3 9:35:06 Class T1 destroyed with lock count 3 9:35:06 Class T2 destroyed with lock count 3 9:35:06 Class T3 destroyed with lock count 3 9:35:06 Class T4 destroyed with lock count 3 9:35:06 Class T5 destroyed with lock count 3 9:35:06 Class T6 destroyed with lock count 3 9:35:06 Class T7 destroyed with lock count 3 9:35:06 Class T8 destroyed with lock count 3 9:35:06 Class T9 destroyed with lock count 3 9:35:06 Class T10 destroyed with lock count 3 9:35:06 Class T11 destroyed with lock count 3 9:35:06 Class T12 destroyed with lock count 3 9:35:06 Class T13 destroyed with lock count 3 9:35:06 Class T14 destroyed with lock count 3 9:35:06 Class T15 destroyed with lock count 3 9:35:06 Class T16 destroyed with lock count 3 9:35:06 Class T17 destroyed with lock count 3 9:35:06 Class T18 destroyed with lock count 3 9:35:06 Class T19 destroyed with lock count 3 9:35:06 Class T20 destroyed with lock count 3 9:35:06 Class T21 destroyed with lock count 3 9:35:06 Class T22 destroyed with lock count 3 9:35:06 Class WeaponCloudsGun destroyed with lock count 6 9:35:06 Class Table destroyed with lock count 6 9:35:06 Class T0 destroyed with lock count 6 9:35:06 Class WeaponCloudsMGun destroyed with lock count 3 9:35:06 Class Table destroyed with lock count 3 9:35:06 Class T0 destroyed with lock count 3 9:35:06 Class All destroyed with lock count 3 9:35:06 Class EventHandlers destroyed with lock count 3 9:35:06 Class CBA_Extended_EventHandlers destroyed with lock count 3 9:35:06 Class MarkerLights destroyed with lock count 3 9:35:06 Class NVGMarkers destroyed with lock count 3 9:35:06 Class NVGMarker destroyed with lock count 3 9:35:06 Class Turrets destroyed with lock count 3 9:35:06 Class HeadLimits destroyed with lock count 3 9:35:06 Class ViewPilot destroyed with lock count 3 9:35:06 Class ViewCargo destroyed with lock count 3 9:35:06 Class ViewOptics destroyed with lock count 3 9:35:06 Class PilotSpec destroyed with lock count 3 9:35:06 Class CargoSpec destroyed with lock count 3 9:35:06 Class Cargo1 destroyed with lock count 3 9:35:06 Class TransportWeapons destroyed with lock count 3 9:35:06 Class TransportMagazines destroyed with lock count 3 9:35:06 Class SoundEnvironExt destroyed with lock count 3 9:35:06 Class SoundEquipment destroyed with lock count 3 9:35:06 Class SoundGear destroyed with lock count 3 9:35:06 Class SoundBreath destroyed with lock count 3 9:35:06 Class SoundBreathSwimming destroyed with lock count 3 9:35:06 Class SoundBreathInjured destroyed with lock count 3 9:35:06 Class SoundHitScream destroyed with lock count 3 9:35:06 Class SoundInjured destroyed with lock count 3 9:35:06 Class SoundBreathAutomatic destroyed with lock count 3 9:35:06 Class SoundDrown destroyed with lock count 3 9:35:06 Class SoundChoke destroyed with lock count 3 9:35:06 Class SoundRecovered destroyed with lock count 3 9:35:06 Class SoundBurning destroyed with lock count 3 9:35:06 Class PulsationSound destroyed with lock count 3 9:35:06 Class SoundDrowning destroyed with lock count 3 9:35:06 Class Reflectors destroyed with lock count 3 9:35:06 Class FxExplo destroyed with lock count 3 9:35:06 Class AnimationSources destroyed with lock count 3 9:35:06 Class GunFire destroyed with lock count 3 9:35:06 Class GunClouds destroyed with lock count 3 9:35:06 Class MGunClouds destroyed with lock count 3 9:35:06 Class Damage destroyed with lock count 3 9:35:06 Class DestructionEffects destroyed with lock count 3 9:35:06 Class Light1 destroyed with lock count 3 9:35:06 Class Smoke1 destroyed with lock count 3 9:35:06 Class Fire1 destroyed with lock count 3 9:35:06 Class Sparks1 destroyed with lock count 3 9:35:06 Class Sound destroyed with lock count 3 9:35:06 Class Light2 destroyed with lock count 3 9:35:06 Class Fire2 destroyed with lock count 3 9:35:06 Class Smoke1_2 destroyed with lock count 3 9:35:06 Class camShakeGForce destroyed with lock count 3 9:35:06 Class camShakeDamage destroyed with lock count 3 9:35:06 Class SpeechVariants destroyed with lock count 3 9:35:06 Class Default destroyed with lock count 3 9:35:06 Class SimpleObject destroyed with lock count 3 9:35:06 Class Static destroyed with lock count 2 9:35:06 Class DestructionEffects destroyed with lock count 2 9:35:06 Class EventHandlers destroyed with lock count 2 9:35:06 Class CBA_Extended_EventHandlers destroyed with lock count 2 9:35:06 Class CBA_NamespaceDummy destroyed with lock count 1 9:35:06 Class CBA_Extended_EventHandlers_base destroyed with lock count 3 9:35:07 Extensions: any idea what is happening here? Steam says all mods are upto date so : /
  18. _locations = [] call F_getTowns;// the function works as intended and set to debug returns an array of locations parsed from F_getLocations _idx = 0; { _loc = _locations select _idx; _pos = locationPosition _loc; _str = name _loc; _strongpoints = nearestLocations[_pos,["StrongpointArea"],750]; _strongpoint = _strongpoints select _idx; _sPos = locationPosition _strongpoint; // do I need another forEach loop for _strongpoints inserted in this function? //here is where the function/scripts fails. As it is only creating one marker but there are 4 strongpoints being parsed _mrk = createMarker[_str,_sPos]; _mrk setMarkerColor "ColorRed"; _mrk setMarkerShape "Ellipse"; _mrk setMarkerSize [50,50]; _idx = _idx + 1; }forEach _locations;
  19. There are registered strongpoints on the CUP Takistan map.
  20. not what to use as the forEach command as there are also modules places in the editor. Also how do I filter out the modules? _array = []; { _count = 0; if(_x isKindOf "Logic")then { _array pushBack _x; _idx = _array select _idx; _pos = getPosASL _idx; _count = _count + 1; }; }forEach _whatDoIputHere?
  21. thank god..... was pounding my head on this. I knew I was overlooking something simple.
  22. How would I use this to generate a random group from a specific side? I've used it to generate a random faction from a certain side, what I'm trying to do is use this command to generate a random infantry group from a random faction.
  23. jakkob4682

    configProperties Question

    Ah I see. Ddnt read all the through.
  24. jakkob4682

    configProperties Question

    The reason for wanting to use config entries was so I don't need to copy and paste 31 different factions, and 124 different infantry group types just to select one random faction and a random infantry group type from that config. So I'm trying to select a random faction from the config. Then using the same config select a random Infantry group type. Thats where I'm stuck.
×