Jump to content
Sign in to follow this  
hogmason

spawngroup spacing

Recommended Posts

i am trying to create a convoy and have hit a few issues.

first this is the convoy "working good well they spawn ;)

_supplypatrol = [_startpos, east,["LandRover_MG_TK_EP1", "LandRover_SPG9_TK_EP1","UAZ_MG_TK_EP1","UAZ_MG_TK_EP1","T72_TK_EP1","UAZ_AGS30_TK_EP1","Ural_ZU23_TK_EP1","UralRepair_TK_EP1","UralRepair_TK_EP1","UralRepair_TK_EP1"],[],[],[],[],[],180]  call BIS_fnc_spawnGroup;

1) is there a away i can spawn the convoy i.e group already in the column formation if not how can i give them spacing so they dont spawn on each other

this is how i spawn them "note not all the code is here only the marker part full code at bottom of page"

_supplypatrol = [[color="#FF0000"]_startpos[/color], east,["LandRover_MG_TK_EP1", "LandRover_SPG9_TK_EP1","UAZ_MG_TK_EP1","UAZ_MG_TK_EP1","T72_TK_EP1","UAZ_AGS30_TK_EP1","Ural_ZU23_TK_EP1","UralRepair_TK_EP1","UralRepair_TK_EP1","UralRepair_TK_EP1"],[],[],[],[],[],180]  call BIS_fnc_spawnGroup


//startpos
_startpos = getMarkerPos "startmkr";

	           _gamelogic = center;
	           _towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; 
	           _convoy_MARKER_start_position = position (_towns select (floor (random (count _towns))));

                  _Convoy_start_marker = createMarkerLocal ["startmkr", _convoy_MARKER_start_position];
                  _Convoy_start_marker setMarkerTypeLocal "mil_start";
                  _Convoy_start_marker setMarkerColorLocal "ColorRed";
			      _Convoy_start_marker setMarkerTextLocal "Convoy Start.";


full code

waituntil {!isnil "bis_fnc_init"};
if (isnil "convoy_reached_dest") then {convoy_reached_dest = 0;};
 if (isnil "convoy_destroyed") then {convoy_destroyed = 0;};
   convoy_reached_dest = 1; publicvariable "convoy_reached_dest";
     convoy_destroyed = 1; publicvariable "convoy_destroyed";

//set vars
_startpos = getMarkerPos "startmkr";
_endpos = getMarkerPos "endmkr";


//create convoy
_supplypatrol = [_startpos, east,["LandRover_MG_TK_EP1", "LandRover_SPG9_TK_EP1","UAZ_MG_TK_EP1","UAZ_MG_TK_EP1","T72_TK_EP1","UAZ_AGS30_TK_EP1","Ural_ZU23_TK_EP1","UralRepair_TK_EP1","UralRepair_TK_EP1","UralRepair_TK_EP1"],[],[],[],[],[],180]  call BIS_fnc_spawnGroup;


// set skill
//_leader = leader _supplypatrol;
//_leader setRank "LIEUTENANT";
_supplypatrol allowFleeing 0;
//_supplypatrol setskill 1;
_supplypatrol setBehaviour "SAFE";
_supplypatrol setCombatMode "GREEN";
_supplypatrol setFormation "COLUMN";
_supplypatrol setSpeedMode "LIMITED";

//create patrol waypoints
_wp =_supplypatrol addWaypoint[_startpos, 0];
_wp setWaypointBehaviour "SAFE";
_wp setWaypointSpeed "NORMAL";
_wp setwaypointtype "MOVE";
_wp setWaypointFormation "COLUMN";
_wp setWaypointTimeout [60,80,70];
_wp=_supplypatrol addWaypoint[_endpos, 0];





_grp = units _supplypatrol;
while {convoy_destroyed == 1 && convoy_reached_dest == 1} do 
{
	if (count _grp < 5) then 
	{

	    convoy_destroyed = 0; publicvariable "POWs_death_Limit";

	};

	if ({(_x distance POW_safe) <30} count _grp  == (count _grp)) then 
	{

         	convoy_reached_dest = 0; publicvariable "POWs_rescued";
			 sleep 20;

	};

	{
		if (!alive _x) then {_grp = _grp - [_x]};
	}foreach _grp;
	sleep 1;
};


