Jump to content
Heidelberg

Deleting vehicle (solved)

Recommended Posts

I've tried to compile a simple script that should remove a vehicle after a certain amount of time, and if no player is inside. What it should do is wait for a "GetOut" event to happen, then wait for some time and then check if any player is in the vehicle. After that it should delete the vehicle, but it does not seem to be working.

 

//Create vehicle 
IfritSpawn || IfritSpawn1 addAction ["Spawn Ifrit", 
{createVehicle ["O_MRAP_02_F", (getPosATL IfritSpawn), [], 5, "NONE"];
}];

// Deletes vehicle 
vehicle addEventHandler ["GetOut", {
	sleep 1000
	if !(player == vehicle player) then {
		deleteVehicle vehicle
	}
}];

Any help is appreciated.

Edit: I run the script serverside, in my init.sqf if it means anything.

Share this post


Link to post
Share on other sites

You forgot ; after your sleep. You also want to check if the vehicle crew is 0. Something like this (not tested):

_vehicle addEventHandler ["GetOut",
{
	_this spawn
	{
		params ["_vehicle", "_role", "_unit", "_turret"];
		sleep 10;
		if (count crew _vehicle == 0) then
		{
			deleteVehicle _vehicle;
		};
	};
}];

Change _vehicle accordingly.

Edited by HazJ
Update code

Share this post


Link to post
Share on other sites
 
 
 
1
35 minutes ago, HazJ said:

You forgot ; after your sleep. You also want to check if the vehicle crew is 0. Something like this (not tested):


_vehicle addEventHandler ["GetOut",
{
	params ["_vehicle", "_role", "_unit", "_turret"];
	sleep 1000;
	if (count crew _vehicle == 0) then
	{
		deleteVehicle _vehicle;
	};
}];

Change _vehicle accordingly.

 

Doesn't seem to be helping with the issue ://

Share this post


Link to post
Share on other sites

Tested and working. Can't run sleep in unscheduled.

_vehicle addEventHandler ["GetOut",
{
	_this spawn
	{
		params ["_vehicle", "_role", "_unit", "_turret"];
		sleep 10;
		if (count crew _vehicle == 0) then
		{
			deleteVehicle _vehicle;
		};
	};
}];

 

Share this post


Link to post
Share on other sites

{alive _x} count (crew vehicle) < 1

 

Crew command counts dead units and if a killed unit remains inside the vehicle, it won't delete.

  • Like 2

Share this post


Link to post
Share on other sites
11 minutes ago, HazJ said:

Tested and working. Can't run sleep in unscheduled.


_vehicle addEventHandler ["GetOut",
{
	_this spawn
	{
		params ["_vehicle", "_role", "_unit", "_turret"];
		sleep 10;
		if (count crew _vehicle == 0) then
		{
			deleteVehicle _vehicle;
		};
	};
}];

 

That's weird, still is not working for me. Could the fault be where it is executed? (init.sqf)

Share this post


Link to post
Share on other sites
2 hours ago, Heidelberg said:

IfritSpawn || IfritSpawn1 addAction ["Spawn Ifrit", {createVehicle ["O_MRAP_02_F", (getPosATL IfritSpawn), [], 5, "NONE"]; }];

 

That's not proper use of || (or).

The spawned vehicle is created but not defined by variable.

 

  • Like 2

Share this post


Link to post
Share on other sites

@opusfmspol Good point on the count crew. @Heidelberg As opus said, you can't just add an action to multiple objects like that.

{
	_x addAction ["Spawn Ifrit", {createVehicle ["O_MRAP_02_F", (getPosATL IfritSpawn), [], 5, "NONE"];}];
} forEach [
	IfritSpawn,
	IfritSpawn1
];

You could also do:

count (crew _vehicle apply {!alive _x})

Not sure which is faster off the top of my head, I don't think it is much difference with just this snippet though I haven't ran any tests.

  • Like 1

Share this post


Link to post
Share on other sites

 

 
 
 
 
3 hours ago, HazJ said:

 


{
	_x addAction ["Spawn Ifrit", {createVehicle ["O_MRAP_02_F", (getPosATL IfritSpawn), [], 5, "NONE"];
} forEach [
	IfritSpawn,
	IfritSpawn1
	];
}];

 

 

