zagor64bz 1225 Posted March 2, 2018 In a SP WIP mission I have defined a custom composition of objects to spawn at a random position.Everything work as expected. I want to "attach" at the composition a group of AI guarding it. Is it possible to do that? How? Since the spawning is random, the only thing that come to my mind to be sure the guards spawn where the composition is, is to attach to it the guards. Am I a fool to think that? Thank you. Ps: I have a total of 9 custom composition spawning on an array of 36 positions...so fill every possible position with units I think is a bit too much..or not? Share this post Link to post Share on other sites
lordfrith 401 Posted March 2, 2018 if you're spawning the custom composition with "_compObjects = [params] call BIS_fnc_ObjectsMapper" then it should return an array of all the spawned objects into _compObjects. then you could find the object you want out of this array and spawn units and run scripts. Quote { if (_x isKindOf "moulinRouge") then {call Zag_fnc_GoGoDancers}; } forEach _compObjects; 9 compositions doesn't sound like too much, are they enormous compositions that could deploy 90 units each? Share this post Link to post Share on other sites
pierremgi 4822 Posted March 3, 2018 Compositions are sets of objects , never mind the type, if I'm right. Mine are made also with AIs. Share this post Link to post Share on other sites
zagor64bz 1225 Posted March 3, 2018 29 minutes ago, lordfrith said: if you're spawning the custom composition with "_compObjects = [params] call BIS_fnc_ObjectsMapper" then it should return an array of all the spawned objects into _compObjects. then you could find the object you want out of this array and spawn units and run scripts. 6 minutes ago, pierremgi said: Compositions are sets of objects , never mind the type, if I'm right. Mine are made also with AIs. Ok, adding the unit to "_compObjects" should not be a problem then...but how do I assign waypoints/patrol scripts to them? Here it is how I spawn the composition, directly from the init.sqf: Spoiler box1Composition = [ ["Land_WoodenCrate_01_stack_x5_F",[1.59375,1.42822,0],214.435,1,0,[],"","",true,false], ["Land_WoodenCrate_01_stack_x5_F",[-1.104,2.03027,0],0,1,0,[],"","",true,false], ["Land_PaperBox_open_empty_F",[-3.10986,1.3479,0],0,1,0,[],"","",true,false], ["Box_Syndicate_Ammo_F",[-4.25195,0.480713,0],65.1956,1,0,[],"","",true,false], ["CamoNet_INDP_open_F",[-1.02832,3.36792,0],0,1,0,[],"","",true,false], ["Box_Syndicate_Ammo_F",[-3.25195,3.10571,0],5.19601,1,0,[],"","",true,false], ["Land_WoodenCrate_01_stack_x5_F",[-1.5083,4.62476,0],62.0768,1,0,[],"","",true,false], ["Box_Syndicate_WpsLaunch_F",[1.87305,4.60571,0],150,1,0,[],"","",true,false], ["Box_Syndicate_WpsLaunch_F",[2.99805,3.98071,0],300,1,0,[],"","",true,false], ["Land_PaperBox_closed_F",[-4.83252,2.32983,0],210,1,0,[],"","",true,false], ["Land_WoodenBox_F",[0.395752,5.60889,0],45.0009,1,0,[],"","",true,false], ["Land_WoodenCrate_01_stack_x5_F",[-3.61597,5.46729,0],0,1,0,[],"","",true,false], ["Land_CargoBox_V1_F",[1.37305,6.73071,0],120,1,0,[],"","",true,false], ["Land_PaperBox_closed_F",[3.25488,6.0603,0],150,1,0,[],"","",true,false], ["Land_WoodenCrate_01_stack_x5_F",[-1.79639,7.36206,0],150.665,1,0,[],"","",true,false] ]; box2Composition = [ ["Land_BagFence_01_long_green_F",[-0.644043,-20.6772,-0.000999928],0,1,0,[0,0],"","",true,false], ["Land_BagFence_01_long_green_F",[2.35645,-20.6772,-0.000999928],0,1,0,[0,0],"","",true,false], ["Land_BagFence_01_long_green_F",[-3.50195,-20.7085,-0.000999928],180,1,0,[0,0],"","",true,false], ["Land_BagFence_01_round_green_F",[4.77686,-21.4504,-0.00130129],225,1,0,[0,0],"","",true,false], ["Land_PaperBox_open_full_F",[0.891602,-22.0112,0],105,1,0,[0,-0],"","",true,false], ["Land_Pallet_MilBoxes_F",[-1.38135,-22.3801,0],158.49,1,0,[0,-0],"","",true,false], ["Box_NATO_AmmoOrd_F",[2.65088,-22.2637,-1.90735e-006],165,1,0,[-0.000866338,0.0014376],"","",true,false], ["Box_NATO_Ammo_F",[-4.97461,-22.0139,-4.76837e-007],195.003,1,0,[0.000345374,0.000257702],"","",true,false], ["CamoNet_BLUFOR_F",[-1.28857,-22.6189,-0.895],358.874,1,0,[0,0],"","",true,false], ["Land_Pallet_MilBoxes_F",[-3.46533,-22.6934,0],150,1,0,[0,-0],"","",true,false], ["Box_NATO_AmmoOrd_F",[1.30078,-23.3799,-1.90735e-006],53.6537,1,0,[-0.000876156,0.00154341],"","",true,false], ["Land_Pallet_MilBoxes_F",[3.604,-23.853,0],150,1,0,[0,-0],"","",true,false], ["Box_NATO_WpsLaunch_F",[-2.34961,-24.3887,-9.53674e-007],29.9983,1,0,[0.000332913,-5.49361e-006],"","",true,false], ["Land_Pallet_MilBoxes_F",[-0.174805,-24.6609,0],78.7814,1,0,[0,0],"","",true,false], ["Land_BagFence_01_long_green_F",[5.37988,-23.9346,-0.000999928],90,1,0,[0,-0],"","",true,false], ["Box_NATO_AmmoOrd_F",[2.41797,-24.5098,-1.43051e-006],357.42,1,0,[-0.0009177,0.0012057],"","",true,false], ["Box_NATO_WpsLaunch_F",[-3.47461,-24.6387,-0.00100136],60,1,0,[0.000161314,2.5317e-005],"","",true,false], ["Box_NATO_WpsLaunch_F",[1.53613,-24.8765,-0.00100088],29.9981,1,0,[0.000415548,-6.19237e-006],"","",true,false] ]; box3Composition = [ ["CamoNet_INDP_F",[-0.973145,-2.16406,0],0,1,0,[0,0],"","",true,false], ["Land_WoodenCrate_01_stack_x3_F",[1.81885,-2.50488,0],0,1,0,[0,0],"","",true,false], ["Land_WoodenCrate_01_stack_x5_F",[-1.00195,-3.04712,0],47.8472,1,0,[0,0],"","",true,false], ["Land_CratesWooden_F",[-3.62793,-1.46021,0],0,1,0,[0,0],"","",true,false], ["Land_CratesWooden_F",[1.08301,-4.46045,0],0,1,0,[0,0],"","",true,false], ["Land_CratesWooden_F",[-3.09277,-3.80591,0],236.253,1,0,[0,0],"","",true,false], ["Land_WoodenCrate_01_F",[-3.56006,-3.38013,-0.00199556],210.486,1,0,[-0.000346842,0.00275014],"","",true,false] ]; [ [[4858.38,21980.7],[3941.57,17572],[10575.3,17442.2],[13064,19749.6]] call BIS_fnc_selectRandom, random 360, box1Composition ] call BIS_fnc_objectsMapper; [ [[16786.5,21908.9],[10575.5,22104.8],[9463.06,20213.2],[6558.94,18671.2]] call BIS_fnc_selectRandom, random 360, box1Composition ] call BIS_fnc_objectsMapper; [ [[3550.65,20002.7],[13457.7,22664.6],[8081.54,16836.1],[6904.5,22201.4]] call BIS_fnc_selectRandom, random 360, box1Composition ] call BIS_fnc_objectsMapper; [ [[11329,14436.6],[18257.1,13608.4],[21467.6,8674.27],[20080.4,6736.8]] call BIS_fnc_selectRandom, random 360, box2Composition ] call BIS_fnc_objectsMapper; [ [[16452.2,9984.23],[11201.8,8718.12],[11554.2,7045.2],[9215.65,8065.02]] call BIS_fnc_selectRandom, random 360, box2Composition ] call BIS_fnc_objectsMapper; [ [[3787.09,10258.3],[4588.67,12819.9],[8278.2,14844.7],[8416.38,12953.7]] call BIS_fnc_selectRandom, random 360, box2Composition ] call BIS_fnc_objectsMapper; [ [[26912.3,24293.7],[28319.5,25775.3],[23669,23780.7],[27776.2,22265.1]] call BIS_fnc_selectRandom, random 360, box3Composition ] call BIS_fnc_objectsMapper; [ [[23255.4,21841.2],[25257.6,22662.6],[24798.6,19140.9],[22119.9,20403.6]] call BIS_fnc_selectRandom, random 360, box3Composition ] call BIS_fnc_objectsMapper; [ [[22576.1,17013.2],[21138.5,16937.3],[21046.4,19772.6],[18853.2,18142.3]] call BIS_fnc_selectRandom, random 360, box3Composition ] call BIS_fnc_objectsMapper; Share this post Link to post Share on other sites
zagor64bz 1225 Posted March 3, 2018 Searching a bit more, I found this answer from you Pierre: Hello! So ive been trying for quite a while now to make/ or find a script that allows me to place a marker/ or object on the map that when close enough (say 1500m) it will activate and spawn a random AI patrol. ////////////////////////////////////////////////////////////////////////// Pierre MGI say: You don't need markers as you can spawn on trigger's positions. And you don't need any trigger's name. in on activation: thisTrigger execVM "patrol.sqf" in patrol.sqf: _trigger= _this; _IndiGroup= [getpos _trigger, resistance, ["I_Soldier_TL_F","I_Soldier_F","I_Soldier_F","I_Soldier_AR_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; [_IndiGroup, getpos _trigger, 1000] call BIS_fnc_taskPatrol; .... It still apply/useful? Share this post Link to post Share on other sites
pierremgi 4822 Posted March 3, 2018 You can grab the units by return value of the Bis_fnc_objectMapper (array of created objects). Then you need to apply the Bis_fnc_taskPatrol. Perhaps Larrow's script is more efficient to save some data with units. Not sure. NB : It's easy to setVariable for any data (like waypoints paths) affected to a unit,.. if foreseen. Unfortunately, there is no param for that in object mapper. So, you have to work on spawned units or objects. But as you need to randomize the patrol, it's not so bad! Share this post Link to post Share on other sites
zagor64bz 1225 Posted March 3, 2018 I got it working using your code in a trigger and a guards team tied to a simulation manager module.May be not the most efficient or elegant one, but hey, IT WORKS!!! Share this post Link to post Share on other sites