Jump to content
🛡️FORUMS ARE IN READ-ONLY MODE Read more... ×
Sign in to follow this  
furikuri

Spawn group of vehicles placed randomly, while alive show markers for vehicles

Recommended Posts

I'm using an addaction on a weapons crate to spawn in targets randomly from a central marker for a weapons range, the targets (in this case vehicles) are then marked on the map while alive and then the marker is deleted when they die and a message about them being killed is sent.

waitUntil{!(isNil "BIS_fnc_init")};
waitUntil{!(isNil "BIS_MPF_InitDone")};


if (player distance ART < 50) then { //Allows the script to run on players within range of the target


for [{_i=0}, {_i < 5}, {_i=_i+1}] do
{

_eT = ["HMMWV_TOW","HMMWV_Avenger","LAV25","M2A2_EP1","M2A3_EP1","BAF_FV510_D","BAF_FV510_W","HMMWV_MK19","HMMWV_M2",
"HMMWV_M1151_M2_DES_EP1","M1126_ICV_M2_EP1","M1126_ICV_MK19_EP1","M1128_MGS_EP1","M6_EP1","T72_RU","T90","BMP3","UAZ_AGS30_RU","BTR90","GAZ_Vodnik","GAZ_Vodnik_HMG",
"T72_TK_EP1","BMP2_TK_EP1","ZSU_TK_EP1","T34_TK_EP1","T55_TK_EP1","M113_TK_EP1","LandRover_MG_TK_EP1",
"LandRover_SPG9_TK_EP1","UAZ_MG_TK_EP1","Ural_ZU23_TK_EP1","BRDM2_ATGM_TK_EP1","BRDM2_TK_EP1","BTR60_TK_EP1"];

_target = _eT select floor (random count _eT) CreateVehicle (getMarkerPos "ARTYtargets");
_target SetPos [(getMarkerPos "ARTYtargets" select 0) + ((random 300 )+(random -300)),(getMarkerPos "ARTYtargets" select 1) + ((random 300 )+(random -300))];

_driver = _art1 createUnit ["Citizen1", (getMarkerPos "ARTYtargets"), [], 0, "form"];
_driver moveInDriver _target;

//	_test1 = createGroup civilian;
//	[(getMarkerPos "ARTYtargets"), 40, _enemyType, _test1] call BIS_fnc_spawnvehicle;
//	_x SetPos [(getMarkerPos "ARTYtargets" select 0) + ((random 300 )+(random -300)),(getMarkerPos "ARTYtargets" select 1) + ((random 300 )+(random -300))];

////	_enemyType = _eT select floor (random count _eT) CreateVehicle (_centerpos);
//	_enemyType SetPos [(_centerpos select 0) + ((random 2500)+(random -2500)),(_centerpos select 1) + ((random 2500)+(random -2500))]; 
//	_enemyType setvehiclelock "locked";
//	clearMagazineCargo _enemyType;
//	clearWeaponCargo _enemyType;

_target addMPEventHandler ["MPKilled",{_this execvm "t_des.sqf"}];


_artmrk = createMarker ["Target"+str(_i), getpos _x];
_artmrk setMarkerShape "ICON";  
"Target"+str(_i) setMarkerType "WARNING"; 
"Target"+str(_i) setMarkerText "Target";


	if (_i < 1) then {
		player groupchat "6 Random targets spawned, check your map.";
	};	


};
while {alive _x} do {
};
deletemarker _artmrk;
};

I have tried 3 different methods of spawning manned vehicles because I have a map wide script that removes empty vehicles every 2 minutes and with this being an artillery range I didn't want that to run on here.

I just cannot figure out how to get the markers attached to the unnamed manned vehicles, I managed to get something working when they were empty but as I stated before it is not the best solution.

Edited by furikuri

Share this post


Link to post
Share on other sites
Sign in to follow this  

×