Not sure if the scope is correct here, but I will be testing it shortly. Thanks!

Share this post


Link to post
Share on other sites

@HazJ nevermind, just realized I'm stupid. But it still seems to not be deleting the vehicle when I exit.

Share this post


Link to post
Share on other sites

I meant select above. init.sqf

{
	_x addAction ["Spawn Ifrit",
	{
		_vehicle = createVehicle ["O_MRAP_02_F", (player getRelPos [random 100, random 360]), [], 5, "NONE"];
		_vehicle addEventHandler ["GetOut",
		{
			_this spawn
			{
				params ["_vehicle", "_role", "_unit", "_turret"];
				sleep 10;
				if ( count (crew _vehicle select {alive _x}) == 0 ) then
				{
					deleteVehicle _vehicle;
				};
			};
		}];
	}];
} forEach [
	IfritSpawn,
	IfritSpawn1
];

Example:

https://we.tl/t-3g8c7mJwIM

 

This doesn't account for all occasions such as where all crew die in vehicle before anyone disembarks, etc.

 

I think it would be better in this case to just do:

{alive _x} count (crew _vehicle) == 0

Though I was testing with select and forgot to change.

  • Like 1

Share this post


Link to post
Share on other sites

Thank you very much. It seems to be working, adding the EH inside of the addAction scope. Everything works now!

 

Thanks a lot again for both of your help @HazJ and @opusfmspol

Share this post


Link to post
Share on other sites

You're welcome. If you have any other questions, let us know. 🙂

Share this post


Link to post
Share on other sites

Guys, please. I spawn referred vehicles using the script at some point of the mission, not at the beginning. At some stage of training, they need to be cleared from the entire map so the next script with the same variable names can be executed smoothly. I used simple rem.sqf with common commands "deleteVehicle _veh" to clear the entire polygon for a new group of recruits but it gets with some errors of course because not all vehicles mentioned in the script are spawned yet. I can't adapt the script for only alive vehicles and objects, but I need to check only already spawned vehicles to be deleted. How? Something "while alive" but I can't figure it out... Thanks in advance

 

edited: to be clear, this way do the job, script delete everything I ask for and inform me what was an error in expression because some of the vehicles don't exist yet, but I would like to avoid this so the scenario stays clean from start to end.

Share this post


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

to be clear

 

show all of your relevant code 

Share this post


Link to post
Share on other sites

//ANESTEZIJA REAKTORA I DETEKTORA
p_det01 enableSimulation false;
p_det02 enableSimulation false;
p_det03 enableSimulation false;
p_det04 enableSimulation false;
p_det05 enableSimulation false;
p_det06 enableSimulation false;
p_det07 enableSimulation false;
m_det01 enableSimulation false;
m_det02 enableSimulation false;
m_det03 enableSimulation false;
m_det04 enableSimulation false;
m_det05 enableSimulation false;
m_det06 enableSimulation false;
m_det07 enableSimulation false;
a_det01 enableSimulation false;
a_det02 enableSimulation false;
a_det03 enableSimulation false;
a_det04 enableSimulation false;
a_det05 enableSimulation false; sleep 1;

//TELA I OLUPINE
{ deleteVehicle _x } forEach allDead; sleep 1;

//OTPAD NA ZEMLJI
{ deleteVehicle _x; } forEach nearestObjects [getpos centarZP,["WeaponHolder","GroundWeaponHolder"],1300];
{ deleteVehicle _x; } forEach nearestObjects [getpos centarZM,["WeaponHolder","GroundWeaponHolder"],1300]; sleep 1;

//SVA ZIVA SILA BLUFOR
{if ((side _x == west) && (!isPlayer _x)) then {deleteVehicle _x}} forEach allUnits; sleep 1;

//POJEDINACNA VOZILA
deleteVehicle pveh1;
deleteVehicle pveh2;
deleteVehicle helip1;
deleteVehicle pobj1;
deleteVehicle pobj2;

deleteVehicle mveh1;
deleteVehicle mveh2; 
deleteVehicle sator;
deleteVehicle vatra;
deleteVehicle mobj1;
deleteVehicle mobj2;
deleteVehicle nm1; 
deleteVehicle cam1;
deleteVehicle bro1;
deleteVehicle bro2; sleep 1;

