Jump to content
Sign in to follow this  
mith86arg

Random spawning

Recommended Posts

Hi guys, im trying to spawn random groups and random markers location... i found one way to do it thanks to youtube but the script only work with single units.

This is the script

func_spawnEnemy = 
{
   _spawner = true;
   while {_spawner} do
   {
       _markers = ["SP1","SP2","SP3","SP4","SP5"];
       _spawnpos = _markers call BIS_fnc_selectRandom;
       _pos = getMarkerPos _spawnpos;

       if(_pos distance player < 10) then
       {
           _markers = _markers - [_spawnpos];
       }
       else
       {
           _unit = (createGroup enemy_side) createUnit ["O_Soldier_F", _pos, [], 0, "NONE"];
           [_unit] execVM "loadout.sqf";
           _spawner = false;
       };
   }    
};

"loadout.sqf" tells that unit to spawn with specific set of items. (no chest, no helm, NVG, no secondary, one MG, 5 mags, 1 medkit.)

I want to know if there any way the spawn a whole enemy side group with editing this?

Also, on my reasearch i found something called RUIS Script for Arma 2, idk so much about scripting but i can see a very powerfull spawning tool there, but all the wall of text is related to arma 2 units. Does exist an ARMA III version of Ruis Script?

That's all guys, ty in advance!

Share this post


Link to post
Share on other sites

You can use BIS_fnc_spawnGroup.

This creates an OPFOR infantry squad and executes the loadout.sqf for each unit:

func_spawnEnemy = 
{
_spawner = true;
   while {_spawner} do
   {
       _markers = ["SP1","SP2","SP3","SP4","SP5"];
       _spawnpos = _markers call BIS_fnc_selectRandom;
       _pos = getMarkerPos _spawnpos;

       if(_pos distance player < 10) then
       {
           _markers = _markers - [_spawnpos];
       }
       else
       {
           _group = [_pos, enemy_side, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call BIS_fnc_spawnGroup;
           {
           	[_x] execVM "loadout.sqf";
           } foreach units _group;
           _spawner = false;
       };
   }    
};

As you can see the changes are minimal, instead of a unit it creates a group, then goes through each group member and applies the loadout.sqf.

Share this post


Link to post
Share on other sites

omg ty!!! and it works like a charm!

Maybe for you was easy, last night i went to sleep thinking about this and wake up this morning still thinking how to spawn groups lol ty!

Also i see that i can spawn "addons" groups too with that line, i mean:

_group = [_pos, enemy_side, (configfile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfSquad")] call BIS_fnc_spawnGroup;

if i write >>"EAST">>"rhs_faction_tv">>"infantry">>"name of a group inside this faction")] blablabla

right?

Share this post


Link to post
Share on other sites

New one, is possible to spawn a random group from a list of groups? i mean.. the script u gave me is awesome and works, but it allways spawn the same units i found the next line

_helo = ["B_Heli_Light_01_armed_F","B_Heli_Attack_01_F","B_Heli_Transport_01_camo_F"] call BIS_fnc_selectRandom;

wich makes the game select one of these helos from the pool and spawn it, can i adapat it to the script you gave me but with a group pool??

Share this post


Link to post
Share on other sites

Yes you can, but you must input values of the infantry groups in the array and use proper syntax. Note that you use only infantry groups from CfgGroups nothing else.

Share this post


Link to post
Share on other sites

mmmmmmm "proper syntax" i'll research a little more on how to do it, right now there is a 100% chance to fuck up the whole script if i touch it a little more hahahaha, but hey, ty! at least you tell me that it can be done, so that's great news!

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  

×