markers are on diff code this is them

HOG_convoyMKRS_fnc = {
	           _gamelogic = center;
	           _towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; 
	           _convoy_MARKER_start_position = position (_towns select (floor (random (count _towns))));

                  _Convoy_start_marker = createMarkerLocal ["startmkr", _convoy_MARKER_start_position];
                  _Convoy_start_marker setMarkerTypeLocal "mil_start";
                  _Convoy_start_marker setMarkerColorLocal "ColorRed";
			      _Convoy_start_marker setMarkerTextLocal "Convoy Start.";

				  	_gamelogic = center;
	                _towns = nearestLocations [getPosATL _gamelogic, ["NameVillage","NameCity","NameCityCapital"], 25000]; 
	                _convoy_MARKER_end_position = position (_towns select (floor (random (count _towns))));

				 	  _Convoy_start_marker = createMarkerLocal ["endmkr", _convoy_MARKER_end_position];
                      _Convoy_start_marker setMarkerTypeLocal "mil_end";
                      _Convoy_start_marker setMarkerColorLocal "ColorYellow";
			          _Convoy_start_marker setMarkerTextLocal "Convoy End!!!.";

};	

Share this post


Link to post
Share on other sites

1) is there a away i can spawn the convoy i.e group already in the column formation if not how can i give them spacing so they dont spawn on each other

By not using BIS_fnc_spawnGroup and doing it the harder way... spawning one at a time and spawning and moving in the troops.

I was thinking that maybe you could spawn them somewhere else and then move them and line them up. That would be easy enough... but using BIS_fnc_spawnGroup... they spawn on top of each other and are being damaged in the process.

It's pretty obvious to me that BIS_fnc_spawnGroup is not meant to spawn multiple vehicles.

Share this post


Link to post
Share on other sites

There is 4th argument in BIS_fnc_spawnGroup which defines offset relative to position you sent in 1st argument (_startpos).

Here is solution for you

_angle = 180;
_space = 10;
_vector = [sin _angle, cos _angle]; //Vector for supplied angle. It will be multiplied by spacing length and used as offset
_supplypatrol = [_startpos, east,
[
	"LandRover_MG_TK_EP1",
	"LandRover_SPG9_TK_EP1",
	"UAZ_MG_TK_EP1",
	"UAZ_MG_TK_EP1",
	"T72_TK_EP1",
	"UAZ_AGS30_TK_EP1",
	"Ural_ZU23_TK_EP1",
	"UralRepair_TK_EP1",
	"UralRepair_TK_EP1",
	"UralRepair_TK_EP1"
],
[
	[_vector, _space * 0] call BIS_fnc_vectorMultiply,
	[_vector, _space * 1] call BIS_fnc_vectorMultiply,
	[_vector, _space * 2] call BIS_fnc_vectorMultiply,
	[_vector, _space * 3] call BIS_fnc_vectorMultiply,
	[_vector, _space * 4] call BIS_fnc_vectorMultiply,
	[_vector, _space * 5] call BIS_fnc_vectorMultiply,
	[_vector, _space * 6] call BIS_fnc_vectorMultiply,
	[_vector, _space * 7] call BIS_fnc_vectorMultiply,
	[_vector, _space * 8] call BIS_fnc_vectorMultiply,
	[_vector, _space * 9] call BIS_fnc_vectorMultiply
], [], [], [], [], (180 - _angle)] call BIS_fnc_spawnGroup;

It will spawn line of specified units with _space meters in between with supplied _angle.

Read documentation often: BIS_fnc_spawnGroup

Share this post


Link to post
Share on other sites
There is 4th argument in BIS_fnc_spawnGroup which defines offset relative to position you sent in 1st argument (_startpos)

Good info... didn't know this. Cheers mate.

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  

×