deleteVehicle aveh1;
deleteVehicle avi1;
deleteVehicle avi2;
deleteVehicle avi3;
systemChat "ПОЛИГОН ЧИСТ";

 

It is rem.sqf

 

Edited: These few rows on top are for triggers that detects if vehicles were destroyed so I need to shut them down before deleting vehicles

 

 

Share this post


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

 I spawn referred vehicles using the script at some point of the mission, not at the beginning. At some stage of training, they need to be cleared from the entire map so the next script with the same variable names can be executed smoothly. I used simple rem.sqf with common commands "deleteVehicle _veh" to clear the entire polygon for a new group of recruits but it gets with some errors of course because not all vehicles mentioned in the script are spawned yet. I can't adapt the script for only alive vehicles and objects, but I need to check only already spawned vehicles to be deleted. How? Something "while alive" but I can't figure it out... Thanks in advance

 

edited: to be clear, this way do the job, script delete everything I ask for and inform me what was an error in expression because some of the vehicles don't exist yet, but I would like to avoid this so the scenario stays clean from start to end.

 

How do you name your spawned vehicle? By setVehicleVarName? Is it a MP scenario?

Share this post


Link to post
Share on other sites

No, sp is. Names given by script: (example for one but every is like this one)

 

systemChat "BLUfreq: Air defence to full combat regime!";
//CENTAR-BATERIJA PVO
centarPVO = createVehicle ["Land_WoodenLog_F", [0,0,1000], [], 0, "CAN_COLLIDE"]; sleep 1;
_marker = selectRandom ["sa_01"]; sleep 1;
_pos = getMarkerPos _marker; sleep 1; 
centarPVO setPos _pos; sleep 1;
centarPVO allowDamage false;
centarPVO hideObject true; sleep 10;

//***SAMOSTALNO DEJSTVO VAZDUH ZEMLJA
//BATERIJA PVO
_newPos = [centarPVO, 10, 6500, 50, 0, 0.4, 0,["sp_01","sp_02","sp_03","sp_04","sp_05","sp_06","sp_07","sm_01","sm_02","sm_03","sm_04","sm_05","sm_06","sm_07"]] call BIS_fnc_findSafePos; sleep 2;
aveh1 = createVehicle ["GA_hmmwv_avanger", _newPos, [], 0, "NONE"];
aveh1 setDir (random 360);  
crewpaveh1 = createVehicleCrew aveh1; sleep 1;

//SYSTEM
systemChat "BLUfreq: Air defence activated!";

 

EDITED: That's the simplest way I know for and also working in MP but now I just preparing polygon for a community so off the server is easier for testing and editing. Also, these classes like "GA_hmmwv_avanger" is from ORBAT creator faction I made for me so they don't match the exact config class name in this case.

 

 

Share this post


Link to post
Share on other sites

I can't guess what you're trying to do with edited/spawned vehicles at start/by waves. Your spawning script is missing.

Anyway, if you don't want to delete all vehicles in an area, but just specific ones, what you can do is to set a variable on them : this setVariable ["special",TRUE]; in init field of the edited vehicle or _veh setVariable ["special",TRUE] if spawn and called _veh.

That way you can filter them : vehicles select {!isNil {_x getVariable "special"}}

  • Like 2

Share this post


Link to post
Share on other sites

I have to spawn in waves because one task calls another. For example if light anti-air is destroyed (aveh1) script spawns another one to strengthen the area. What I need is to delete only existing vehicles at the moment of rem.sqf is executed but script tries to delete vehicles that are not yet spawned because there was no time for that due to one pilot is failed and need to try again all the way from scratch (back to airport, rearm, etc...). So I need to filter only vehicles that are already spawned and all of them already have unique variables.

 

trigger cond:  !alive aveh1 || alive aveh1 and count crew aveh1 isEqualTo 0

onAct: nul=[]execVM "anotherSpawn.sqf";

This way dynamic is given but rem.sqf contains orders to delete all vehicles even ones who not spawned yet and who are predicted to be spawned in "anotherSpawn.sqf". 

Hope I am clear now sorry about my English.

Share this post


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

Your spawning script is missing

if this is what you mean:

zp.sqf (land tasks)

