Jump to content

Recommended Posts

Hello there, 

 

I am facing some challenges to implement the findEmptyPosition and avoid collision among vehicles those spawn in the same spot. Some help to fix it will be very much appreciated.  

 

Here below is my code working pretty fine, except for the collisions in some rounds. If you prefer, here is for downloadhttps://drive.google.com/file/d/1NIdU2pLEjl41M3Vlc0dVANRvuK3PFCqd/view?usp=sharing

 

// SIDE SPAWNS
// Spawnpoints for each faction. Only the specific faction can spawn.
_bluAllSpawns 		= ["bluSpawn01","bluSpawn02","bluSpawn03","bluSpawn04","bluSpawn05","bluSpawn06"]; 
_opAllSpawns 		= ["opSpawn01","opSpawn02","opSpawn03","opSpawn04","opSpawn05","opSpawn06"]; 
_indAllSpawns 		= ["indSpawn01","indSpawn02","indSpawn03","indSpawn04","indSpawn05","indSpawn06"];


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


// SHARED DESTINY
// Waypoints where any faction can go.
_goToSharedDestiny 	= ["destinoComum01","destinoComum02","destinoComum03","destinoComum04"];

// SIDE DESTINY
// Waypoints where only the specific faction can go.
_goToDestinyBlu		= ["destinoBlu01","destinoBlu02"];
_goToDestinyOp 		= ["destinoOp01","destinoOp02"];
_goToDestinyInd		= ["destinoInd01","destinoInd02"];

// ANY DESTINY
// Use _goToAnywhere for the group to consider going to both shared destinations and those of all factions.
_goToAnywhere = _goToSharedDestiny + _goToDestinyBlu + _goToDestinyOp + _goToDestinyInd;


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


// BLUFOR GROUPS
// Number of soldiers and type of faction squads.
_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"];
_bluVehLight			= ["B_Quadbike_01_F"];
_bluVehRegular			= ["B_MRAP_01_hmg_F"];
_bluVehHeavy			= ["B_MBT_01_cannon_F"];

// OPFOR GROUPS
// Number of soldiers and type of faction squads.
_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"];
_opVehLight				= ["O_Quadbike_01_F"];
_opVehRegular			= ["O_MRAP_02_hmg_F"];
_opVehHeavy				= ["O_MBT_02_cannon_F"];

// INDEPENDENT GROUPS
// Number of soldiers and type of faction squads.
_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"];
_indVehLight			= ["I_Quadbike_01_F"];
_indVehRegular			= ["I_MRAP_03_hmg_F"];
_indVehHeavy			= ["I_MBT_03_cannon_F"];


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


// BLUFOR STRATEGY
// All faction groups and destinations.

_bluGroup01 = [getmarkerpos (selectRandom _bluAllSpawns), BLUFOR, _bluSquadLight,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_bluGroup01 addWaypoint [getmarkerpos (selectRandom _goToSharedDestiny), 0]; 

_bluGroup02 = [getmarkerpos (selectRandom _bluAllSpawns), BLUFOR, _bluSquadLight,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_bluGroup02 addWaypoint [getmarkerpos (selectRandom _goToDestinyBlu), 0]; 

_bluGroup03 = [getmarkerpos (selectRandom _bluAllSpawns), BLUFOR, _bluSquadRegular,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_bluGroup03 addWaypoint [getmarkerpos (selectRandom _goToSharedDestiny), 0]; 
	_bluGroup03 addWaypoint [getmarkerpos (selectRandom _goToDestinyBlu), 1];
	
_bluGroup04 = [getmarkerpos (selectRandom _bluAllSpawns), BLUFOR, _bluSquadHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_bluGroup04 addWaypoint [getmarkerpos (selectRandom _goToAnywhere), 0]; 
	_bluGroup04 addWaypoint [getmarkerpos (selectRandom _goToAnywhere), 1];

_bluGroup05 = [getmarkerpos (selectRandom _bluAllSpawns), BLUFOR, _bluVehHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	//This one will hold position (no waypoint). 	

_bluGroup06 = [getmarkerpos (selectRandom _bluAllSpawns), BLUFOR, _bluVehHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_bluGroup06 addWaypoint [getmarkerpos (selectRandom _goToDestinyBlu), 0];


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


// OPFOR STRATEGY
// All faction groups and destinations.
 _opGroup01 = [getmarkerpos (selectRandom _opAllSpawns), OPFOR, _opSquadLight,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_opGroup01 addWaypoint [getmarkerpos (selectRandom _goToSharedDestiny), 0]; 

_opGroup02 = [getmarkerpos (selectRandom _opAllSpawns), OPFOR, _opSquadRegular,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_opGroup02 addWaypoint [getmarkerpos (selectRandom _goToSharedDestiny), 0];
	_opGroup02 addWaypoint [getmarkerpos (selectRandom _goToDestinyOp), 1]; 	

_opGroup03 = [getmarkerpos (selectRandom _opAllSpawns), OPFOR, _opSquadHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_opGroup03 addWaypoint [getmarkerpos (selectRandom _goToDestinyOp), 0]; 
	
	
// ................................................................................................................................................

	
// INDEPENDENT STRATEGY
// All faction groups and destinations.
_indGroup01 = [getmarkerpos (selectRandom _indAllSpawns), INDEPENDENT, _indSquadLight,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_indGroup01 addWaypoint [getmarkerpos (selectRandom _goToSharedDestiny), 0]; 

_indGroup02 = [getmarkerpos (selectRandom _indAllSpawns), INDEPENDENT, _indSquadRegular,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_indGroup02 addWaypoint [getmarkerpos (selectRandom _goToSharedDestiny), 0]; 
	_indGroup02 addWaypoint [getmarkerpos (selectRandom _goToDestinyInd), 1];
	_indGroup02 addWaypoint [getmarkerpos (selectRandom _goToDestinyInd), 2];
	_indGroup02 addWaypoint [getmarkerpos (selectRandom _goToSharedDestiny), 3];

_indGroup03 = [getmarkerpos (selectRandom _indAllSpawns), INDEPENDENT, _indSquadHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_indGroup03 addWaypoint [getmarkerpos (selectRandom _goToDestinyInd), 0]; 
	
_indGroup04 = [getmarkerpos (selectRandom _indAllSpawns), INDEPENDENT, _indVehHeavy,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_indGroup04 addWaypoint [getmarkerpos (selectRandom _goToDestinyInd), 0]; 

 

Share this post


Link to post
Share on other sites

Something along the lines of this:

_center = getmarkerpos (selectRandom _bluAllSpawns);
_pos = _center findEmptyPosition [2,20];
_bluGroup01 = [_pos, BLUFOR, _bluSquadLight,[],[],[],[],[],180] call BIS_fnc_spawnGroup;   
	_bluGroup01 addWaypoint [getmarkerpos (selectRandom _goToSharedDestiny), 0]; 

 

  • Thanks 1

Share this post


Link to post
Share on other sites

Working super well. Thanks. 
 

My script is published here:

 

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  

×