Jump to content
Cockheaven

Random position random unit AI respawn script

Recommended Posts

Hi guys, I've been poking around here and redit for a few days trying to find snips of code I can combine and use to revive/respawn/replace some ai in a mp scenario. 

 

What I have: I have a training course with 25 OPFOR AI, and 11 Civ Ai. 36 position markers oriented in the direction I want the unit to face.  

 

What I need: I want to have the OPFOR (all the same exact unit) respawn at random position markers as well as civi to respawn at random position markers. I want to the units to retain the code I have in the init field in eden. The civies can be random or all the same unit not a big deal to me. 

 

Any help is greatly appreciated! 

 

Edit:

 

I'm kind of brute forcing it at this point and I know I'm doing it wrong...… here's the code I'm working with. I need a way to select one of the positions at random, use it to spawn an ai unit then exclude that used position from the next spawn sequence.

Spoiler

_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup1 = [getmarkerpos _spawnpos, EAST, ["C_Scientist_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup2 = [getmarkerpos _spawnpos, EAST, ["C_man_utilityworker_01_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup3 = [getmarkerpos _spawnpos, EAST, ["C_Journalist_01_war_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup4 = [getmarkerpos _spawnpos, EAST, ["C_Man_p_beggar_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup5 = [getmarkerpos _spawnpos, EAST, ["C_Scientist_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup6 = [getmarkerpos _spawnpos, EAST, ["C_man_utilityworker_01_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup7 = [getmarkerpos _spawnpos, EAST, ["C_Journalist_01_war_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup8 = [getmarkerpos _spawnpos, EAST, ["C_Man_p_beggar_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup9 = [getmarkerpos _spawnpos, EAST, ["C_Man_Polo_1_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup10 = [getmarkerpos _spawnpos, EAST, ["C_Man_Casual_1_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup11 = [getmarkerpos _spawnpos, EAST, ["C_Man_Shorts_1_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup12 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup13 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup14 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup15 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup16 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup17 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup18 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup19 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup20 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup21 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup22 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup23 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup24 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup25 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup26 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup27 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup28 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup29 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup30 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup31 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup32 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup33 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup34 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup35 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.
_spawnposarray = ["ShAi1_1","ShAi1_2","ShAi1_3","ShAi1_4","ShAi1_5","ShAi1_6","ShAi1_7","ShAi1_8","ShAi1_9","ShAi1_10","ShAi1_11","ShAi1_12","ShAi1_13","ShAi1_14","ShAi1_15","ShAi1_16","ShAi1_17","ShAi1_18","ShAi1_19","ShAi1_20","ShAi1_21","ShAi1_22","ShAi1_23","ShAi1_24","ShAi1_25","ShAi1_26","ShAi1_27","ShAi1_28","ShAi1_29","ShAi1_30","ShAi1_31","ShAi1_32","ShAi1_33","ShAi1_34","ShAi1_35","ShAi1_36"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition
_mygroup36 = [getmarkerpos _spawnpos, EAST, ["O_Soldier_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.

 

Edited by Cockheaven

Share this post


Link to post
Share on other sites

Update; I've gotten a working script that is performing well and I'm happy with how it functions, however I would like to have each AI that is spawned stay in its place, being able to aim and change stance is preferred. Any help is appreciated my code is below

 

Spoiler

_myunitarray = ["C_Scientist_F","C_man_utilityworker_01_F","C_Journalist_01_war_F","C_Man_p_beggar_F","C_Scientist_F","C_man_utilityworker_01_F","C_Journalist_01_war_F","C_Man_p_beggar_F","C_Man_Polo_1_F","C_Man_Casual_1_F","C_Man_Shorts_1_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F"];
_myunit = selectRandom _myunitarray;
_mygroup1 = [getmarkerpos "ShAi1_1", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;

_myunit = selectRandom _myunitarray;
_mygroup2 = [getmarkerpos "ShAi1_2", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup3 = [getmarkerpos "ShAi1_3", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup4 = [getmarkerpos "ShAi1_4", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup5 = [getmarkerpos "ShAi1_5", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup6 = [getmarkerpos "ShAi1_6", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup7 = [getmarkerpos "ShAi1_7", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup8 = [getmarkerpos "ShAi1_8", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup9 = [getmarkerpos "ShAi1_9", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup10 = [getmarkerpos "ShAi1_10", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup11 = [getmarkerpos "ShAi1_11", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup12 = [getmarkerpos "ShAi1_12", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup13 = [getmarkerpos "ShAi1_13", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup14 = [getmarkerpos "ShAi1_14", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup15 = [getmarkerpos "ShAi1_15", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup16 = [getmarkerpos "ShAi1_16", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup17 = [getmarkerpos "ShAi1_17", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup18 = [getmarkerpos "ShAi1_18", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup19 = [getmarkerpos "ShAi1_19", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup20 = [getmarkerpos "ShAi1_20", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup21 = [getmarkerpos "ShAi1_21", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup22 = [getmarkerpos "ShAi1_22", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup23 = [getmarkerpos "ShAi1_23", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup24 = [getmarkerpos "ShAi1_24", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup25 = [getmarkerpos "ShAi1_25", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup26 = [getmarkerpos "ShAi1_26", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup27 = [getmarkerpos "ShAi1_27", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup28 = [getmarkerpos "ShAi1_28", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup29 = [getmarkerpos "ShAi1_29", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup30 = [getmarkerpos "ShAi1_30", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup31 = [getmarkerpos "ShAi1_31", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup32 = [getmarkerpos "ShAi1_32", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup33 = [getmarkerpos "ShAi1_33", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup34 = [getmarkerpos "ShAi1_34", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup35 = [getmarkerpos "ShAi1_35", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;


_myunit = selectRandom _myunitarray;
_mygroup36 = [getmarkerpos "ShAi1_36", East, [_myunit],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;

 

  • Like 1

Share this post


Link to post
Share on other sites
8 hours ago, Cockheaven said:

Update; I've gotten a working script that is performing well and I'm happy with how it functions, however I would like to have each AI that is spawned stay in its place, being able to aim and change stance is preferred. Any help is appreciated my code is below

 

Most comfortable way would be to grab all map markers with a certain keyword, "shai" in your case:

_markers = allMapMarkers select {toUpper _x find "SHAI" >= 0};
_side = east;
_myunitarray = ["C_Scientist_F","C_man_utilityworker_01_F","C_Journalist_01_war_F","C_Man_p_beggar_F","C_Scientist_F","C_man_utilityworker_01_F","C_Journalist_01_war_F","C_Man_p_beggar_F","C_Man_Polo_1_F","C_Man_Casual_1_F","C_Man_Shorts_1_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F"];
_spawnedGroups = [];

{
	_grp = [getmarkerpos _x, _side, [selectRandom _myunitarray],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;
	_spawnedGroups pushBack _grp;//in case you want to access all spawned groups
	{_x disableAI "PATH"} forEach units _grp;
} forEach _markers;
_spawnedGroups

This will look for all markers containing "shai" (not case sensitive), so you can easily copy paste more markers without having to rename a single one.

Then a random unit will be spawned on each marker, disabling AI path, so the unit will stay put while still able to turn around, change stance and fire at enemies.

 

Cheers

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

Wow, Thank you so much this is working like a charm! Exactly what I was looking for, this will allow me to add more markers easily how very exciting!

  • Like 1

Share this post


Link to post
Share on other sites

So I took that code and modified it to spawn a vehicle convoy and have them proceed to a waypoint, however using the following code the vehicles spawn outside of a group and of course do not pay attention to each other nor the formation command , Its like Mad Max out there lol.

Any help appreciated!

 

Spoiler

_markers = allMapMarkers select {toUpper _x find "CONVOY" >= 0};
_side = east;
_myunitarray = ["CUP_O_BMP_HQ_CSAT","O_APC_WHEELED_02_RCWS_V2_F","O_TRUCK_03_FUEL_F","O_TRUCK_03_AMMO_F","O_APC_TRACKED_02_CANNON_F","O_MBT_02_CANNON_F","O_MBT_04_CANNON_F"];
_spawnedGroups = [];

{
 _grp = [getmarkerpos _x, _side, [selectRandom _myunitarray],[],[],[],[],[],90] call BIS_fnc_spawnGroup;
 _spawnedGroups pushBack _grp;//in case you want to access all spawned groups
  {
   [_grp, getMarkerPos "OCCUPY"] call bis_fnc_taskAttack;
   [_grp, 1] setWaypointSpeed "LIMITED";
   [_grp, 1] setWaypointCombatMode "WHITE";
   [_grp, 1] setWaypointBehaviour "SAFE";
   [_grp, 1] setWaypointFormation "COLUMN";
   } forEach units _grp;
} forEach _markers;
_spawnedGroups

 

Share this post


Link to post
Share on other sites
On 8/3/2018 at 2:12 AM, Grumpy Old Man said:

 

Most comfortable way would be to grab all map markers with a certain keyword, "shai" in your case:


_markers = allMapMarkers select {toUpper _x find "SHAI" >= 0};
_side = east;
_myunitarray = ["C_Scientist_F","C_man_utilityworker_01_F","C_Journalist_01_war_F","C_Man_p_beggar_F","C_Scientist_F","C_man_utilityworker_01_F","C_Journalist_01_war_F","C_Man_p_beggar_F","C_Man_Polo_1_F","C_Man_Casual_1_F","C_Man_Shorts_1_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F","O_Soldier_F"];
_spawnedGroups = [];

{
	_grp = [getmarkerpos _x, _side, [selectRandom _myunitarray],[],[],[],[],[],180] call BIS_Fnc_spawnGroup;
	_spawnedGroups pushBack _grp;//in case you want to access all spawned groups
	{_x disableAI "PATH"} forEach units _grp;
} forEach _markers;
_spawnedGroups

This will look for all markers containing "shai" (not case sensitive), so you can easily copy paste more markers without having to rename a single one.

Then a random unit will be spawned on each marker, disabling AI path, so the unit will stay put while still able to turn around, change stance and fire at enemies.

 

Cheers

 I know this is 5 years old but since it is pinned in the AI Compilation, the post should at least be helpful and work but it does not. I get a code "Error, invalid number in expression"

Share this post


Link to post
Share on other sites
3 hours ago, TangVector said:

 I know this is 5 years old but since it is pinned in the AI Compilation, the post should at least be helpful and work but it does not. I get a code "Error, invalid number in expression"

How do you use it? Do you have markers named with "SHAI" embedded string like "xxxSHAIyyy" ? Did you remove the comment? (depending on where you are using it)

Working and helpful doesn't mean rewrite all fundamentals each time. Asking for help should at least come alongside a minimum context.

 

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×