sleep 2; systemChat "...Поставка полигона";
//CENTAR-1
centarZP = createVehicle ["Land_WoodenLog_F", [0,0,1000], [], 0, "CAN_COLLIDE"]; sleep 1;
_marker = selectRandom ["sp_01", "sp_02", "sp_03", "sp_04", "sp_05", "sp_06", "sp_07"]; sleep 1;
_pos = getMarkerPos _marker; sleep 1;
centarZP setPos _pos; sleep 1;
centarZP allowDamage false;
centarZP hideObject true; sleep 1;

//***RRB-MINE-OKLOP
//VOZILO
_newPos = [centarZP, 10, 1200, 100, 0, 0.9, 0] call BIS_fnc_findSafePos; sleep 1;
pveh1 = createVehicle ["GA_t72b", _newPos, [], 0, "NONE"];
crewpveh1 = createVehicleCrew pveh1; sleep 1;
[crewpveh1, getPos centarZP, 1000, 4, "MOVE", "SAFE", "RED", "NORMAL"] call cba_fnc_taskPatrol; sleep 1;

//***PATROLNE GRUPE
//TIM SPEC-1 (x5)
_newPos = [centarZP, 50, 1100, 3, 0, 20, 0] call BIS_fnc_findSafePos; sleep 1;
_unitsInGroup = ["GS_at01","GS_op01","GS_op02","GS_sni02"];
ppat1 = createGroup [west, true];
_newLeader = "GS_com01" createUnit [_newPos,ppat1,"newLeader = this"];
{_newUnit = _x createUnit [_newPos,ppat1,"newUnit = this"];}forEach _unitsInGroup; sleep 1;
[ppat1, getPos centarZP, 1100, 5, "MOVE", "SAFE", "RED", "LIMITED"] call cba_fnc_taskPatrol; sleep 1; 

//TIM SPEC-2 (x5)
_newPos = [centarZP, 50, 1100, 3, 0, 20, 0] call BIS_fnc_findSafePos; sleep 1;
_unitsInGroup = ["GS_at01","GS_op01","GS_op02","GS_sni01"];
ppat2 = createGroup [west, true];
_newLeader = "GS_com02" createUnit [_newPos,ppat2,"newLeader = this"];
{_newUnit = _x createUnit [_newPos,ppat2,"newUnit = this"];}forEach _unitsInGroup; sleep 1;
[ppat2, getPos centarZP, 1100, 5, "MOVE", "SAFE", "RED", "LIMITED"] call cba_fnc_taskPatrol; sleep 1;

//***URBAN-HAPSENJE
//GARNIZON TIM-1 (x5)
_newPos = [centarZP, 50, 500, 3, 0, 20, 0] call BIS_fnc_findSafePos; sleep 1;
_unitsInGroup = ["GP_at01","GP_at03","GP_at02","GA_sni01"];
pgrp1 = createGroup [west, true];
_newLeader = "GP_at02" createUnit [_newPos,pgrp1,"newLeader = this"];
{_newUnit = _x createUnit [_newPos,pgrp1,"newUnit = this"];}forEach _unitsInGroup; sleep 1;
[pgrp1 ,getPos centarZP, 1200, 5, false, true] call CBA_fnc_taskDefend; sleep 1;

//GARNIZON TIM-2 (x4)
_newPos = [centarZP, 50, 500, 3, 0, 20, 0] call BIS_fnc_findSafePos; sleep 1;
_unitsInGroup = ["GP_at01","GP_at03","GP_at02"];
pgrp2 = createGroup [west, true];
_newLeader = "GA_sni01" createUnit [_newPos,pgrp2,"newLeader = this"];
{_newUnit = _x createUnit [_newPos,pgrp2,"newUnit = this"];}forEach _unitsInGroup; sleep 1;

//OFICIR
_spawnpos = getMarkerPos "m0"; sleep 1;
private _grp = createGroup east;
of = _grp createUnit ["GA_com", _spawnpos, [], 1, "none"];
[of] join pgrp2; sleep 1;
of setPos getPos leader pgrp2; sleep 1;

[pgrp2 ,getPos centarZP, 1200, 5, false, true] call CBA_fnc_taskDefend; sleep 1;

