Jump to content
HaggisRoll

Help with a Simple Random Spawn Script

Recommended Posts

HI all.

 

Wonder if anyone would be as kind enough to help me out with a script for random spawn of ai.

 

 

I would like to place 10 markers down on the map. and then when trigger is activated. an ai will spawn and then move to 1 of 10 random waypoints(markers)

 

I know i need to make another array with the marker positions in it.  But not sure on how to put it all together.

 

At the moment i have it working using the following, however i want to add random start points.

 

_mygroup = [getmarkerpos "HVT", EAST, ["O_officer_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;  // HVT is an empty marker called HVT

_wp1 = _mygroup addWaypoint [getmarkerpos "wp1", 0];  // wp1 is an empty marker called wp1

_wp2 = _mygroup addWaypoint [getmarkerpos "wp2", 0];  // wp1 is an empty marker called wp1

 

I'll use it in a trigger and call it there.

 

 

Any help would be greta.

 

Thanks

A

Share this post


Link to post
Share on other sites
_spawnposarray = ["spawnpos1","spawnpos2","spawnpos3"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition

_mygroup = [getmarkerpos _spawnpos, EAST, ["O_officer_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.

Here's an example.

  • Like 1

Share this post


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

_spawnposarray = ["spawnpos1","spawnpos2","spawnpos3"]; //array with three marker names
_spawnpos = selectRandom _spawnposarray; //select a random spawnposition

_mygroup = [getmarkerpos _spawnpos, EAST, ["O_officer_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.

Here's an example.

 

selectRandom works but a lot of times with me I had issues with it. you can use instead BIS_fnc_selectRandom

Share this post


Link to post
Share on other sites

I don't specify the array and I've never had a problem with selectRandom  when I use it like this:-

 

_spawnpos = selectRandom ["spawnpos1","spawnpos2","spawnpos3"]; //select a random spawnposition from 3 marker names

_mygroup = [getmarkerpos _spawnpos, EAST, ["O_officer_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.

Share this post


Link to post
Share on other sites
1 hour ago, Beerkan said:

I don't specify the array and I've never had a problem with selectRandom  when I use it like this:-

 

 


_spawnpos = selectRandom ["spawnpos1","spawnpos2","spawnpos3"]; //select a random spawnposition from 3 marker names

_mygroup = [getmarkerpos _spawnpos, EAST, ["O_officer_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; //spawn the unit on the random position.

 

Yeah, that works as well, less typing xD. Simpler form tbh.

Share this post


Link to post
Share on other sites

Guys. You make it look so simple.  Thanks a million.

 

Been trying for days before i decied to ask..:dontgetit:

 

Would love to learn more about arma coding, but find it hard to wrap my head around sometimes.

 

 

Share this post


Link to post
Share on other sites

?  Can i do this with Waypoints also based on markers.   Say once the unit spawns in, send him to a random marker based on an array also.

Share this post


Link to post
Share on other sites

I've done it...  :don11:

 

Here it is.   You guys helped with the first part.  Thanks again.

 

Basicly i can spawn a HVT at any of set locations.   Once the HVT spawns, he'll move to 1 of the 3 waypoints.

 

_spawnposition = selectRandom ["wp1","wp2","wp3","wp4","wp5","wp6","wp7","wp8","wp9","wp10"];             //select a random spawnposition from 10 marker names

_HVT = [getmarkerpos _spawnposition, EAST, ["O_officer_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;     //spawn the unit on the random position.

 

_wppostistion = selectRandom ["wp_1","wp_2","wp_3"];                         //    selects a random spawnposition from 3 empty markers named wp_1, wp_2 & wp_3

_waypoint  = _HVT  addWaypoint [getmarkerpos _wppostistion,0];        //  Tells the spawned HVT to add a waypoint at one of the postitions from the _wppostistion array

 

Can i equip this unit with specific gear and clothing?... i.e laser designator.

Share this post


Link to post
Share on other sites

Due to the way you have spawned the "O_officer_F " you have set  _HVT as the name of the Group " O_officer_F " is in, therefore instead of doing say this

_HVT linkItem "Laserdesignator";

you might have to do this to add a laser Designator to him.

leader group _HVT linkItem "Laserdesignator";

Share this post


Link to post
Share on other sites
1 hour ago, Beerkan said:

Due to the way you have spawned the "O_officer_F " you have set  _HVT as the name of the Group " O_officer_F " is in, therefore instead of doing say this


_HVT linkItem "Laserdesignator";

you might have to do this to add a laser Designator to him.


leader group _HVT linkItem "Laserdesignator";

 

 

Nice..   Will have a mess with it and see what i can come up with.

 

 

 

 

Share this post


Link to post
Share on other sites
On 3/22/2017 at 5:18 PM, HaggisRoll said:

I've done it...  :don11:

 

Here it is.   You guys helped with the first part.  Thanks again.

 

Basicly i can spawn a HVT at any of set locations.   Once the HVT spawns, he'll move to 1 of the 3 waypoints.

 

_spawnposition = selectRandom ["wp1","wp2","wp3","wp4","wp5","wp6","wp7","wp8","wp9","wp10"];             //select a random spawnposition from 10 marker names

_HVT = [getmarkerpos _spawnposition, EAST, ["O_officer_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;     //spawn the unit on the random position.

 

_wppostistion = selectRandom ["wp_1","wp_2","wp_3"];                         //    selects a random spawnposition from 3 empty markers named wp_1, wp_2 & wp_3

_waypoint  = _HVT  addWaypoint [getmarkerpos _wppostistion,0];        //  Tells the spawned HVT to add a waypoint at one of the postitions from the _wppostistion array

 

Can i equip this unit with specific gear and clothing?... i.e laser designator.


Hi there. 

 

Thanks for sharing it. Based on it, I've built something similar, but in my trial, all units (West and East) are going unfortunately always to the same waypoint, even with four options available. Actually, I'd like each group goes to one of those destinies options. 

My code limitations nowadays do not help me out to figure out a solution. So if someone could give some support... I'll appreciate it.

 

// COMMOM DESTINIES FOR ALLIES AND ENIMIES
_whereToGo = selectRandom ["destiny01","destiny02","destiny03","destiny04"]; 

//WEST TEAM
_westSpawnPosition = selectRandom ["westSpwn01","westSpwn02","westSpwn03"]; 

	//creating groups
	_westGroup01 = [getmarkerpos _westSpawnPosition, WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_westWaypoint = _westGroup01 addWaypoint [getmarkerpos _whereToGo,0]; 
	_westGroup02 = [getmarkerpos _westSpawnPosition, WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_westWaypoint = _westGroup02 addWaypoint [getmarkerpos _whereToGo,0]; 
	_westGroup03 = [getmarkerpos _westSpawnPosition, WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_westWaypoint = _westGroup03 addWaypoint [getmarkerpos _whereToGo,0]; 

//EAST TEAM
_eastSpawnPosition = selectRandom ["eastSpwn01","eastSpwn02","eastSpwn03"]; 

	//creating groups
	_eastGroup01 = [getmarkerpos _eastSpawnPosition, EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_eastWaypoint = _eastGroup01 addWaypoint [getmarkerpos _whereToGo,0]; 
	_eastGroup02 = [getmarkerpos _eastSpawnPosition, EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_eastWaypoint = _eastGroup02 addWaypoint [getmarkerpos _whereToGo,0]; 
	_eastGroup03 = [getmarkerpos _eastSpawnPosition, EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_eastWaypoint = _eastGroup03 addWaypoint [getmarkerpos _whereToGo,0];


And the example: https://drive.google.com/file/d/1N7Q-aq-Y3O5NmoGtdQ4Wg4ckNhDpdvck/view?usp=sharing

Someone?

Share this post


Link to post
Share on other sites

You are selecting a single destination (_whereToGo) at the beginning of your script, so all groups are going to that destination.

 

So, instead, define the array then select a destination for each group:

// COMMOM DESTINIES FOR ALLIES AND ENEMIES
_whereToGo = ["destiny01","destiny02","destiny03","destiny04"]; 

//WEST TEAM
_westSpawnPosition = selectRandom ["westSpwn01","westSpwn02","westSpwn03"]; 

	//creating groups
	_westGroup01 = [getmarkerpos _westSpawnPosition, WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_westWaypoint = _westGroup01 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 
	_westGroup02 = [getmarkerpos _westSpawnPosition, WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_westWaypoint = _westGroup02 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 
	_westGroup03 = [getmarkerpos _westSpawnPosition, WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_westWaypoint = _westGroup03 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 

//EAST TEAM
_eastSpawnPosition = selectRandom ["eastSpwn01","eastSpwn02","eastSpwn03"]; 

	//creating groups
	_eastGroup01 = [getmarkerpos _eastSpawnPosition, EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_eastWaypoint = _eastGroup01 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 
	_eastGroup02 = [getmarkerpos _eastSpawnPosition, EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_eastWaypoint = _eastGroup02 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 
	_eastGroup03 = [getmarkerpos _eastSpawnPosition, EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_eastWaypoint = _eastGroup03 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0];


 

  • Like 1

Share this post


Link to post
Share on other sites

Awesome, @Harzach

Here are the final results (everything working pretty fine) for new topic readers:

Example: https://drive.google.com/file/d/1N8e0elgxQkB1V-5-vXw2M9PhgP9SzjoR/view?usp=sharing

Or here is the code:

1/2) Into init.sqf file or in a trigger:

null=[] execVM "simpleRandomUnitsSpawn.sqf";

2/2) Into simpleRandomUnitsSpawn.sqf:

// SHARED DESTINIES FOR ALLIES AND ENEMIES
_whereToGo = ["destiny01","destiny02","destiny03","destiny04"];

//WEST TEAM
_westSpawnPosition = ["westSpwn01","westSpwn02","westSpwn03"];

	//creating groups
	_westGroup01 = [getmarkerpos (selectRandom _westSpawnPosition), WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_westGroup01 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 
	_westGroup02 = [getmarkerpos (selectRandom _westSpawnPosition), WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_westGroup02 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 
	_westGroup03 = [getmarkerpos (selectRandom _westSpawnPosition), WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_westGroup03 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 

//EAST TEAM
_eastSpawnPosition = ["eastSpwn01","eastSpwn02","eastSpwn03"]; 

	//creating groups
	_eastGroup01 = [getmarkerpos (selectRandom _eastSpawnPosition), EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_eastGroup01 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 
	_eastGroup02 = [getmarkerpos (selectRandom _eastSpawnPosition), EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_eastGroup02 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 
	_eastGroup03 = [getmarkerpos (selectRandom _eastSpawnPosition), EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_eastGroup03 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0];

Cheers from Southern Brazil 😉

  • Like 3

Share this post


Link to post
Share on other sites

I got a question!


In the line below, what should I do to add automatically a need waypoint to _whereToGo?
The idea is to config some groups to walk non-stop through _whereToGo positions.

_westGroup01 = [getmarkerpos (selectRandom _westSpawnPosition), WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
_westGroup01 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0];



 

Share this post


Link to post
Share on other sites

I'm not sure what you mean. Currently, each group will move to a waypoint placed at a "_whereToGo" position. Once they get there, what do you want them to do?

Share this post


Link to post
Share on other sites
1 hour ago, Harzach said:

I'm not sure what you mean. Currently, each group will move to a waypoint placed at a "_whereToGo" position. Once they get there, what do you want them to do?

 

Move to another place of _whereToGo array, but automatically, in looping forever, without I set on code a new line of _westGroup01 addWaypoint.

How it's today:
I need to add new "addWaypoint" lines manually for _westGroup01 walk further.

_westGroup01 = [getmarkerpos (selectRandom _westSpawnPosition), WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
_westGroup01 addWaypoint [getmarkerpos (selectRandom _whereToGo), 0]; 
_westGroup01 addWaypoint [getmarkerpos (selectRandom _whereToGo), 1];
_westGroup01 addWaypoint [getmarkerpos (selectRandom _whereToGo), 2];
_westGroup01 addWaypoint [getmarkerpos (selectRandom _whereToGo), 3];

I would like some code that makes _westGroup01 walk forever through _whereToGo array options.

Share this post


Link to post
Share on other sites

OK, we need to approach this slightly differently. The main goal is to use setWaypointStatements to add a new waypoint when the current waypoint is completed. To do this, we need to pass a lot of information to the initial waypoint, and to pass that information again to the next waypoint. The easiest way to do this is to create a simple function.

whereToGo = ["destiny01","destiny02","destiny03","destiny04"];

HARZ_fnc_goOverThere = {

	params ["_group"];
	
	_where = getmarkerpos (selectRandom whereToGo);
	_waypoint = _group addWaypoint [_where, 0]; 
	_waypoint setWaypointStatements ["true", "[group this] spawn HARZ_fnc_goOverThere"];
	
};

_westSpawnPosition = ["westSpwn01","westSpwn02","westSpwn03"];
_eastSpawnPosition = ["eastSpwn01","eastSpwn02","eastSpwn03"];

for "_i" from 0 to 2 do {
	
	_wGroup = [getmarkerpos (selectRandom _westSpawnPosition), WEST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup; 
	[_wGroup] spawn HARZ_fnc_goOverThere; 
	_eGroup = [getmarkerpos (selectRandom _eastSpawnPosition), EAST, ["B_sniper_F", "B_spotter_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;  
	[_eGroup] spawn HARZ_fnc_goOverThere; 
	
};

 

First, we define the array of destinations as a global variable instead of a local ("whereToGo" instead of "_whereToGo") so it can exist outside the scope of the script.

 

Next, a simple function that selects and sets a new waypoint.

Then, a streamlined spawning of the groups. We use the function to set the first waypoint.

All groups will move to new waypoints until they die, stopping to fight when necessary.
 

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

@Harzach, hey.

We are almost there. The code below is working and you can see funny engagements. 

I've noticed two issues:

  • This error when each new waypoint is created: '[group this] spawn fnc_GoToShareDestin|#|' Error Missing ;
  • Somehow and sometimes (rares), the vehicle just stops to create new waypoints, turning its engine off, never returning to rolling again (Troops by foot are totally ok, never stopping). 

Do you have some clue?
 

The updated code:

// FACTION SPAWNS POINTS
// Spawnpoints for each faction. Only the specific faction can spawn.
	_bluAllSpawns 			= ["bluSpawn01","bluSpawn02","bluSpawn03","bluSpawn04"]; 
	_opAllSpawns 			= ["opSpawn01","opSpawn02","opSpawn03","opSpawn04"]; 
	_indAllSpawns 			= ["indSpawn01","indSpawn02","indSpawn03","indSpawn04"];

// ................................................................................................................................................

// DESTINATION: FACTION
// Random waypoints where only the specific faction can go.
	goToDestinBlu			= ["destinBlu01","destinBlu02"];
	goToDestinOp 			= ["destinOp01","destinOp02"];
	goToDestinInd			= ["destinInd01","destinInd02"];

// DESTINATION: SHARED
// Random waypoints where any faction can go.
	goToSharedDestin 		= ["destinShared01","destinShared02","destinShared03","destinShared04"];

// DESTINATION: ANY
// Use goToAnywhere for the group to consider going to both shared destinations and those of all factions.
	goToAnywhere = goToSharedDestin + goToDestinBlu + goToDestinOp + goToDestinInd;

// ................................................................................................................................................

// MOVING: FOREVER AND ONLY TO SHARED
// The group will move continuously, considering only shared destinations.
	fnc_goToSharedDestin = {

		params ["_grp"];
		_where = getmarkerpos (selectRandom goToSharedDestin);
		_wp = _grp addWaypoint [_where, 0]; 
		_wp setWaypointTimeout [5, 30, 60];
		_wp setWaypointStatements ["true", "[group this] spawn fnc_goToSharedDestin"];
	};

// MOVING: FOREVER AND ONLY TO FACTION
// The group will move continuously, considering only their faction destinations.
	fnc_goToFactionDestinBlu = { // Blufor
		params ["_grp"];
		_where = getmarkerpos (selectRandom goToDestinBlu);
		_wp = _grp addWaypoint [_where, 0]; 
		_wp setWaypointTimeout [5, 30, 60];
		_wp setWaypointStatements ["true", "[group this] spawn fnc_goToFactionDestinBlu"];
	};
	fnc_goToFactionDestinOp = { // Opfor
		params ["_grp"];
		_where = getmarkerpos (selectRandom goToDestinOp);
		_wp = _grp addWaypoint [_where, 0]; 
		_wp setWaypointTimeout [5, 30, 60]; 
		_wp setWaypointStatements ["true", "[group this] spawn fnc_goToFactionDestinOp"];
	};
	fnc_goToFactionDestinInd = { // Independent
		params ["_grp"];
		_where = getmarkerpos (selectRandom goToDestinInd);
		_wp = _grp addWaypoint [_where, 0]; 
		_wp setWaypointTimeout [5, 30, 60]; 
		_wp setWaypointStatements ["true", "[group this] spawn fnc_goToFactionDestinInd"];
	};

// MOVING: FOREVER AND TO ANYWHERE
// The group will move continuously and to all destinations.
	fnc_goToAnywhere = {
		params ["_grp"];
		_where = getmarkerpos (selectRandom goToAnywhere);
		_wp = _grp addWaypoint [_where, 0]; 
		_wp setWaypointTimeout [5, 30, 60]; 
		_wp setWaypointStatements ["true", "[group this] spawn fnc_goToAnywhere"];	
	};

// ................................................................................................................................................

// GROUPS: BLUFOR
// Number of soldiers and type of faction squads.
	// Soldiers
	_bluSquadLight			= ["B_Soldier_TL_F", "B_soldier_AR_F"];
	_bluSquadRegular 		= ["B_Soldier_TL_F", "B_soldier_AR_F", "B_soldier_AR_F", "B_soldier_AR_F"];
	_bluSquadHeavy 			= ["B_Soldier_TL_F", "B_soldier_AR_F", "B_soldier_AR_F", "B_soldier_AR_F", "B_soldier_AR_F", "B_soldier_AR_F"];
	// Vehicles
	_bluVehLight			= ["B_Quadbike_01_F"];
	_bluVehRegular			= ["B_MRAP_01_hmg_F"];
	_bluVehHeavy			= ["B_MBT_01_TUSK_F"];

// GROUPS: OPFOR
// Number of soldiers and type of faction squads.
	// Soldiers
	_opSquadLight			= ["O_Soldier_TL_F", "O_soldier_AR_F"];
	_opSquadRegular			= ["O_Soldier_TL_F", "O_soldier_AR_F", "O_soldier_AR_F", "O_soldier_AR_F"];
	_opSquadHeavy			= ["O_Soldier_TL_F", "O_soldier_AR_F", "O_soldier_AR_F", "O_soldier_AR_F", "O_soldier_AR_F", "O_soldier_AR_F"];
	// Vehicles
	_opVehLight				= ["O_Quadbike_01_F"];
	_opVehRegular			= ["O_MRAP_02_hmg_F"];
	_opVehHeavy				= ["O_MBT_02_cannon_F"];

// GROUPS: INDEPENDENT
// Number of soldiers and type of faction squads.
	// Soldiers
	_indSquadLight			= ["I_Soldier_TL_F", "I_Soldier_AR_F"];
	_indSquadRegular		= ["I_Soldier_TL_F", "I_Soldier_AR_F", "I_Soldier_AR_F", "I_Soldier_AR_F"];
	_indSquadHeavy			= ["I_Soldier_TL_F", "I_Soldier_AR_F", "I_Soldier_AR_F", "I_Soldier_AR_F", "I_Soldier_AR_F", "I_Soldier_AR_F"];
	// Vehicles
	_indVehLight			= ["I_Quadbike_01_F"];
	_indVehRegular			= ["I_MRAP_03_hmg_F"];
	_indVehHeavy			= ["I_MBT_03_cannon_F"];

	
// ................................................................................................................................................
	
// STRATEGY: BLUFOR 
// Setting the group numbers and their gears and destination.

	// Soldiers Blufor
	_bluGroup = [getmarkerpos (selectRandom _bluAllSpawns), BLUFOR, _bluSquadLight,[],[],[],[],[],180] call BIS_fnc_spawnGroup; 
		[_bluGroup] spawn fnc_goToFactionDestinBlu; 
	
	_bluGroup = [getmarkerpos (selectRandom _bluAllSpawns), BLUFOR, _bluSquadHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup; 
		[_bluGroup] spawn fnc_goToAnywhere; 

						// Vehicles Blufor
						_bluVehSpawn 	= getmarkerpos (selectRandom _bluAllSpawns);
						_bluVehPos 		= _bluVehSpawn findEmptyPosition [2,20];
						_bluVeh 		= [_bluVehPos, BLUFOR, _bluVehHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
							[_bluVeh] spawn fnc_goToSharedDestin;



// ................................................................................................................................................

// STRATEGY: OPFOR
// Setting the group numbers and their gears and destination.

	// Soldiers Opfor
	 _opGroup = [getmarkerpos (selectRandom _opAllSpawns), OPFOR, _opSquadLight,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
		[_opGroup] spawn fnc_goToFactionDestinOp; 
		
	_opGroup = [getmarkerpos (selectRandom _opAllSpawns), OPFOR, _opSquadHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
		[_opGroup] spawn fnc_goToAnywhere;
		
						// Vehicles Opfor
						_opVehSpawn 	= getmarkerpos (selectRandom _opAllSpawns);
						_opVehPos 		= _opVehSpawn findEmptyPosition [2,20];
						_opVeh 			= [_opVehPos, OPFOR, _opVehHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
							[_opVeh] spawn fnc_goToSharedDestin;
							

		
// ................................................................................................................................................


// STRATEGY: INDEPENDENT
// Setting the group numbers and their gears and destination.

	// Soldiers Independent
	_indGroup = [getmarkerpos (selectRandom _indAllSpawns), INDEPENDENT, _indSquadLight,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
		[_indGroup] spawn fnc_goToFactionDestinInd;  
		
	_indGroup = [getmarkerpos (selectRandom _indAllSpawns), INDEPENDENT, _indSquadHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
		[_indGroup] spawn fnc_goToAnywhere;  


						// Vehicles Independent
						_indVehSpawn 	= getmarkerpos (selectRandom _indAllSpawns);
						_indVehPos 		= _indVehSpawn findEmptyPosition [2,20];
						_indVeh 		= [_indVehPos, INDEPENDENT, _indVehHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
							[_indVeh] spawn fnc_goToSharedDestin;
						

 

Share this post


Link to post
Share on other sites

First issue: 

 

There is a bug on the forums where copy/pasting might result in hidden characters corrupting the text. Fortunately, it is easy to check for and to fix. Copy your code and paste it into a code block, and the corrupt characters will appear as red dots:

 

lNMDtRs.png

 

Simply delete the red dots, re-copy your code and close the code block. No need to actually post anything, just use the code block as a test environment.

 

Second issue:

 

This might be a direct result of the first, as the waypoint statement wasn't being written, so new waypoints weren't being created.

  • Like 1
  • Haha 1

Share this post


Link to post
Share on other sites

I just forgot to tell you, guys. 

Here is the final script, (recently updated) working as gold for multiplayer (hosted and dedicated) and single-player missions. 😉
 



Cheers. 

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

×