Jump to content
Sign in to follow this  
Cribsoffer

Spawning groups at random markers

Recommended Posts

I'm trying to spawn a config group of AI units randomly at one of two markers basespawn1 and basespawn2, however the groups do not spawn when I use the BIS_fnc_selectRandom function. I'm calling the script via nul = execVM "Syrtadriveambush2.sqf"; which spawns the group if i disable the random function.

_randomAmbush = ["basespawn1","basespawn2"] call BIS_fnc_selectRandom;

_rebelgrp = [getmarkerpos "_randomAmbush", EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_mas_afr_f_o" >> "Rebel_mas_afr_o" >> "OPF_mas_afr_InfRebel_rec")] call BIS_fnc_spawnGroup;

null = [rebelgrp, (getPos Task1Truck)] call BIS_fnc_taskAttack;

If i disable the random, the group spawns

_rebelgrp = [getmarkerpos "basespawn1", EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_mas_afr_f_o" >> "Rebel_mas_afr_o" >> "OPF_mas_afr_InfRebel_rec")] call BIS_fnc_spawnGroup;

Thanks for the help in advance

Share this post


Link to post
Share on other sites

You don't need the string around _randomAmbush.

_randomAmbush = ["basespawn1","basespawn2"] call BIS_fnc_selectRandom;
_rebelgrp = [getmarkerpos _randomAmbush, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_mas_afr_f_o" >> "Rebel_mas_afr_o" >> "OPF_mas_afr_InfRebel_rec")] call BIS_fnc_spawnGroup;

Share this post


Link to post
Share on other sites
You don't need the string around _randomAmbush.

_randomAmbush = ["basespawn1","basespawn2"] call BIS_fnc_selectRandom;
_rebelgrp = [getmarkerpos _randomAmbush, EAST, (configfile >> "CfgGroups" >> "East" >> "OPF_mas_afr_f_o" >> "Rebel_mas_afr_o" >> "OPF_mas_afr_InfRebel_rec")] call BIS_fnc_spawnGroup;

Thanks Iceman, it works.

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
Sign in to follow this  

×