//***RURAL-BORBENI TRANSPORTER
//IZVIDJACKI TIM (x6)
_newPos = [centarZP, 10, 1200, 3, 0, 20, 0] call BIS_fnc_findSafePos; sleep 1;
_unitsInGroup = ["GL_at01","GL_at01","GL_at02","GL_at02","GL_sni01"];
pgrp3 = createGroup [west, true];
_newLeader = "GL_com03" createUnit [_newPos,pgrp3,"newLeader = this"];
{_newUnit = _x createUnit [_newPos,pgrp3,"newUnit = this"];}forEach _unitsInGroup; sleep 1;
[pgrp3, getPos centarZP, 1000, 5, "MOVE", "SAFE", "RED", "LIMITED"] call cba_fnc_taskPatrol; sleep 1;

//***PVO (helip.sqf)

//***VAZDUH ZEMLJA-IKBR
//VOZILO
_newPos = [centarZP, 10, 1200, 20, 0, 0.4, 0] call BIS_fnc_findSafePos; sleep 1;
pveh2 = createVehicle ["B_APC_Tracked_01_AA_F", _newPos, [], 0, "NONE"];
pveh2 setDir (random 360);
crewpveh2 = createVehicleCrew pveh2; sleep 1;

//ZGRADA 1 
_newPos = [centarZP, 10, 1200, 60, 0, 0.6, 0] call BIS_fnc_findSafePos; sleep 1;
pobj1 = createVehicle ["Land_i_Barracks_V1_F", _newPos, [], 0, "CAN_COLLIDE"];
pobj1 setDir (random 360);
pobj1 setVectorUp [0,0,1]; sleep 1;

//ZGRADA 2 
_newPos = [centarZP, 10, 1200, 60, 0, 0.6, 0] call BIS_fnc_findSafePos; sleep 1;
pobj2 = createVehicle ["Land_Cargo_Tower_V3_F", _newPos, [], 0, "CAN_COLLIDE"];
pobj2 setDir (random 360);
pobj2 setVectorUp [0,0,1]; sleep 1;

//SYSTEM
tgd01 setPos getPos centarZP;
"zad1" setMarkerPos getPos centarZP;

systemChat "ПОЛИГОН СПРЕМАН";

 

zm.sqf (sea tasks)

sleep 2; systemChat "...Поставка полигона";
//CENTAR-2
centarZM = createVehicle ["Land_WoodenLog_F", [0,0,1000], [], 0, "CAN_COLLIDE"]; sleep 1;
_marker = selectRandom ["sm_01", "sm_02", "sm_03", "sm_04", "sm_05", "sm_06", "sm_07"]; sleep 1;
_pos = getMarkerPos _marker; sleep 1;
centarZM setPos _pos; sleep 1;
centarZM allowDamage false;
centarZM hideObject true; sleep 1;

//***RRB-MINE
//VOZILO
_newPos = [centarZM, 10, 1200, 50, 0, 0.4, 0] call BIS_fnc_findSafePos; sleep 1;
mveh1 = createVehicle ["GA_t55", _newPos, [], 0, "NONE"];
crewmveh1 = createVehicleCrew mveh1; sleep 1;
[crewmveh1, getPos centarZM, 1000, 4, "MOVE", "SAFE", "RED", "NORMAL"] call cba_fnc_taskPatrol; sleep 1;

//***PATROLNE GRUPE
//TIM SPEC-1 (x5)
_newPos = [centarZM, 50, 1100, 3, 0, 20, 0] call BIS_fnc_findSafePos; sleep 1;
_unitsInGroup = ["GS_sni01","GS_op01","GS_op02","GS_sni02"];
mpat1 = createGroup [west, true];
_newLeader = "GS_com01" createUnit [_newPos,mpat1,"newLeader = this"];
{_newUnit = _x createUnit [_newPos,mpat1,"newUnit = this"];}forEach _unitsInGroup; sleep 1;
[mpat1, getPos centarZM, 1100, 5, "MOVE", "SAFE", "RED", "LIMITED"] call cba_fnc_taskPatrol; sleep 1;

//TIM SPEC-2 (x5)
_newPos = [centarZM, 50, 1100, 3, 0, 20, 0] call BIS_fnc_findSafePos; sleep 1;
_unitsInGroup = ["GS_sni01","GS_op01","GS_op02","GS_sni02"];
mpat2 = createGroup [west, true];
_newLeader = "GS_com02" createUnit [_newPos,mpat2,"newLeader = this"];
{_newUnit = _x createUnit [_newPos,mpat2,"newUnit = this"];}forEach _unitsInGroup; sleep 1;
[mpat2, getPos centarZM, 1100, 5, "MOVE", "SAFE", "RED", "LIMITED"] call cba_fnc_taskPatrol; sleep 1;

