Jigsor 176 Posted May 23, 2013 (edited) I have not seen this discussed. Maybe its a game limitation? Can waypoints that use getMarkerPos dynamically get the new marker position when the markers have moved? Senario: Marker script generates 4 markers when objective initialization and again when objective complete. Marker 1 "aomarker" located in the center. marker 2 "spawnaire". Spawn location for east aircraft. marker 3 "spawnairw". Spawn location for west aircraft. marker 4 "cyclewpmrk". Used as cycle waypiont for east and west. Marker 1 is centrally located. Markers 2-4 are equal distance around "aomarker". Marker 4 is placed randomly within specified radius and markes 2 and 3 are placed equal distance from marker 4 and each other. It looks like a peace sign. Aircraft should spawn at respective markers and move to AO makers then move to cycle marker. When objective completes, the marker script deletes current markers and recreates them at the new objective. Question is how to make waypoint markers update to their newly moved marker positions. Do I have to delete and recreate waypoints when markers have moved? The waypoints use getMarkerPos and I've added eventhandlers for markers. Maybe possible with a game logic? I don't know how to implement it if it is. Functions module is already placed on map. I've tried countless combinations and all return nearly the same result. Here are the 2 scripts handling this. The first is the marker script. It depends on a seperate random number generator script used to filter completed objectives and assign new ones by yet another script. This one works beautifully. Thanks to Killzonekid's suggestion. The second is the createvehicle and set waypoint script. The second is a combination of a GITS EVO air patrol script to create vehicle and manage cleanup. The waypoint management is a function converted from JW Customs USPS WP script though both parts are highly modified. No shame, credit given.... As much as I love killing AI, I would hate kill them on objective complete and spwan them at the new AO. Its a plauseable solution, but it would be nicer to have them move to next AO. RandomOAMarker.sqf //RandomOAMarker.sqf by Jigsor //[] execVM "Scripts\Tasks\RandomOAMarker.sqf"; //called from clienttasks.sqf if (!isServer) exitWith {}; private ["_invhelipad","_current_rnd","_posHpad","_posHpadAO1","_posHpadAO2","_posHpadAO3","_posHpadAO4","_currentmarker","_wpcyclemark","_spwnaire","_spwnairepos","_spwnairedir","_spwnairw","_spwnairwpos","_spwnairwdir"]; "RND_number" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "oa1invhelipad" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "oa2invhelipad" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "oa3invhelipad" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "oa4invhelipad" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; waituntil {(RND_number) >1}; sleep 1; if (!isNil "oa1invhelipad") then {deleteVehicle oa1invhelipad;}; if (!isNil "oa2invhelipad") then {deleteVehicle oa2invhelipad;}; if (!isNil "oa3invhelipad") then {deleteVehicle oa3invhelipad;}; if (!isNil "oa4invhelipad") then {deleteVehicle oa4invhelipad;}; if (!isNil "oa5invhelipad") then {deleteVehicle oa5invhelipad;}; if (!isNil "oamarker") then {deleteMarker "oamarker";}; if (RND_number == 2) then { _invhelipad = createVehicle ["HeliHEmpty", getMarkerPos "task1mkr", [], 0, "CAN_COLLIDE"]; _VarOAName="oa1invhelipad"; _invhelipad SetVehicleVarName _VarOAName; _invhelipad Call Compile Format ["%1=_This ; PublicVariable ""%1""",_VarOAName]; sleep 0.1; }; if (RND_number == 3) then { _invhelipad = createVehicle ["HeliHEmpty", getMarkerPos "task3mkr", [], 0, "CAN_COLLIDE"]; _VarOAName="oa2invhelipad"; _invhelipad SetVehicleVarName _VarOAName; _invhelipad Call Compile Format ["%1=_This ; PublicVariable ""%1""",_VarOAName]; sleep 0.1; }; if (RND_number == 4) then { _invhelipad = createVehicle ["HeliHEmpty", getMarkerPos "movingtrain", [], 0, "CAN_COLLIDE"]; _VarOAName="oa3invhelipad"; _invhelipad SetVehicleVarName _VarOAName; _invhelipad Call Compile Format ["%1=_This ; PublicVariable ""%1""",_VarOAName]; sleep 0.1; }; if (RND_number == 5) then { _invhelipad = createVehicle ["HeliHEmpty", getMarkerPos "task7mkr", [], 0, "CAN_COLLIDE"]; _VarOAName="oa4invhelipad"; _invhelipad SetVehicleVarName _VarOAName; _invhelipad Call Compile Format ["%1=_This ; PublicVariable ""%1""",_VarOAName]; sleep 0.1; }; _current_rnd = RND_number; _posHpad = [ getPos _invhelipad select 0, (getPos _invhelipad select 1)]; _posHpadAO1 = [ getMarkerPos "task1mkr" select 0, (getMarkerPos "task1mkr" select 1)]; _posHpadAO2 = [ getMarkerPos "task3mkr" select 0, (getMarkerPos "task3mkr" select 1)]; _posHpadAO3 = [ getMarkerPos "movingtrain" select 0, (getMarkerPos "movingtrain" select 1)]; _posHpadAO4 = [ getMarkerPos "task7mkr" select 0, (getMarkerPos "task7mkr" select 1)]; if (_current_rnd == 2) then { if (_posHpad distance _posHpadAO1 == 0) then { _invhelipad setPos getMarkerPos "task1mkr"; } else { _current_rnd = nil; }; }; if (_current_rnd == 3) then { if (_posHpad distance _posHpadAO2 == 0) then { _invhelipad setPos getMarkerPos "task3mkr"; } else { _current_rnd = nil; }; }; if (_current_rnd == 4) then { if (_posHpad distance _posHpadAO3 == 0) then { _invhelipad setPos getMarkerPos "movingtrain"; } else { _current_rnd = nil; }; }; if (_current_rnd == 5) then { if (_posHpad distance _posHpadAO4 == 0) then { _invhelipad setPos getMarkerPos "task7mkr"; } else { _current_rnd = nil; }; }; diag_log text format ["posAO1: %1", _posHpadAO1]; diag_log text format ["posAO2: %1", _posHpadAO2]; diag_log text format ["posAO3: %1", _posHpadAO3]; diag_log text format ["posAO4: %1", _posHpadAO4]; diag_log text format ["pos: %1", _posHpad]; while {isNil "_current_rnd"} do { if (_current_rnd == 2) then {if (_posHpad distance _posHpadAO1 == 0) then {_invhelipad setPos getMarkerPos "task1mkr"};}; if (_current_rnd == 3) then {if (_posHpad distance _posHpadAO2 == 0) then {_invhelipad setPos getMarkerPos "task3mkr"};}; if (_current_rnd == 4) then {if (_posHpad distance _posHpadAO3 == 0) then {_invhelipad setPos getMarkerPos "movingtrain"};}; if (_current_rnd == 5) then {if (_posHpad distance _posHpadAO4 == 0) then {_invhelipad setPos getMarkerPos "task7mkr"};}; sleep 0.1; diag_log text format [""]; switch (_current_rnd) do { // debug: diag_log used to compare server's broadcasting random task number to currentAO marker. case 1: {diag_log text format ["CurrentAOMarker: %1", _current_rnd]; }; case 2: {diag_log text format ["CurrentAOMarker: %1", _current_rnd]; }; case 3: {diag_log text format ["CurrentAOMarker: %1", _current_rnd]; }; case 4: {diag_log text format ["CurrentAOMarker: %1", _current_rnd]; }; sleep 0.1; }; }; sleep 0.2; if (!isNil "oamarker") then {deleteMarker "oamarker";}; _currentmarker = createMarker ["oamarker", getPos _invhelipad]; _currentmarker setMarkerShape "ELLIPSE"; "oamarker" setMarkerSize [1, 1]; "oamarker" setMarkerShape "ICON"; "oamarker" setMarkerType "DOT"; "oamarker" setMarkerColor "ColorRed"; "oamarker" setMarkerText "AO"; "oamarker" setMarkerPos (getPos _invhelipad); publicVariable "oamarker"; publicVariable "_invhelipad"; diag_log text format ["currentmarker: %1", _invhelipad]; if (!isNil "cyclewpmrk") then {deleteMarker "cyclewpmrk";}; _wpcyclemark = createMarker ["cyclewpmrk", getPos _invhelipad]; _wpcyclemark setMarkerShape "ELLIPSE"; "cyclewpmrk" setMarkerSize [1, 1]; "cyclewpmrk" setMarkerShape "ICON"; "cyclewpmrk" setMarkerType "DOT";//set marker type to "DOT" for debug. Set "Empty" for invisible "cyclewpmrk" setMarkerColor "ColorRed"; "cyclewpmrk" setMarkerText "WPcycle"; "cyclewpmrk" setMarkerPos [(getMarkerPos "oamarker" select 0) + (300 * sin floor(random 360)), (getMarkerPos "oamarker" select 1) + (300 * cos floor(random 360)), 0];//cycle waypoint distance is 1400 meters from AO marker publicVariable "cyclewpmrk"; sleep 0.1; if (!isNil "spawnaire") then {deleteMarker "spawnaire";}; _spwnaire = createMarker ["spawnaire", getPos _invhelipad]; _spwnaire setMarkerShape "ELLIPSE"; _spwnairepos = getMarkerPos "cyclewpmrk"; _spwnairedir = [_spwnairepos, _invhelipad] call BIS_fnc_dirTo; "spawnaire" setMarkerSize [1, 1]; "spawnaire" setMarkerShape "ICON"; "spawnaire" setMarkerType "DOT";//set marker type to "DOT" for debug. Set "Empty" for invisible "spawnaire" setMarkerColor "ColorRed"; "spawnaire" setMarkerText "SpawnAirEst"; "spawnaire" setMarkerPos [(getMarkerPos "oamarker" select 0) + (1450 * sin (_spwnairedir -300)), (getMarkerPos "oamarker" select 1) + (1450 * cos (_spwnairedir -300)), 0];//East Air spawn point distance is 1400 meters from AO marker publicVariable "spawnaire"; sleep 0.1; if (!isNil "spawnairw") then {deleteMarker "spawnairw";}; _spwnairw = createMarker ["spawnairw", getPos _invhelipad]; _spwnairw setMarkerShape "ELLIPSE"; "spawnairw" setMarkerSize [1, 1]; "spawnairw" setMarkerShape "ICON"; "spawnairw" setMarkerType "DOT";//set marker type to "DOT" for debug. Set "Empty" for invisible "spawnairw" setMarkerColor "ColorRed"; "spawnairw" setMarkerText "SpawnAirWst"; "spawnairw" setMarkerPos [(getMarkerPos "oamarker" select 0) + (1450 * sin (_spwnairedir -60)), (getMarkerPos "oamarker" select 1) + (1450 * cos (_spwnairedir -60)), 0];//East Air spawn point distance is 1400 meters from AO marker publicVariable "spawnairw"; sleep 0.1; sleep 10; if (!isNil "_current_rnd") exitWith {}; 1airpate.sqf //1airpate.sqf //Taken from GITS Evolution and Ultra Simple Patrol Script v1.4 by JW Custom // Original Authors Killjoy Eggbeast, GITS, JW Custom. //Modified/Adapted by Jigsor. //Makes side east aircraft and sets waypoints. //starts in serverinit.sqf with _handle = [] execVM "Scripts\airpatinit.sqf"; if (!isServer) exitWith {}; private ["_wp","_ranPos","_patrolMarker","_patrolRadius","_spawnRadius","_spawnMarker","_pilotBehaviour","_existChance","_pilotSpeed","_pilotFormation","_numGrp","_flyInHeight","_wpfnc","_grp","_killpilots","_varisleep","_qna","_qnb","_qnc","_aiairpatres"]; "tsk0init" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "oamarker" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "cyclewpmrk" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "spawnaire" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; /* "spawnairw" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "_invhelipad" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; */ waituntil {tsk0init == 1}; sleep 16;//wait for initial marker creation of "oamarker","cyclewpmrk" and "spawnaire" _qna=false; _qnb=false; _qnc=false; _aiairpatres=(paramsArray select 7); switch (_aiairpatres) do { case 0:{_qna=true}; case 1:{_qnb=true}; case 2:{_qnc=true}; }; if (_qna) then {_varisleep = 30;}; if (_qnb) then {_varisleep = 60;}; if (_qnb) then {_varisleep = 90;}; /* Ultra Simple Patrol Script v1.4 by JW Custom. Convertion to funciton and modified by Jigsor ----------------------------------------------------------------------------------------------------------- argument 0: The unit/group leader we are dealing with argument 1: The radius size where to randomly place the unit/group within argument 2: The marker representing the radius center of where unit/group will be randomly placed within argument 3: The marker representing the center of the unit/group patrol argument 4: The radius size where unit/group will patrol within argument 5: The behaviour of the unit/group argument 6: Chance of unit/group existing in percentage. If set to 100 the unit/group will always exist. argument 7: Movement speed of the unit/group. argument 8: Group formation. argument 9: Wait time in seconds before moving on to next waypoint. Set to 0 and theres no wait time. argument 10: Altitude of unit/group. Unless unit/group are a air vehicle this should be set to 0. argument 11: The marker representing Cycle waypoint. */ _wpfnc = { private ["_wphandle","_spawnRadius","_spawnMarker","_patrolMarker","_patrolRadius","_pilotBehaviour","_existChance","_pilotSpeed","_pilotFormation","_pilotWaittime","_flyInHeight","_chance","_wp","_wp1","_iniPos","_realpos","_oldpos","_cyclemrkr","_pilot"]; //_wphandle = [_pilot, 300, "spawnaire", "oamarker", 1000, "COMBAT", 100, "FULL", "VEE", 4, 300, "cyclewpmrk"]; _wphandle = [_pilot, 300, "spawnaire", "oamarker", 1000, "SAFE", 100, "FULL", "VEE", 4, 300, "cyclewpmrk"]; _pilot = _wphandle select 0; _spawnRadius = _wphandle select 1; _spawnMarker = _wphandle select 2; _patrolMarker = _wphandle select 3; _patrolRadius = _wphandle select 4; _pilotBehaviour = _wphandle select 5; _existChance = _wphandle select 6; _pilotSpeed = _wphandle select 7; _pilotFormation = _wphandle select 8; _pilotWaittime = _wphandle select 9; _flyInHeight = _wphandle select 10; _cyclemrkr = _wphandle select 11; _grp = group _pilot; _chance = ceil(random 100); if (_chance > _existChance) then { {deleteVehicle vehicle _x; deleteVehicle _x; sleep 0.1;} forEach units _grp; }; _wp = _grp addWaypoint [getMarkerPos _spawnMarker, 1]; _wp setWaypointBehaviour _pilotBehaviour; _wp setWaypointSpeed _pilotSpeed; _wp setWaypointFormation _pilotFormation; _wp setWaypointType "MOVE"; _wp setWaypointCombatMode "RED"; [_grp, 1] setWaypointPosition [getMarkerPos _spawnMarker, _spawnRadius]; _iniPos = getWPPos [_grp,1]; //_spwnairpos = getMarkerPos "spawnaire"; //_airdest = getMarkerPos "oamarker"; //_spwnairdir = [_spwnairpos, airdest] call BIS_fnc_dirTo; //vehicle _x setpos [(_iniPos select 0) + (50 * sin (_spwnairdir)), (_iniPos select 1) + (50 * cos (_spwnairdir)), _flyInHeight]; vehicle _x setpos [(_iniPos select 0) + random 50, (_iniPos select 1) + random 50, _flyInHeight]; _wp1 = _grp addWaypoint [getMarkerPos _patrolMarker, _spawnRadius]; _wp1 setWaypointType "MOVE"; [_grp, 2] setWaypointPosition [getMarkerPos _patrolMarker, _spawnRadius]; _wp2 = _grp addWaypoint [getMarkerpos "cyclewpmrk", 100]; _wp2 setWaypointType "CYCLE"; [_grp, 3] setWaypointPosition [getMarkerPos _cyclemrkr, _patrolRadius]; }; //_wp1 setWaypointStatements ["true", "diag_log ['GroupLeader: ',this]; diag_log ['Units: ',thislist]"]; /* while {(getPos _pilot) distance ([0,0,0]) <150} do { (_pilot) setdammage 1; sleep _pilotWaittime; }; */ _killpilots = { _chop = _this select 0; _crew = _this select 1; waitUntil {count units _chop == 0 or not canmove _chop}; sleep 1.0; {_x setdammage 1} foreach _crew; }; private ["_rf","_startsb","_poscreate","_rndx","_rndy","_kpos","_allunits","_maxu","_upos","_dcounta","_d","_max","_heli","_spawne","_killh1","_pilot"]; for [{_loop=0}, {_loop<1}, {_loop=_loop}] do { diag_log text format ["AirpatroleEast1ON: %1", RND_number]; _rf = 15 + (random 15); sleep _rf; _poscreate = getmarkerpos "spawnaire"; _pilot = createGroup (east); _rndx = random 600; _rndy = random 600; _kpos = [(_poscreate select 0)-300 +_rndx,(_poscreate select 1)-300+_rndy,500]; _allunits = jig_east_AIpilot; _maxu = (count _allunits)-1; _upos = getmarkerpos "centerp"; _dcounta = 0; _d = 0; while {_d <= _dcounta} do { (_allunits select round random _maxu) createUnit [_upos, _pilot];Sleep jig_tvt_globalsleep; _d = _d+1; }; jig_air_pate1 = ["I44_Plane_G_Bf109E4_WL"]; _allvecs = jig_air_pate1; _max = (count _allvecs)-1; _heli = createVehicle [_allvecs select (round random _max), _kpos, [], 50, "FLY"]; Sleep jig_tvt_globalsleep; sleep 0.1; _heli setpos [getpos _heli select 0, getpos _heli select 1, 400]; _heli setdir (random 100); _heli engineon true; (units _pilot select 0) assignAsDriver _heli; (units _pilot select 0) moveInDriver _heli; _pilot setCombatMode "RED"; _x addEventHandler ["killed", {handle = [_this select 0] execVM "Scripts\bury.sqf"}]; _heli addEventHandler ["killed", {handle = [_this select 0] execVM "Scripts\bury.sqf"}]; _spawne = [_heli] spawn {[_this select 0] call BIS_EVO_idelSVEC}; _killh1 = [_heli,crew _heli] spawn {[_this select 0,_this select 1] call _killpilots}; sleep 1.0; call _wpfnc; sleep 10; waitUntil {(not (alive _heli)) or (isNull (driver _heli))}; if (alive _heli) then {_heli setdammage 1}; sleep _varisleep; if (alive (units _pilot select 0)) then {(units _pilot select 0) setdammage 1}; }; Any input appreciated. Edited May 23, 2013 by Jigsor Share this post Link to post Share on other sites
Joe98 92 Posted May 24, 2013 To make a waypoint go to a specific object = = = = = = = = = = = = = = = = = = = = = = = I place a box on the map and name it box1. I place 5 markers on the map and group them with the box Every time the mission starts the box starts at a random place. The box’s original location and the 5 markers means a random selection of 6 places. TEST1 = = = = = I wish my troops to walk to a waypoint and then walk to the box to finish. I need to give my group a name. In my own int I type razor = group this In the “On Act†field of the waypoint I type [razor, 1] setWaypointPosition [position box1, 0] TEST2 = = = = = I wish my troops to walk to 2 waypoints and then walk to the box to finish. I need to give my group a name. In my own int I type razor = group this The “On Act†field of waypoint 1 is left blank In the “On Act†field of waypoint 2, I type [razor, 2] setWaypointPosition [position box1, 0] TEST3 = = = = = I wish my troops to walk to 3 waypoints and then walk to the box to finish. I need to give my group a name. In my own int I type razor = group this The “On Act†field of waypoint 1 is left blank The “On Act†field of waypoint 2 is left blank In the “On Act†field of waypoint 3, I type [razor, 3] setWaypointPosition [position box1, 0] . Share this post Link to post Share on other sites
Jigsor 176 Posted May 24, 2013 Thanks Joe, but that is a bit different than what I'm trying to do I beleive. Your box is placed at a predetermined unique marker already placed on map, not the same marker recreated at new location and placed by script.Also my waypoints cycle as it should for an air patrol. Once your waypoint ie: [razor, 3] setWaypointPosition [position box1, 0] is reached, You Ai will finish waypoint. You have not updated your waypoint in this example. I see no loop here. I think my problem is with loop and not being able to update cycle loop. I've seen your method used countless times with uniquely named markers placed on the map then a script chooses one of those markers by count or random. Some of my objectives use isFlatEmpty command for random placement of an object and marker so those coordinates are not determined until the script finds a suitable location. Trying to keep this universally dynamic in the sense of scripts generating markers and waypoints based on markers not placed in map but unforeseen places. Share this post Link to post Share on other sites
Jigsor 176 Posted May 29, 2013 Got it working with this new version of the air patrol script. If marker moves to new position the air patrol will move to it. Next problem is if air patrol encounters an enemy base with enemy AI while in route. The patrol will stay there until they get shot down. I need to incorporate a scripted switch trigger maybe to waypoint function in order to force them to next waypoint. Any any ideah if and how its possible? //airpate1.sqf //makesu.sqf from GITS Evolution //makesu.sqf Original Authors Kiljoy //makesu.sqf Modified by Eggbeast, GITS //Ultra Simple Patrol Script v1.4 by JW Custom //Merged/Modified by Jigsor. //Makes side east aircraft and sets waypoints. //starts in airpatinit.sqf with _spawnaire1 = [] execVM "Scripts\airpate1.sqf"; if (!isServer) exitWith {}; private ["_patrolMarker","_patrolRadius","_spawnRadius","_spawnMarker","_pilotBehaviour","_existChance","_pilotSpeed","_pilotFormation","_numGrp","_flyInHeight","_wpfnc","_grp","_qna","_qnb","_qnc","_qnd","_qne","_varisleep","_aiairpatres","_chop","_crew","_killpilots"]; "tsk0init" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "oamarker" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "cyclewpmrk" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "spawnaire" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; /* "spawnairw" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; "_invhelipad" addPublicVariableEventHandler {call compile format ["%1",_this select 1]}; */ waituntil {tsk0init == 1}; sleep 16;//wait for initial marker creation of "oamarker","cyclewpmrk" and "spawnaire" //Air Respawn Fequency Param _qna=false; _qnb=false; _qnc=false; _qnd=false; _qne=false; _aiairpatres=(paramsArray select 7); switch (_aiairpatres) do { case 0:{_qna=true}; case 1:{_qnb=true}; case 2:{_qnc=true}; case 3:{_qnd=true}; case 4:{_qne=true}; }; if (_qna) then {_varisleep = 30;}; if (_qnb) then {_varisleep = 75;}; if (_qnc) then {_varisleep = 120;}; if (_qnd) then {_varisleep = 165;}; if (_qne) then {_varisleep = 210;}; /* Ultra Simple Patrol Script v1.4 by JW Custom. Convertion to funciton and modified by Jigsor ----------------------------------------------------------------------------------------------------------- argument 0: The unit/group leader we are dealing with argument 1: The radius size where to randomly place the unit/group within argument 2: The marker representing the radius center of where unit/group will be randomly placed within argument 3: The marker representing the center of the unit/group patrol argument 4: The radius size where unit/group will patrol within argument 5: The behaviour of the unit/group argument 6: Chance of unit/group existing in percentage. If set to 100 the unit/group will always exist. argument 7: Movement speed of the unit/group. argument 8: Group formation. argument 9: Wait time in seconds before moving on to next waypoint. Set to 0 and theres no wait time. argument 10: Altitude of unit/group. Unless unit/group are a air vehicle this should be set to 0. argument 11: The marker representing Cycle waypoint. */ _wpfnc = { private ["_wphandle","_spawnRadius","_spawnMarker","_patrolMarker","_patrolRadius","_pilotBehaviour","_existChance","_pilotSpeed","_pilotFormation","_pilotWaittime","_flyInHeight","_chance","_wp","_wp1","_wp2","_wp3","_realpos","_cyclemrkr","_pilot","_airdest","_poscreate","_spwnairdir"]; _wphandle = [_pilot, 300, "spawnaire", "oamarker", 1000, "SAFE", 100, "FULL", "VEE", 4, 300, "cyclewpmrk"]; _pilot = _wphandle select 0; _spawnRadius = _wphandle select 1; _spawnMarker = _wphandle select 2; _patrolMarker = _wphandle select 3; _patrolRadius = _wphandle select 4; _pilotBehaviour = _wphandle select 5; _existChance = _wphandle select 6; _pilotSpeed = _wphandle select 7; _pilotFormation = _wphandle select 8; _pilotWaittime = _wphandle select 9; _flyInHeight = _wphandle select 10; _cyclemrkr = _wphandle select 11; _grp = group _pilot; _airdest = getMarkerPos "oamarker"; _poscreate = getmarkerpos "spawnaire"; _chance = ceil(random 100); if (_chance > _existChance) then { {deleteVehicle vehicle _x; deleteVehicle _x; sleep 0.1;} forEach units _grp; }; _wp = _grp addWaypoint [getMarkerPos _patrolMarker, 1]; _wp setWaypointBehaviour "COMBAT"; _wp setWaypointSpeed "FULL"; _wp setWaypointFormation "VEE"; _wp setWaypointType "MOVE"; _wp setWaypointCombatMode "Yellow"; [_grp, 1] setWaypointPosition [getMarkerPos "spawnaire", 300]; _spwnairdir = [_poscreate, _airdest] call BIS_fnc_dirTo; vehicle _x setpos [(_spwnairpos select 0) + (sin (_spwnairdir -180)), (_spwnairpos select 1) + (cos (_spwnairdir -180)), 300]; //vehicle _x setVelocity [(vectorDir this select 0)*100,(vectorDir this select 1)*100,(vectorDir this select 2)*100]; sleep 2; while {{alive _x} count units _grp > 0} do { waitUntil{ ((getPos leader _grp) distance (getMarkerPos ["spawnaire"]) < (_flyInHeight * 3) - _flyInHeight) }; sleep _pilotWaittime; _wp1 = _grp addWaypoint [getMarkerPos "spawnaire", 25]; [_grp, 1] setWaypointBehaviour "COMBAT"; [_grp, 1] setWaypointSpeed "FULL"; [_grp, 1] setWaypointFormation "VEE"; [_grp, 1] setWaypointType "MOVE"; [_grp, 1] setWaypointPosition [getMarkerPos "spawnaire", 300]; [_grp, 1] setWaypointCompletionRadius 300; [_grp, 1] setWaypointCombatMode "Yellow"; [_grp, 1] setWaypointStatements ["true", ""]; sleep 2; _wp2 = _grp addWaypoint [getMarkerPos "oamarker", 25]; [_grp, 2] setWaypointBehaviour "COMBAT"; [_grp, 2] setWaypointSpeed "FULL"; [_grp, 2] setWaypointFormation "VEE"; [_grp, 2] setWaypointType "MOVE"; [_grp, 2] setWaypointPosition [getMarkerPos "oamarker", 25]; [_grp, 2] setWaypointCompletionRadius 300; [_grp, 2] setWaypointCombatMode "Yellow"; [_grp, 2] setWaypointStatements ["true", ""]; sleep 2; _wp3 = _grp addWaypoint [getMarkerpos "cyclewpmrk", 25]; [_grp, 3] setWaypointBehaviour "COMBAT"; [_grp, 3] setWaypointSpeed "FULL"; [_grp, 3] setWaypointFormation "VEE"; [_grp, 3] setWaypointType "Cycle"; [_grp, 3] setWaypointPosition [getMarkerPos "cyclewpmrk", 25]; [_grp, 3] setWaypointCompletionRadius 2825; [_grp, 3] setWaypointCombatMode "Yellow"; [_grp, 3] setWaypointStatements ["true", ""]; sleep 2; }; }; _killpilots = { _chop = _this select 0; _crew = _this select 1; waitUntil {count units _chop == 0 or not canmove _chop}; sleep 1.0; {_x setdammage 1} foreach _crew; }; private ["_airdest","_poscreate","_spwnairdir","_rndx","_rndy","_kpos","_allunits","_maxu","_upos","_dcounta","_d","_max","_allvecs","_heli","_heli1","_heli2","_spawne","_killh1","_pilot"]; for [{_loop=0}, {_loop<1}, {_loop=_loop}] do { // diag_log text format ["AirpatroleEast1ON: %1", RND_number]; sleep _varisleep; _airdest = getMarkerPos "oamarker"; _poscreate = getmarkerpos "spawnaire"; _pilot = createGroup (east); _rndx = random 600; _rndy = random 600; _kpos = [(_poscreate select 0)-300 +_rndx,(_poscreate select 1)-300+_rndy,500]; _allunits = jig_east_AIpilot; _maxu = (count _allunits)-1; _upos = getmarkerpos "centerp"; _dcounta = 2; _d = 0; while {_d <= _dcounta} do { (_allunits select round random _maxu) createUnit [_upos, _pilot];Sleep jig_tvt_globalsleep; _d = _d+1; }; jig_air_patrolee1 = ["I44_Plane_G_Bf109E4_WL","I44_Plane_G_Bf109F2_WL","I44_Plane_G_Bf109G6_WL"]; _allvecs = jig_air_patrolee1; _max = (count _allvecs)-1; _heli = createVehicle [_allvecs select (round random _max), _kpos, [], 50, "FLY"]; Sleep jig_tvt_globalsleep; sleep 0.1; _spwnairdir = [_poscreate, _airdest] call BIS_fnc_dirTo; _heli setpos [(_poscreate select 0) + (sin (_spwnairdir -180)), (_poscreate select 1) + (cos (_spwnairdir -180)), 300]; _heli engineon true; (units _pilot select 0) assignAsDriver _heli; (units _pilot select 0) moveInDriver _heli; //adding _heli1 = createVehicle [_allvecs select (round random _max), _kpos, [], 50, "FLY"]; Sleep jig_tvt_globalsleep; sleep 0.1; _spwnairdir = [_poscreate, _airdest] call BIS_fnc_dirTo; _heli1 setpos [(_poscreate select 0) + (sin (_spwnairdir -180)), (_poscreate select 1) + (cos (_spwnairdir -180)), 300]; _heli1 engineon true; (units _pilot select 1) assignAsDriver _heli1; (units _pilot select 1) moveInDriver _heli1; //adding _heli2 = createVehicle [_allvecs select (round random _max), _kpos, [], 50, "FLY"]; Sleep jig_tvt_globalsleep; sleep 0.1; _spwnairdir = [_poscreate, _airdest] call BIS_fnc_dirTo; _heli2 setpos [(_poscreate select 0) + (sin (_spwnairdir -180)), (_poscreate select 1) + (cos (_spwnairdir -180)), 300]; _heli2 engineon true; (units _pilot select 2) assignAsDriver _heli2; (units _pilot select 2) moveInDriver _heli2; _pilot setFormation "VEE"; _pilot setCombatMode "RED"; {_x addEventHandler ["killed", {handle = [_this select 0] execVM "Scripts\bury.sqf"}]} forEach (units _pilot); _heli addEventHandler ["killed", {handle = [_this select 0] execVM "Scripts\bury.sqf"}]; _spawne = [_heli] spawn {[_this select 0] call BIS_EVO_idelSVEC}; _killh1 = [_heli,crew _heli] spawn {[_this select 0,_this select 1] call _killpilots}; //adding _heli1 addEventHandler ["killed", {handle = [_this select 0] execVM "Scripts\bury.sqf"}]; _spawne = [_heli1] spawn {[_this select 0] call BIS_EVO_idelSVEC}; _killh1 = [_heli1,crew _heli1] spawn {[_this select 0,_this select 1] call _killpilots}; //adding _heli2 addEventHandler ["killed", {handle = [_this select 0] execVM "Scripts\bury.sqf"}]; _spawne = [_heli2] spawn {[_this select 0] call BIS_EVO_idelSVEC}; _killh1 = [_heli2,crew _heli2] spawn {[_this select 0,_this select 1] call _killpilots}; sleep 1; call _wpfnc; sleep 1; // waitUntil {(not (alive _heli) or not(alive _heli1) or not(alive _heli2)) or (isNull (driver _heli) or isNull (driver _heli1) or isNull (driver _heli2))}; waitUntil {(not (alive _heli) AND not (alive _heli1) AND not (alive _heli2)) or (isNull (driver _heli) AND isNull (driver _heli1) AND isNull (driver _heli2))}; if (alive _heli) then {_heli setdammage 1}; if (alive _heli1) then {_heli1 setdammage 1}; if (alive _heli2) then {_heli2 setdammage 1}; sleep 15; if (alive (units _pilot select 0)) then {(units _pilot select 0) setdammage 1}; if (alive (units _pilot select 1)) then {(units _pilot select 1) setdammage 1}; if (alive (units _pilot select 2)) then {(units _pilot select 2) setdammage 1}; }; Anybody? Share this post Link to post Share on other sites