//***SNAJPERSKO DEJSTVO
//KAMP
_newPos = [centarZM, 50, 1100, 3, 0, 20, 0] call BIS_fnc_findSafePos; sleep 1;
sator = createVehicle ["Land_sz_Tent_West3", [0,0,1000], [], 0, "CAN_COLLIDE"];
sator allowDamage false;
sator setPos _newPos; sleep 1;
vatra = createVehicle ["Campfire_burning_F", [0,0,1000], [], 0, "CAN_COLLIDE"];
vatra setPos getPos sator; sleep 1;

//KAMP TIM (x3)
_newPos = [sator, 70, 100, 3, 0, 20, 0] call BIS_fnc_findSafePos; sleep 1;
_unitsInGroup = ["GA_sni01","GA_at01"];
mgrp1 = createGroup [west, true];
_newLeader = "GP_com" createUnit [_newPos,mgrp1,"newLeader = this"];
{_newUnit = _x createUnit [_newPos,mgrp1,"newUnit = this"];}forEach _unitsInGroup; sleep 1;
[mgrp1, getPos sator, 70, 4, "MOVE", "SAFE", "RED", "LIMITED"] call cba_fnc_taskPatrol; sleep 1;

//***VAZDUH ZEMLJA-ARTILJERIJA 
//VOZILO
_newPos = [centarZM, 10, 1200, 20, 0, 0.4, 0] call BIS_fnc_findSafePos; sleep 1;
mveh2 = createVehicle ["rhsgref_cdf_b_ural_Zu23", _newPos, [], 0, "NONE"];
mveh2 setDir (random 360); 
crewmveh2 = createVehicleCrew mveh2; sleep 1;

//ZGRADA 1
_newPos = [centarZM, 10, 1200, 60, 0, 0.6, 0] call BIS_fnc_findSafePos; sleep 1;
mobj1 = createVehicle ["Land_i_Barracks_V1_F", _newPos, [], 0, "CAN_COLLIDE"];
mobj1 setDir (random 360);  
mobj1 setVectorUp [0,0,1]; sleep 1;

//ZGRADA 2
_newPos = [centarZM, 10, 1200, 60, 0, 0.6, 0] call BIS_fnc_findSafePos; sleep 1;
mobj2 = createVehicle ["Land_Cargo_Tower_V3_F", _newPos, [], 0, "CAN_COLLIDE"];
mobj2 setDir (random 360);  
mobj2 setVectorUp [0,0,1]; sleep 1;

//SYSTEM
tgd02 setPos getPos centarZM;
"zad2" setMarkerPos getPos centarZM;
nul=[]execVM "zadaci\ZMM.sqf";

p_det01 enableSimulation true;
p_det02 enableSimulation true;
p_det03 enableSimulation true;
p_det04 enableSimulation true;
p_det05 enableSimulation true;
p_det06 enableSimulation true;
p_det07 enableSimulation true;
m_det01 enableSimulation true;
m_det02 enableSimulation true;
m_det03 enableSimulation true;
m_det04 enableSimulation true;
m_det05 enableSimulation true;
m_det06 enableSimulation true;
m_det07 enableSimulation true;
a_det01 enableSimulation true;
a_det02 enableSimulation true;
a_det03 enableSimulation true;
a_det04 enableSimulation true;
a_det05 enableSimulation true;

systemChat "...полигон 1/3";

 

connected spawn (zmm.sqf)

//CENTAR-3
centarNM = createVehicle ["land_buoybig_f", [0,0,1000], [], 0, "CAN_COLLIDE"]; sleep 1;
_marker = selectRandom ["nm_01", "nm_02", "nm_03", "nm_04", "nm_05", "nm_06"]; sleep 1;
_pos = getMarkerPos _marker; sleep 1;
centarNM setPos _pos; sleep 1;
centarNM allowDamage false;
centarNM hideObject true; sleep 1;

//RAZMINIRAVANJE
//MINA-1
_newPos = [centarNM, 0, 60, 3, 2, 20, 0] call BIS_fnc_findSafePos; sleep 1;
_depth = selectRandom [45, -50, 35, -45, 25, -35, 15, -25, 5, -15, -5];
nm1 = createMine ["UnderwaterMine", getMarkerPos "m0", [], 0];
nm1 setPos _newPos; sleep 1;
nm1 setPos [(getPos nm1 select 0), (getPos nm1 select 1), (_depth)]; sleep 1;

//CAMAC-1
_newPos = [centarNM, 10, 200, 50, 2, 20, 0] call BIS_fnc_findSafePos; sleep 1;
cam1 = createVehicle ["B_G_Boat_Transport_01_F", _newPos, [], 0, "NONE"];
crewcam1 = createVehicleCrew cam1; sleep 1;
[crewcam1, getPos centarNM, 80, 4, "MOVE", "SAFE", "RED", "LIMITED"] call cba_fnc_taskPatrol; sleep 1;

//SYSTEM
tgd03 setPos getPos centarNM;
"zad3" setMarkerPos getPos centarNM;
"zad33" setMarkerPos getPos centarNM;
nul=[]execVM "zadaci\ZMO.sqf";
systemChat "...полигон 2/3";

 

connected spawn (zmo.sqf)

//CENTAR-4
centarOS = createVehicle ["land_buoybig_f", [0,0,1000], [], 0, "CAN_COLLIDE"]; sleep 1;
_marker = selectRandom ["so_01", "so_02", "so_03", "so_04", "so_05", "so_06"]; sleep 1;
_pos = getMarkerPos _marker; sleep 1;
centarOS setPos _pos;  sleep 1;
centarOS allowDamage false;
centarOS hideObject true; sleep 1;

//***RAKETNI UDAR-TORPEDNI UDAR-SABOTAZA
//PLOVILO-1
_newPos = [centarOS, 10, 1200, 50, 2, 20, 0] call BIS_fnc_findSafePos; sleep 1;
bro1 = createVehicle ["pook_freighter1_empty", _newPos, [], 0, "NONE"];

//POSADA PLOVILO-1
_spawnpos = getMarkerPos "m0"; 
private _freightcrew = createGroup west; 
posada1 = _freightcrew createUnit ["GA_nav", _spawnpos, [], 1, "none"];
posada2 = _freightcrew createUnit ["GA_nav", _spawnpos, [], 1, "none"];

[posada2] join _freightcrew; sleep 1;

posada1 moveInCommander bro1;
posada2 moveInDriver bro1; sleep 1;

[group posada1, getPos centarOS, 1200, 4, "MOVE", "SAFE", "RED", "LIMITED"] call cba_fnc_taskPatrol; sleep 1;
[group posada1, 2] setWaypointTimeout [60, 120, 150]; sleep 1;

//PLOVILO-2
_newPos = [centarOS, 10, 1200, 50, 2, 20, 0] call BIS_fnc_findSafePos; sleep 1;
bro2 = createVehicle ["B_Boat_Armed_01_minigun_F", _newPos, [], 0, "NONE"];
crewbro2 = createVehicleCrew bro2; sleep 1;
[crewbro2, getPos centarOS, 1200, 4, "MOVE", "SAFE", "RED", "LIMITED"] call cba_fnc_taskPatrol; sleep 1;
[crewbro2, 2] setWaypointTimeout [60, 120, 150]; sleep 1;

//SYSTEM
tgd04 setPos getPos centarOS;
"zad4" setMarkerPos getPos centarOS;
systemChat "ПОЛИГОН СПРЕМАН";

 

Triggers are in charge of aviation tasks due to air force is act as support for this scenario. When infantry designates land targets, AF is in charge of destroying them also vise versa and also navy plus only navy and only infantry tasks. That's why I need to spawn in waves and not all at once so deleting will be easy. Now I need to filter them somehow by spawned and operational/and not spawned yet. 

 

There is much Cyrillic so just ignore //text. It is for me to be easier organized during zeus and editing.

Share this post


Link to post
Share on other sites

@Nemanjic this is not ur first day in the forums. Could you pls use a code block at least for code with more than 5 lines?

Share this post


Link to post
Share on other sites

Of course bro. Never done this before hope now is ok.

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

×